ncl-metno home

shell scripts:


c-mask.sh

Syntax

Example 1: Temperatures masked by a range in corresponding layer thickness values

The figure below was made by issuing the command:

c-mask.sh 4dmapr hycom_031_TS.nc hycom_031_h.nc temp thknss 0 20 12 97

Here, temperatures in layer no. 12 (at time step no. 97) is displayed for regions where the thickness of the same layer, at the same time, read from the same file, is outside the range from 0 to 20 (m).

Example 2: As Example 1, but with more contours

This figure was made by issuing the same command as in Example 1, after the file userdef.ncl was copied from /home/arnem/lib/ncl-metno/ , with the contents of three lines changed to

v1=  1.   ; Low  value for isopleths, disregarded when  nv  is 0 or 1
v2= 18.   ; High value for isopleths, disregarded when  nv  is 0 or 1
nv= 17    ; No. of isopleths, there will be  nv+1  colors

in order to specify the use of contours and colors.

c-mask.sh: syntax

marine:~% c-mask.sh --help

           c-mask.sh  /  ncl-metno 1.2

>>>
>>>
>>> Syntax:
>>> =======
>>>
>>>  c-mask.sh <option> <file1> <file2> <var1> <var2> <val1> <val2> [<d3node> (<d4node>)]
>>> where
>>>    <option>  specifies dimensions and geo- or nongeo-grid
>>>                  [234]d               - [234]D fields
>>>                  [234]dmap/[234]dmapr - [234]D fields, dims. are lon & lat
>>>                  [234]dMap/[234]dMapr - [234]D fields, lon & lat are 2d fields
>>>                  ...[234]d[mM]ap will be displayed on a geogr. map
>>>                  options *r mask values inside the range [<val1>,<val2>],
>>>                   other options mask values outside of the range
>>>    <file1>   name of the netcdf file w/ variable to depict
>>>    <file2>   name of the netcdf file w/ masking variable
>>>               you may type '.' if <file1> & <file2> are the same
>>>    <var1>    name of variable on the netcdf file to depict
>>>               (case sensitive)
>>>           NOTE! This script requires the existence of an
>>>                 attribute 'missing_value' to <var1>
>>>    <var2>    name of variable to use for masking <var1>
>>>               (case sensitive)
>>>               you may type '.' if <var1> & <var2> are the same
>>>    <val1>, <val2>
>>>              limits for masking:
>>>               <option> = *r  :
>>>                   <var1> will be masked for values  INSIDE the range (<val1>,<val2>)
>>>               otherwise      :
>>>                   <var1> will be masked for values OUTSIDE the range (<val1>,<val2>)
>>>    <d3node>  node no. of third dimension
>>>                if <option> is one of   2d(r), 2dmap(r)
>>>                  and a fourth argument is present
>>>                  or if <option> is negative,
>>>                 this will be interpreted as a flag that will cause
>>>                  the ncl script to remain (see examples below)
>>>    <d4node>  node no. of fourth dimension
>>>
>>>  Special case:
>>>   If <option> is one of [234]dMap, the name of the 2d longitude and
>>>    latitude variable may be specified on the command line:
>>>   c-mask.sh <option> <lonname> <latname> <file1> <file2> <var1> <var2> <val1> <val2> [<d3node> (<d4node>)]
>>>    (Alternatively, if these names are not 'lon' or 'lat', 'userdef.ncl' may
>>>     be edited when option is one of [234]dMap.)
>>>
>>>  The script will produce an eps-file and a png-file.
>>>
>>>
>>> User specifications:
>>> ====================
>>>
>>>  By copying the default spec.s from
>>> /home/arnem/lib/ncl-metno/userdef.ncl
>>>  to the directory where the command 'c-mask.sh' is given,
>>>  the user may specify
>>>   * title
>>>   * font
>>>   * zooming
>>>   * color map (palette)
>>>   * no. of colors
>>>   * plot size limits
>>>   for geographical maps:
>>>   * names of longitude & latitude variables
>>>   * map projection
>>>   * coastline detail level
>>>  (look up, or copy, this file to edit your own 'userdef' file).
>>>
>>>
>>> Examples:
>>> =========
>>>
>>>  c-mask.sh 4dmap hydrography.nc . temp salt 34 35 1 10
>>>    will produce a depiction on a lon-lat grid w/ a map,
>>>     of the first vertical level and the tenth time step
>>>     of the variable 'temp' on the file 'hydrography.nc'
>>>    the 'temp' field will be masked wherever 'salt', from
>>>    the same file, is outside the range <34, 35>
>>>  c-mask.sh 3dr ssh.nc sst.nc ssh sst 0 10 -1
>>>    will produce a depiction on a x-y grid for the first
>>>    node in the third dimension time step, of the variable
>>>     'ssh' on the file 'ssh.nc'; and the ncl script
>>>     will be retained; the 'ssh' field will be masked
>>>     wherever 'sst' from 'sst.nc' is negative or >10
>>>
>>>
>>> Terminating.