A number of helper scripts are available at NCI to assist with working with UM files and model runs.

The following scripts are courtesy of Martin Dix from CAWCR. These files are available on Raijin under ~access/apps/pythonlib/umfile_utils

Information

  • um_fieldsfile_dump.py -i FILE: Print FILE's header information
  • lbcdump.py -i INFILE: Get information about a lateral boundary condition file

Modifying Files

  • change_calendar.py: Convert from Gregorian to a 360 day calendar
  • change_calendar365.py: Convert from 360 day to Gregorian calendar
  • change_dump_date.py FILE: Change the file's date
  • change_endianness.py -i INFILE -o OUTFILE: Swap between big/little endian format (Files used by the model should be big-endian)
  • change_stashcode.py -v OLD,NEW FILE: Change the STASH code of variables in the file
  • count_land.py FILE: Count the number of land points in a land mask
  • fix_polar_anom.py FILE: Fix anomalies in polar fields
  • interpolate_ancillaries.py -i INFILE -o OUTFILE -m MASK: Convert all the fields in INFILE to use the grid used by MASK
  • perturbIC.py -a AMPLITUDE FILE: Apply a perturbation to an initial conditions file
  • polar_anom.py FILE: Check the values at the poles
  • subset_ancillary.py -i INFILE -o OUTFILE -x X0,NX -y Y0,NY: Extract a region from an ancillary file
  • um_replace_field.py -i FILE -v STASH -n NETCDF -v VAR: Add a variable from a netcdf file to FILE
  • um_zero_field.py -v STASH FILE: Zero out a field in the file

Conversion and Copying

  • um2netcdf.py -i INFILE -o OUTFILE -s STASH: Convert a single variable to netcdf format
  • um2netcdf_all.py -i INFILE -o OUTFILE: Convert all variables to netcdf format
  • um_copyfield.py -i AFILE -o BFILE -v STASH: Copy a field from AFILE into BFILE
  • um_fields_subset.py -i INFILE -o OUTFILE: Extract selected variables from INFILE
  • mergefiles.py AFILE BFILE OUTFILE: Combine the fields in AFILE and BFILE
  • um_timeseries.py -i INFILE -o OUTFILE: Convert file to netcdf
  • umv2netcdf.py -i INFILE -o OUTFILE: Convert file with variable grid to netcdf