ncl-metno home

shell scripts:


mc-mask.sh

Syntax

Example: Nitrate concentration in oxygen rich waters

    The figures below were made by
  • first copying the file userdef.ncl from /home/arnem/lib/ncl-metno/
  • then, specifying the title to
    mytitle= "Nitrate concentration"
    
  • and modifying the contents of three lines to
    v1=    50. ; Low  value for isopleths, disregarded when  nv  is 0 or 1
    v2=   220. ; 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 lock the use of contours and color map (such a specification is essential to invoke when executing the multi-figure scripts mcontour.sh), mc-mask.sh and mlayersection.sh)

Finally, the following command was issued:

mc-mask.sh 4dMapr bio4km_nitrate.nc bio4km_oxygen.nc nitrt oxygn 0 10000 3 1 43 3

By executing this command, a set of ppm & gif images for the nitrate concentrations at level no. 3 for time steps 1, 4, 7,..., 43, for the part of the domain where the oxygen concentration exceeds 10000 (i.e., the concentration is outside the range [0,10000]). The gif images are assembled in an animation, and the result is:


mc-mask.sh: syntax

mc-mask.sh --help

           mc-mask.sh  /  ncl-metno 1.2

>>>
>>>
>>> NOTE: The user is **STRONGLY** recommended to copy
>>> /home/arnem/lib/ncl-metno/userdef.ncl
>>>  to the directory where the command 'mc-mask.sh' is given,
>>>  and at least specify
>>>   * color map (palette)
>>>  -otherwise, the series of files produced by  mc-mask.sh
>>>   will (usually) NOT have the same color map (see more information below)
>>>
>>> NOTE: This script will provide a set of output files, where
>>>  the value of the final (3rd or 4th) dimension changes from
>>>  one output file to the next. Below, we assume that this
>>>  dimension is time.
>>>
>>> Syntax:
>>> =======
>>>
>>> ...if  <option> is  4d(r)  or  4dmap(r):
>>>  mc-mask.sh <option> <file1> <file2> <var1> <var2> <val1> <val2> <depth> <first> <last> (<step>)
>>> ...if  <option> is  3d(r)  or  3dmap(r):
>>>  mc-mask.sh <option> <file1> <file2> <var1> <var2> <val1> <val2> <first> <last> (<step>)
>>> where
>>>    <option>  specifies dimensions and geo- or nongeo-grid
>>>                  [34]d   /[34]dr    - [34]D fields
>>>                  [34]dmap/[34]dmapr - [34]D fields, dims. are lon & lat
>>>                  [34]dMap/[34]dMapr - [34]D fields, lon & lat are 2d fields
>>>                  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>)
>>>    <depth>   vertical level no.
>>>    <first>     first time step no.
>>>    <last>      last  time step no.
>>>    <step>      time step between consequtive frames
>>>                 (optional, set to  1  if not specified by user)
>>>    <delay>     frame delay in ms (optional, set to  10  if not specified by user)
>>>
>>>  Special case:
>>>   If <option> is one of [34]dMap, the name of the 2d longitude and
>>>    latitude variable may be specified on the command line, e.g. (3D fields):
>>>   mc-mask.sh <option> <lonname> <latname> <file1> <file2> <var1> <var2> <val1> <val2> <first> <last> (<step>)
>>>    (Alternatively, if these names are not 'lon' or 'lat', 'userdef.ncl' may
>>>     be edited when option is one of [34]dMap.)
>>>
>>>  The script will produce a gif animation.
>>>
>>>
>>> User specifications:
>>> ====================
>>>
>>>  By copying the default spec.s from
>>> /home/arnem/lib/ncl-metno/userdef.ncl
>>>  to the directory where the command 'mc-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).
>>>
>>>
>>> Example:
>>> ========
>>>
>>>  mc-mask.sh 4dmap hydrography.nc temp salt 34 35 1 10 15
>>>    will produce a 6 frame gif animation for time steps 10-15
>>>     of the first vertical level of the variable 'temp'
>>>     on the file 'hydrography.nc', on a lon-lat grid w/ a map;
>>>    the 'temp' field will be masked wherever 'salt' is outside the range <34, 35>
>>>
>>>
>>> Terminating.