Scripts, small utilities & tutorials


This utility fits a streamfunction to a 2-D flow field using Landweber iteration. The flow field is the only input required (in contrast with traditional methods requiring boundary conditions to be specified). The utility is written in Fortran-95 and includes a Matlab/Octave wrapper for convenience. The implementation assumes that the 2-D flow field is on an Arakawa-C grid of uniform mesh size (dx=dy=constant).

Energy spectral density heatmaps

I wrote down my notes on how to obtain an Energy Spectral Density (ESD) heatmap with time on the horizontal axis, frequency on the vertical axis, and a colorscale with units of squared amplitude / frequency. The latter is not always easy to obtain; many methods will produce a colorscale with relative units (e.g., decibels) that are meaningful within a specific ESD, but not comparable from one ESD to another. The ESD are computed in Matlab/Octave using the freely available LTFAT toolbox.
Download: Notes (PDF) (2021-06-28)

Portable video from still images

I wrote down my notes on how to create a portable video, i.e., one that will work across platforms and devices. In this case the video is created from still images.

  1. Generate the images sequentially with a suitable filename, e.g., frame0001.png, frame0002.png… In Octave/Matlab, it would look something like:
    print( '-dpng', [ 'frame' num2str( i, '%04u' ) '.png' ] );
  2. ffmpeg -i frame%04d.png -c:v libx264 -preset slow -pix_fmt yuv420p my_video.mp4

libx264 is the non-proprietary implementation of the H.264 video encoding format. The option -pix_fmt yuv420p is necessary for the video to work under QuickTime (Mac) and Windows Media Player. If the video plays too fast, a quick remedy is to repeat each frame a few times (three times in this example) during the encoding:
ffmpeg -i frame%04d.png -vf "setpts=3.0*PTS" -c:v libx264 -preset slow -pix_fmt yuv420p my_video.mp4

Archiving large datasets on an external drive (tutorial)

External drives of large capacity (≥ 5TB) are convenient tools to store/archive the datasets generated by remote HPC clusters (such a XSEDE). I wrote down my notes on how to directly transfer a dataset from the cluster to the drive using Globus and ensure its integrity. The procedure doesn't require scp/sftp access, doesn't require administrative (root) privileges on the local machine, and doesn't require local disk resources other than the external drive. The tutorial was written for graduate students at VIMS but should be easily adaptable.
Download: Tutorial (PDF) (2019-05-26)