access_AncillaryFileModification - ACCESS-NRI/accessdev-Trac-archive GitHub Wiki

Ancillary file modification

Editing land sea masks

~access/apps/pythonlib/umfile_utils/mask_edit.py is a GUI editor for land sea masks. To use it on raijin

% module use ~access/modules
% module load iris
% python ~access/apps/pythonlib/umfile_utils/mask_edit.py -h
usage: mask_edit.py [-h] [-v] [-m {a,l,m,h}] [-o OUTFILE] [maskfile]

Interactvely edit a UM land-sea mask

positional arguments:
  maskfile       Input mask file (default qrparm.mask)

optional arguments:
  -h, --help     show this help message and exit
  -v, --verbose  verbose output
  -m {a,l,m,h}   Map resolution
  -o OUTFILE     Output file for corrections (default is standard out)

Map resolution can be a (GA Australian), l (global low res), m (global medium res) or h (global high res). The output is a list of changed points that can be used by the Central Ancillary Program when regenerating a mask. The mask file itself is not changed. All the other ancillaries will have to be regenerated with the new mask anyway and the list of changed points is more convenient for keeping under version control.

The program displays a matplotlib window which can be panned and zoomed using the normal controls (http://matplotlib.org/users/navigation_toolbar.html). Note that the lat/lon grid and labels doesn't get always get cleared properly so may look a little odd, particularly if you go back to a previous view.

Clicking on the map will flip the status of a grid box. A changed box will be shown as slightly darker than the original land or ocean. Undo by clicking again to flip it back. If nothing happens, you've probably still got the zoom tool selected ("zoom rect" is displayed in bottom RH corner of the window). When done, simply close the window and a list of changed points will be created. For sample output for adding Fiji to N512 see https://accessdev.nci.org.au/trac/ticket/165#comment:3.

The land sea mask is calculated from the IGBP 1 km land cover dataset. This has navigation problems and may be up to a couple of km off in some regions (and the offset varies geographically). There are also problems with the GSHHS coastline dataset (​http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html) that iris and basemap use. This also has errors of up to 1 km around Australia (not simply a datum error because it isn't consistent). https://accessdev.nci.org.au/trac/wiki/access/IrisExamples#Usingalternatecoastlines.

For very high resolution Australian grids you should use the -m a option which uses the GA coastline data. Note that this may be very slow on anything larger than an ACCESS-C scale region.

Note that this also works with rotated and variable grids.

Example view showing several points altered at Kangaroo Island in the APS2 AD domain. Boxes changed from land to ocean are dark blue and boxes changed from ocean to land are dark green. mask_edit.png

Output in this case is

Number of points changed 4
&DATAC FIELD_NO=1, POINT_NO=377503, DATA_NEW=.FALSE. /
&DATAC FIELD_NO=1, POINT_NO=378319, DATA_NEW=.FALSE. /
&DATAC FIELD_NO=1, POINT_NO=382388, DATA_NEW=.TRUE. /
&DATAC FIELD_NO=1, POINT_NO=383204, DATA_NEW=.TRUE. /

Attachments