Monday, March 4, 2013

Posting videos to the web.

First, let's extract some frames from a series of movies (in .mp4 format)

for file in mayjune*.mp4 ; do ffmpeg -i $file  -r 1 -vframes 1 -ss 00:00:50 ${file%%.mp4}.png ; done

Friday, May 27, 2011

Add word skip in iTerm

Go to 'Manage Profiles' -> 'Keyboard' -> 'Global'

Add an item. Select right arrow and option key to add escape sequence. Put the letter 'b' in the text box (no quotes). Do the same thing for right arrow and 'f'. Done.

Sunday, August 29, 2010

Changing a fixed record dimension to unlimited

Sometimes, especially for concatenation, you need to change a fixed length dimension (usually time) to `UNLIMITED`.

To do this, create a netcdf file with only one (unlimited) dimension the same size and name as the dimension you want to convert.

nc = netCDF4.Dataset('', 'w', format='NETCDF3_CLASSIC')
nc.dimensions['time'] = -1

This [python code](, for example, creates an unlimited dimension with a length of one. Next, use `ncks` (one of the [netcdf operators]( to append the old information to the new file.

ncks -A

You will then need to move `` to the original file name.

Not the simplest hack, but pretty simple, and works.

Wednesday, July 21, 2010

Compiling netcdf4 for ROMS

ROMS likes static netCDF4 libraries. This is how to compile those:

export FC=gfortran
export F77=gfortran
export F90=gfortran
export FFLAGS='-O3'
./configure --prefix=/opt/netcdf4_static/gfortran --enable-netcdf-4 --with-hdf5=/opt/hdf5/gfortran --disable-shared --disable-dap

This configuration makes a set of static libraries that do not use opendap (otherwise, a libcurl needs to be linked to). Other programs prefer the shared libraries, so these go to the usual location /opt/netcdf4/gfortran.

Tuesday, July 13, 2010

Presentation fonts

I usually use Helvetica for presentations, and then include LaTeX equations using LaTeXit. The best font to use with Helvetica seems to be Arev, which has the right weight to balance Helvetica. To use this, simply put


in the preamble.

Monday, July 5, 2010

Auto Draft

Random netcdf4-python notes

Some notes on using netcdf4-python

  • Use the shared netcdf4 libraries to compile. (ROMS needs static netcdf4 libraries -- so you need to build both).
  • The new version returns a when there are missing values.
  • Using ncks (from the netCDF operators) to compress -- need to be careful about specifying netcdf4_classic format. Standard netcdf4 format does not play nice with MFDataset.
  • The new netCDF4 is DAP enabled, a feature that is passed through to netcdf4-python. All you need to do is specify a DAP-URL, and you can see your data over the internet!