CDFTOOLS Man pages

- NAME
- PACKAGE DESCRIPTION
- SYNOPSIS
- EQUATION OF STATE
  - cdfbn2
  - cdfsig0
  - cdfsigi
  - cdfsiginsitu
  - cdfsigntr
  - cdfspice
- BOTTOM
  - cdfbotpressure
  - cdfbottom
  - cdfbottomsig
- DATA TRANSFORMATION
  - cdf16bit
  - cdf2levitusgrid2d
  - cdf2matlab
  - cdf2regular
  - cdfbathy
  - cdfcoloc
  - cdffixtime
  - cdfnorth_unfold
  - cdfsmooth
  - cdfweight
- DERIVED FIELDS
  - cdfcurl
  - cdfdiv
  - cdfdynh_anom
  - cdfeke
  - cdfgeo-uv
  - cdfgeostrophy
  - cdfgradT
  - cdfhgradb
  - cdflap
  - cdfpvor
  - cdfrhoproj
  - cdfrichardson
  - cdfspeed
  - cdfvita
  - cdfw
  - cdfzisot
- ENERGY DIAGNOSTICS
  - cdfeddyscale
  - cdfeddyscale_pass1
  - cdfets
  - cdfnrj_bci
  - cdfnrj_bti
  - cdfnrj_components
  - cdfnrj_transfert
  - cdfokubow
- ENSEMBLE PROCESSING
  - cdfenstat
- FILE INFORMATIONS
  - cdfcensus
  - cdffindij
  - cdfinfo
  - cdfmax
  - cdfmsk
  - cdfnamelist
  - cdfprobe
  - cdfprofile
  - cdfwhereij
  - cdfzonalout
  - cdfzoom
- FILE OPERATIONS
  - cdfchgrid
  - cdfclip
  - cdfcmp
  - cdfconvert
  - cdfcsp
  - cdfdegrad
  - cdfdifmask
  - cdfnan
  - cdfscale
- FORCING
  - cdfbuoyflx
  - cdfhflx
  - cdfwflx
- ICE DIAGNOSTICS
  - cdficediags
- ICE SHELF PROCESSING
  - cdfisf_fill
  - cdfisf_forcing
  - cdfisf_poolchk
  - cdfisf_rnf
- ICEBERG PROCESSING
  - cdficb_clim
  - cdficb_diags
- INTEGRATION
  - cdffwc
  - cdfheatc
  - cdfmean
  - cdfsigintegr
  - cdfsigintegr_bottom
  - cdfsigintegr_pedro
  - cdfsum
  - cdfvertmean
  - cdfvint
  - cdfzonalmean
  - cdfzonalmeanvT
  - cdfzonalsum
- MASK
  - cdfmeshmask
  - cdfmkmask
  - cdfmltmask
  - cdfpolymask
- MISCELLANEOUS
  - cdfimprovechk
- MIXED LAYER
  - cdfmxl
  - cdfmxlhcsc
  - cdfmxlheatc
  - cdfmxlsaltc
- PASSIVE TRACER
  - cdffracinv
  - cdfpendep
- PREPROCESSING
  - cdfcofdis
  - cdfmaskdmp
  - cdfmppini
- SECOND ORDER MOMENTS
  - cdfuv
  - cdfuvwt
  - cdfvT
  - cdfvsig
- STATISTICS
  - cdflinreg
  - cdfpdf
  - cdfrmsssh
  - cdfstatcoord
  - cdfstats
  - cdfstd
  - cdfstdevts
  - cdfstdevw
- SYSTEM
  - cdfio
  - cdftools
  - eos
  - modcdfnames
  - modpoly
  - modutils
- TIME AVERAGING
  - cdfmoy
  - cdfmoy_freq
  - cdfmoy_weighted
  - cdfmoyt
- TRANSPORT
  - cdf_xtrac_brokenline
  - cdfisopsi
  - cdfmaxmoc
  - cdfmhst
  - cdfmht_gsop
  - cdfmoc
  - cdfmocsig
  - cdfpsi
  - cdfsigtrp
  - cdfsigtrp_broken
  - cdftransig_xy3d
  - cdftransport
  - cdfvFWov
  - cdfvhst
  - cdfvtrp
- AUTHORS
- LICENSE AND COPYRIGHT

# NAME

CDFTOOLS - diagnostics in Fortran 90 for NEMO model outputs

# PACKAGE DESCRIPTION

`CDFTOOLS` is a diagnostic package written in fortran 90 for the analysis of NEMO model output, initialized in the frame of the DRAKKAR project (https://www.drakkar-ocean.eu/). It is now available on GitHub under the CeCILL license (http://www.cecill.info/licences/Licence_CeCILL_V2-en.html).

`NEMO` web site : http://www.nemo-ocean.eu/

# SYNOPSIS

`CDFTOOLS` is a collection of fortran program. Each program belonging to this collection is designed to perform some specific actions on NEMO output files, and generally provides another netcdf file as output. Output files follow the same CDF format as NEMO file, thus allowing for the building of a secondary data base (assuming that the primary data base is just the raw model output).

This documentation is automatically produced by the concatenation of the `USAGE` messages produced by each particular program when invoked without any argument. (Standard behaviour of all cdftools). In the documentation, we use a rather classical formalism, where mandatory arguments are just indicated on the command line and options are indicated between squared brackets [..].

Each program name starts with the 3 letters 'cdf' followed by a word related to the action performed by the tools. Example: `cdfw Ufile.nc Vfile.nc` is used to compute the vertical velocity using the horizontal velocity field represented by its two components Ufile.nc and Vfile.nc.

Better than a long speech, the following paragraphs describes each of the existing cdftools. `CDFTOOLS` have been sorted out by classes in order to have a consistent documentation.

# EQUATION OF STATE

## cdfbn2

      usage : cdfbn2  -t T-file [-W] [-full] [-o OUT-file] [-nc4] [-vvl W-file]

          PURPOSE :
            Compute the Brunt-Vaissala frequency (N2) according to temperature and
            salinity given in the input file.

          ARGUMENTS :
            -t T-file : netcdf input gridT file for temperature and salinity.

          OPTIONS :
            [-W ] : keep N2 at W points. Default is to interpolate N2 at T point on
                  the vertical.
            [-full ] : indicate a full step configuration instead of the default
                  partial steps.
            [-o OUT-file ] : specify output file name instead of bn2.nc.
            [-nc4 ]  : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.
            [-vvl W-file ] : use time-varying vertical metrics, W-file is a file
                      holding e3w(t) for vvl.

          OPENMP SUPPORT : yes

          REQUIRED FILES :
            mesh_zgr.nc is needed for this program.

          OUTPUT :
            netcdf file : bn2.nc unless -o option specified
              variables : vobn2

         SEE ALSO :
            cdfsig0, cdfsigi, cdfsiginsitu, cdfsigntr

## cdfsig0

      usage : cdfsig0 -t T-file [-sal SAL-name] [-tem TEM-name] [-nc4] [-o OUT-file]

          PURPOSE :
            Compute potential density (sigma-0) refered to the surface.

          ARGUMENTS :
            -t T-file  : netcdf file with temperature and salinity.

          OPTIONS :
            [-sal SAL-name]  : name of salinity variable
            [-tem TEM-name]  : name of temperature variable
            [-nc4]  : enable chunking and compression
            [-o OUT-file]    : specify output filename instead of sig0.nc

          OPENMP SUPPORT : yes

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : sig0.nc
              variables : vosigma0 ( kg/m3 - 1000 )

          SEE ALSO :
            cdfsigi, cdfsigintu, signtr

## cdfsigi

      usage : cdfsigi -t T-file -r REF-dep(m) [-o OUT-file] [-nc4]

          PURPOSE :
            Compute potential density referred to the depth given in arguments.

          ARGUMENTS :
            -t T-file  : netcdf file with temperature and salinity.
            -r REF-dep : reference depth in meter.

          OPTIONS :
           [-o OUT-file ] : Specify output file name instead of sigi.nc
           [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                This option is effective only if cdftools are compiled with
                a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : sigi.nc
              variables : vosigmai (kg/m3 -1000 )

          SEE ALSO :
           cdfsig0, cdfsiginintu

## cdfsiginsitu

      usage : cdfsiginsitu -t T-file [-sal SAL-name] [-tem TEM-name ] ...
                     [-dep depth] [-o OUT-file ] [-nc4 ]

          PURPOSE :
            Compute in situ density from temperature and salinity. Depths are taken
            from input file.

          ARGUMENTS :
            -t T-file : netcdf file with temperature and salinity.

          OPTIONS :
            [-sal SAL-name] : name of salinity variable
            [-tem TEM-name] : name of temperature variable
            [-dep depth ]   : depth to be used in case of 2D input file (only)
            [-nc4]          : enable chunking and compression
            [-o OUT-file]   : specify output filename instead of siginsitu.nc

          OPENMP SUPPORT : yes

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : siginsitu.nc or the file name specified
                        with -o option
              variables : vosigmainsitu (kg/m3 -1000 )

          SEE ALSO :
           cdfsig0, cdfsigi, cdfsigntr

## cdfsigntr

      usage : cdfsigntr -t T-file [-o OUT-file] [-nc4]

          PURPOSE :
            Compute neutral volumic mass (kg/m3) from temperature and salinity.

          ARGUMENTS :
            -t T-file  : netcdf file with temperature and salinity.

          OPTIONS :
            [-o OUT-file ] : Specify output file name instead of signtr.nc
            [-nc4 ]      : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.

          OPENMP SUPPORT : yes

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : signtr.nc unless option -o is used.
              variables : vosigntr ( kg/m3 )

          SEE ALSO :
            cdfsig0, cdfsigi, cdfsiginsitu, cdfspice

## cdfspice

      usage : cdfspice -t T-file [-sal SAL-name] [-tem TEM-name] ...
             ... [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the spiceness corresponding to temperatures and salinities
            given in the input file.

            spiciness = sum(i=0,5)[sum(j=0,4)[b(i,j)*theta^i*(s-35)^j]]
                      with:  b     -> coefficients
                             theta -> potential temperature
                             s     -> salinity

          ARGUMENTS :
            -t T-file : netcdf file with temperature and salinity (gridT)

          OPTIONS :
            [-sal SAL-name]  : name of salinity variable
            [-tem TEM-name]  : name of temperature variable
            [-o OUT-file]    : specify output filename instead of spice.nc
            [-nc4]  : enable chunking and compression

          OPENMP SUPPORT : yes

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : spice.nc unless option -o is used.
              variables : vospice

          REFERENCE :
            Flament (2002) "A state variable for characterizing
                  water masses and their diffusive stability: spiciness."
                  Progress in Oceanography Volume 54, 2002, Pages 493-501.

# BOTTOM

## cdfbotpressure

      usage : cdfbotpressure -f T-file [-full] [-ssh] [-ssh2 ] [-xtra ] [-vvl ]
                   ...   [ -o OUT-file ] [-nc4]

          PURPOSE :
               Compute the bottom pressure (pa) from in situ density.

          ARGUMENTS :
              -f T-file : gridT file holding both temperature and salinity.

          OPTIONS :
             [-full] : for full step computation
             [-ssh]  : Also take SSH into account in the computation
                     In this case, use rau0=   1035.000      kg/m3 for
                     surface density (as in NEMO)
                       If you want to use 2d surface density from
                     the model, use option -ssh2
             [-ssh2] : as option -ssh but surface density is taken from
                     the model instead of a constant
             [-xtra] :  Using this option, the output file also contains the ssh,
                     and the pressure contribution of ssh to bottom pressure.
                     Require either -ssh or -ssh2 option. Botpressure is still
                     the total pressure, including ssh effect.
             [-vvl]  : Use  time-varying vertical metrics e3t
             [-o OUT-file] : specify output file instead of botpressure.nc
             [-nc4]  : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.

          OPENMP SUPPORT : yes

          REQUIRED FILES :
            mask.nc and mesh_zgr.nc

          OUTPUT :
            netcdf file : botpressure.nc unless -o option is used.
              variables :  sobotpres, [sossheig sosshpre ]

          SEE ALSO :
             cdfvint

## cdfbottom

      usage : cdfbottom  -f IN-file [-p C-type] [-o OUT-file] [-nc4]

          PURPOSE :
            Create a 2D file with bottom most values for all the variables which
            are in the input 3D file.

          ARGUMENTS :
            -f IN-file : input netcdf 3D file.

          OPTIONS :
            [-p C-type] : specify the type of grid point on the C-grid (T|U|V|F).
                    If not given, assume that land points are values with 0.
            [-o OUT-file ]: specify output filename instead of bottom.nc
            [-nc4 ]     : Use netcdf4 output with chunking and deflation level 1.
                    This option is effective only if cdftools are compiled with
                    a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            mask.nc file is required if the grid point is specified or if
                    the land value is not 0.

          OUTPUT :
            netcdf file : bottom.nc unless -o option is used.
              variables :  same names than input file, long_name attribute is
                    prefixed by Bottom

## cdfbottomsig

      usage : cdfbottomsig  -t T-file [-r REF-depth ] [-ntr] [-o OUT-file] [-nc4]

          PURPOSE :
            Create a 2D file with bottom density. In case a depth reference is
            given, the density is referred to this depth. By default sigma-0 is
            used. Bottom most point is determined from the last non zero salinity
            point in the water column.

          ARGUMENTS :
            -t T-file : input file with temperature and salinity.

          OPTIONS :
            [-r REF-depth] : depth reference for potential density.
                  Without -r nor -ntr options sigma-0 is assumed.
            [-ntr ]: Will use neutral density.
                  Without -r nor -ntr options sigma-0 is assumed.
            [-o OUT-file] : Specify output file name instead of botsig.nc
            [-nc4]:  Use netcdf4 output with chunking and deflation level 1.
                  This option is effective only if cdftools are compiled with
                  a netcdf library supporting chunking and deflation.

          OPENMP SUPPORT : yes

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : botsig.nc unless -o option is used.
              variables : sobotsig0 or sobotsigi ( kg/m3 - 1000 )
                          or sobotsigntr (kg/m3)

# DATA TRANSFORMATION

## cdf16bit

      usage : cdf16bit -f 32BIT-file [-check] [-verbose] [-o OUT-file] [-nc4]

          PURPOSE :
            Convert input 32 bit precision file into 16 bit precision file using
            add_offset and scale_factor.
            Note that predifined values for these two parameters are defined
            according to the variable name. If variable name is not supported,
            no conversion is performed.

          ARGUMENTS :
            -f 32BIT-file : input 32 bit file to be converted

          OPTIONS :
            [-check ]   : control than the scale factors are adequate.
            [-verbose ] : give information level by level.
            [-o OUT-file] : Specify output file name instead of cdf16bit.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : cdf16bit.nc
              variables : same names than in input file

## cdf2levitusgrid2d

      usage : cdf2levitusgrid2d -f IN-file -o OUT-file -v VAR-name2D

          PURPOSE :
            Remaps (by binning) 2D high resolution (i.e. finer than 1x1 deg)
            fields on Levitus 2D 1x1 deg grid. This program does not work for
            vector fields.
            It assumes that the southwestern-most grid cell of the target grid
            (Levitus 1 deg) is centered at (0.5W,89.5S).

          ARGUMENTS :
            -f IN-file  : netcdf input file
            -o OUT-file : netcdf output file
            -v VAR-name2D : input variable name for interpolation

          OPTIONS :

          REQUIRED FILES :
            mesh_hgr.nc
            mask.nc
            levitus_mask.nc

          OUTPUT :
            netcdf file : name given as second argument
              variables : 2d_var_name

## cdf2matlab

      usage : cdf2matlab -f IN-file -v IN-var -k level [-o OUT-file] [-nc4]

          PURPOSE :
            Convert global nemo input file (ORCA configurations) into
            a file with monotonically increasing longitudes.

          ARGUMENTS :
            -f IN-file : input model file.
            -v IN-var  : netcdf variable name to process.
            -k level   : level to process.

          OPTIONS :
             [-o OUT-file] : specify output file name instead of output.nc
             [-nc4 ]: Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : output.nc
              variables : same name than in input file.

## cdf2regular

      usage : cdf2regular -f IN-file -v VAR-name [-o OUT-file] [-360] ...
             ... [-r TGT-resolution] [-nc4]

          PURPOSE :
            Remap (by binnig) high resolution fields on a coarser regular grid,
            keeping the same vertical grid as in the input file.
            This program is not suitable for vector fields, as far as transport
            conservation is concerned.
            Default output grid resolution is 1/ 3 deg. It can be changed using
            the -r option.
            Note that output file is not masked.

          ARGUMENTS :
            -f IN-file  : netcdf input file
            -v VAR-name : input variable name to be remapped.

          OPTIONS :
            [-o OUT-file]: netcdf output file, instead of regular.nc
            [-nc4 ]: Use netcdf4 output with chunking and deflation level 1.
                     This option is effective only if cdftools are compiled with
                     a netcdf library supporting chunking and deflation.
            [-360 ]: Output file longitudes span [0 -> 360 deg.], instead of
                     the default [-180 -> 180 deg.].
            [-r TGT-resolution ]:  Target resolution (in degrees).

          REQUIRED FILES :
            mesh_hgr.nc
            mask.nc

          OUTPUT :
            netcdf file : name given as second argument
              variables : 3d_var_name

          SEE ALSO :
            cdf2levitus2d (a particular case)

## cdfbathy

      usage : cdfbathy/cdfvar -f IN-file [options]

          PURPOSE :
            Allow manual modification of the input file. Very convenient for
            bathymetric files, can also be used with any other model file.
            Keep a log.f90 file of the modifications for automatic reprocessing

          ARGUMENTS :
            -f IN-file : original input file. The program works on a copy of the
                     original file (default)

          OPTIONS :
            -file (or -f )       : name of input file
            -var  (or -v )       : name of cdf variable [default: Bathymetry]
            -lev  (or -l )       : level to work with
            -time (or -t )       : time to work with
            -scale  s            : use s as a scale factor (divide when read the file)
            -zoom (or -z )       : sub area of the bathy file to work with (imin imax jmin jmax)
            -fillzone (or -fz )  : sub area will be filled with 0 up to the first coast line
            -fillpool (or -fp ) [ icrit ] : the whole file is check and fill all the pool smaller than (icrit) cell by 0
            -raz_zone (or -raz ) : sub area will be filled with 0 up
            -raz_below depmin    : any depth less than depmin in subarea will be replaced by 0
               (or -rb depmin )
            -set_below depmin    : any depth less than depmin in subarea will be replaced by depmin
               (or -sb depmin )
            -fullstep depmin     : sub area will be reshaped as full-step, below depmin
               (or -fs depmin )    requires the presence of the file zgr_bat.txt (from ocean.output, eg )
            -dumpzone (or -d )   : sub area will be output to an ascii file, which can be used by -replace
                                   after manual editing
            -nicedumpzone        : sub area will be output to an ascii file (nice output)
                     (or -nd )
            -replace (or -r )    : sub area defined by the file will replace the original bathy
            -append (or -a )     : fortran log file (log.f90) will be append with actual modif
                                   Standard behaviour is to overwrite/create log file
            -overwrite (or -o )  : input bathy file will be used as output.
                                   Standard behaviour is to use a work copy of the original file
                                   (indexed from 01 to 99 if necessary )
            -log logfile         : log file for change (default is log.f90)

          OUTPUT :
               netcdf file : according to used options, if the original file is to be modified
                      a sequence number is added at the end of the input file name, to keep
                      modifications.
                 variables : same as input file

## cdfcoloc

      usage : cdfcoloc -w ROOT-weight -t T-file -u U-file -v V-file [-h] ...
                 ... [-l LST-fields] [-trc TRC-file] [-d DIAG-file] [-b ETOPO-file]

          PURPOSE :
            This program produces 3D colocalized model values for selected fields.
            It is the final pass in the colocalization process initialized by
            'cdfweight', in which the location of the points to be colocalized
            is set. The 2 steps of the process are separated because weight files
            are to be produced only once for a set of data-point and model config,
            whereas 'cdfcoloc' is used for several model files corresponding to
            different times.
            This program was initially written to deal with G. Holloway topostrophy
            works.

          ARGUMENTS :
            -w ROOT-weight : specify the root-name of the weight files (binary
                     files), to which the suffixes '_T.bin', '_U.bin' or '_V.bin'
                     are appended if necessary.
            -t T-file : name of gridT model file, used for default fields.
            -u U-file : name of gridU model file, used for default fields.
            -v V-file : name of gridV model file, used for default fields.

          OPTIONS :
            [-h ] : Gives details on the available fields.
            [-l LST-fields ] : Gives a comma-separated list of selected fields to be
                   colocalized, from a whole set of fields which are fully described
                   with the '-h' option. The default list is: U,V,Sx,Sy,H
                   According to the selected fields, specific model files are to be
                   passed to the program with corresponding option.
            [-trc TRC-file]: name of ptrcT model file, used for when passive tracers
                   related fields are selected (CFCINV, CFCCINC or PENDEP).
            [-d DIAG-file ] : name of specific diagnostic file. This file is used
                   when 'PENDEP' or 'ISOTHICK' are selected. It must have the
                   variables pendep or isothick, respectively produced by
                   'cdfpendep' and 'cdfsigintegr'.
            [-b ETOPO-file ] : name of 'etopo-like' bathymetric file.

          REQUIRED FILES :
            mask.nc. If bathymetric slopes are needed, then
            coordinates.nc and mesh_zgr.nc files are also required.

          OUTPUT :
            Output is a multi columns ASCII file with first 2 columns giving
                 'ID' and 'DEPTH'. Then the line is completed with colocated
                 field values. The output file looks pretty much as the input file
                 used in 'cdfweight' for building the weight files.

          SEE ALSO :
           cdfweight

## cdffixtime

      usage : cdffixtime  -f IN-file -i initial date [-t tag] [-dt freq] ...
                    ...  [-keep ] [-leap] [-noleap]

          PURPOSE :
             Change time_counter in file to set it according to drakkar rule,
             time_counter attibutes 'units' and 'time_origin' are ajusted.
               * units are 'seconds since yyyy-mm-dd hh:mm:ss'
               * time_origin is set to 'yyyy-MMM-dd hh:mm:ss', MMM represents a
                 literal abbreviation for the month (eg: JAN FEB MAR ...)
             Once fixed, the time_counter indicates the middle of the output
             interval (in case of averaged output, of course).

          ARGUMENTS :
            -f IN-file     : specify the file whose time_counter need adjustment
            -i inital date : indicate the time origin in a fixed 2 words format
                        yyyy-mm-dd hh:mm:ss ( eg: 1956-05-16 04:30:00 )

          OPTIONS :
            [-t tag]  : supply a time tag corresponding to the file. If not
                        supplied, tag is taken from the name of the input file
                        assuming DRAKKAR convention ( CONFIG-CASE_tag_xxxx.nc )
            [-dt freq]: number of days between model output [ 5d ]
            [-leap]   : assume a calendar with leap years
            [-noleap] : assume a calendar without leap years (default)
            [-keep]   : keep the actual value of time_counter, adjust time_counter
                        attributes only;

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : Input file is modified (only attributes)

## cdfnorth_unfold

      usage : cdfnorth_unfold -f IN-file -jatl jatl -jpacif jpacif -piv pivot ...
                   ... -p C-type [-o OUT-file] [-nc4]

          PURPOSE :
            Unfolds the Artic Ocean in an ORCA configuration. Produce a netcdf
            file with the Artic ocean as a whole. The area can be adjusted on
            both Atlantic and Pacific sides.

          ARGUMENTS :
            -f IN-file     : Input netcdf file to be unfolded.
            -jatl jatl     : J index to start the unfold process in the Atlantic.
            -jpacif jpacif : J index to start the unfold process in the Pacific.
            -piv pivot     : type of pivot for the north fold condition ( T or F )
                  ORCA1, ORCA05 use F-pivot, ORCA2, ORCA025, ORCA12 use T-pivot.
            -p C-type : one of T|U|V|W|F , indicating the grid point where the
                  variables in the input file are located. If all variables in a
                  single file are not on the same C-grid location, there might be
                  a problem ...

          OPTIONS :
            [-o OUT-file] : Specify output file name instead of unfold.nc
            [-nc4 ]       : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : unfold.nc unless -o option is used.
              variables : same name and units than in the input file.

## cdfsmooth

      usage : cdfsmooth -f IN-file -c ncut [-t FLT-type] [-k LST-level] ...
            [-anis ratio ] [-nc4 ]

          PURPOSE :
            Perform a spatial smoothing on the file using a particular filter as
            specified in the '-t' option. Available filters are : Lanczos, Hanning,
            Shapiro and Box car average. Default is Lanczos filter.

          ARGUMENTS :
            -f  IN-file  : input data file. All variables will be filtered
            -c  ncut     : number of grid step to be filtered, or number
                         of iteration of the Shapiro filter.

          OPTIONS :
            [-t FLT-type] : Lanczos      , L, l  (default)
                            Hanning      , H, h
                            Shapiro      , S, s
                            Box          , B, b
            [-anis ratio ] : Specify an anisotropic ratio in case of Box-car filter.
                    With ratio=1, the box is a square 2.ncut x 2.ncut grid points.
                    In general, the box is then a rectangle 2.ncut*ratio x 2.ncut.
            [-k LST-level ] : levels to be filtered (default = all levels)
                    LST-level is a comma-separated list of levels. For example,
                    the syntax 1-3,6,9-12 will select 1 2 3 6 9 10 11 12
            [-nc4] : produce netcdf4 output file with chunking and deflation.

          OUTPUT :
            Output file name is build from input file name with indication
            of the filter type (1 letter) and of ncut.
            netcdf file :   IN-file[LHSB]ncut
              variables : same as input variables.

## cdfweight

      usage : cdfweight  -f IN-file [-c COORD-file] [-p C-type] [-2d] [-v]

          PURPOSE :
            Produces a weight file for further bilinear colocalisation with
            cdfcoloc program. It takes the position of the points to be
            colocated into a simple ascii file.

          ARGUMENTS :
            -f  IN-file   : input file is a iyxz ASCII file, 1 line per point.

          OPTIONS :
            [-c COORD-file] : coordinate file [coordinates.nc]
            [-p C-type    ] : point type on C-grid (either T U V or F ) [F]
            [-2d ]          : tell cdfweight that only 2D weights will be computed.
            [-v ]           : Verbose mode for extra information (debug mode).

          REQUIRED FILES :
             coordinates.nc file if not passed as argument.
             If working with 3D files, mesh_zgr.nc is required.

          OUTPUT :
            binary weight file : weight_point_type.bin
            standard output : almost the same info that is saved in the binary file
                        When using -v option, even more informations !

          SEE ALSO :
             cdfcoloc

# DERIVED FIELDS

## cdfcurl

      usage : cdfcurl -u U-file U-var -v V-file V-var -l LST-level [-T] [-8]...
                ... [-surf] [-overf] [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the curl of a vector field, at a specified level. If level is
            specified as 0, assume that the input files are forcing files, using
            an A-grid. In this latter case, the vector field is interpolated on the
            C-grid. In any case, curl is computed on  F-point (unless '-T' option
            is used).

          ARGUMENTS :
            -u U-file U-var : file and variable name for zonal component
            -v V-file V-var : file and variable name for meridional component
            -l LST-level : levels to be processed. If set to 0, assume forcing file
                  in input. Example of recognized syntax :
                    -l "1,10,30"  or -l "1-20" or even -l "1-3,10-20,30-"
                    -l  1 . Note that -l "3-" set a level list from 3 to the bottom.

          OPTIONS :
            [-T] : compute curl at T point instead of default F-point
            [-8] : save in double precision instead of standard simple precision.
            [-surf] : work with single level C-grid (not forcing)
            [-overf]: store the ratio curl/f where f is the coriolis parameter.
                   This option is not compatible with -T option.
            [-o OUT-file] : specify output file name instead of curl.nc
            [-nc4] : use netcdf4 output with chunking and deflation 1

          REQUIRED FILES :
             mesh_hgr.nc

          OUTPUT :
            netcdf file : curl.nc
              variables : socurl or socurlt (if -T option), units : s^-1
                 or socurloverf, no units (if -overf option)

## cdfdiv

      usage : cdfdiv -u U-file U-var -v V-file V-var -l LST-level [-8]...
               ... [-surf] [-overf] [-full] [-o OUT-file ] [-nc4]
               ... [-vvl T-file]

          PURPOSE :
            Compute the divergence of the flow from the U and V velocity components.
            Divergence is computed at T point on the C-grid.

          ARGUMENTS :
            -u U-file U-var : file and variable name for zonal component
            -v V-file V-var : file and variable name for meridional component
            -l LST-level : levels to be processed. If set to 0, assume forcing file.
                   in input. Example of recognized syntax :
                    -l "1,10,30"  or -l "1-20" or even -l "1-3,10-20,30-"
                    -l  1 . Note that -l "3-" set a level list from 3 to the bottom

          OPTIONS :
            [-8]: save in double precision instead of standard simple precision.
            [-surf] : work with single level C-grid (not forcing)
            [-overf]: store the ratio div/f where f is the coriolis parameter
            [-full] : in case of full step configuration. Default is partial step.
            [-o OUT-file] : specify output file name instead of div.nc
            [-nc4]  : Use netcdf4 output with chunking and deflation level 1.
                     This option is effective only if cdftools are compiled with
                     a netcdf library supporting chunking and deflation.
            [-vvl T-file] : use time-varying e3t, specify T-file for e3t.

          REQUIRED FILES :
             mesh_hgr.nc mesh_zgr.nc

          OUTPUT :
            netcdf file : div.nc unless -o option is used.
              variables : div units : s^-1
                    or divoverf, no units (if -overf option)

## cdfdynh_anom

      usage : cdfdynh_anom -f T-file [-limit lev1 lev2] [-vvl] [-o OUT-file] [-nc4]

          PURPOSE :
             Compute dynamic height anomaly from T-file given as argument.
             In this tool, the cumulated values (from top to bottom) are saved at
             each model level.
             If the -limit option is used, only the 2D integral of the dynamic
             height anomaly between lev1 and lev2 is saved.
             This program replace cdfhdy ( case using -limit option) and cdfhdy3d
             in the standard case.

          ARGUMENTS :
            -f T-file : netcdf file with temperature and salinity.

          OPTIONS :
            [-limit lev1 lev2] : if specified, the program will only output the
                   dynamic height anomaly at lev1 with reference at lev2.
            [-vvl] : use time-varying vertical metrics.
            [-o OUT-file] : Specify output file name instead of cdfhdy3d.nc
            [-nc4] : Use netcdf4 output with chunking and deflation level 1.
                     This option is effective only if cdftools are compiled with
                     a netcdf library supporting chunking and deflation.

          OPENMP SUPPORT : yes

          REQUIRED FILES :
             mask.nc and mesh_zgr.nc

          OUTPUT :
            netcdf file : cdfhdy3d.nc unless -o option is used.
              variables : vohdy ( m )
            If -limit option is used :
            netcdf file : cdfhdy2d.nc unless -o option is used.
              variables : sohdy ( m )

          SEE ALSO :
            replace old tools cdfhdy and cdfhdy3d.

## cdfeke

      usage : cdfeke -u U-file [-u2 U2-file]  -v V-file [-v2 V2-file] -t T-file ...
                 ... [-mke] [-o OUT-file] [-nc4]

          PURPOSE :
             Compute the Eddy Kinetic Energy from previously computed mean values
             and mean squared values of velocity components.

          ARGUMENTS : both 'General Use' or 'Reduced Use' are acceptable
           * General Use: 5 files are given in argument, and EKE is computed
            -u  U-file  : gridU type file with mean U component.
            -u2 U2-file : gridU2 type file with mean U2 component.
            -v  V-file  : gridV type file with mean V component.
            -v2 V2-file : gridV2 type file with mean V2 component.
            -t  T-file  : any gridT or gridT2 (smaller) file, used for EKE header.

           * Reduced Use: no U2/V2 file, only MKE is computed from U and V file.
            -u U-file  : gridU type file with mean U component.
            -v V-file  : gridV type file with mean V component.
            -t T-file  : any gridT or gridT2 (smaller) file, used for MKE header.

          OPTION :
            [-mke]  : output MKE field together with EKE.
            [-nc4]  : allow netcdf4 output with compression and chunking.
            [-o output file]: specify output file name instead of eke.nc

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : eke.nc unless -o option in use.
              variables : voeke (m2/s)
              variables : vomke (m2/s) if required

## cdfgeo-uv

      usage : cdfgeo-uv -f T-file [-o UOUT-file VOUT-file ] [-nc4] [-C option]

          PURPOSE :
              Compute the geostrophic velocity components from the gradient of the
              SSH read in the input file.

              Without any -C option, the zonal component is located on a C-grid
              V point, the meridional one is located on a C-grid U point. See the
              use of the -C option in order to have (Ugeo, Vgeo) at (U,V) points on
              the C-grid.

          ARGUMENTS :
           -f T-file : netcdf file with SSH (input).

          OPTIONS :
           [-o UOUT-file VOUT-file]: specify the names of the output files.
                   Default are: ugeo.nc vgeo.nc.
           [-nc4]: Use netcdf4 output with chunking and deflation level 1.
                   This option is effective only if cdftools are compiled with
                   a netcdf library supporting chunking and deflation.
           [-C option]: Using this option, the output velocity component are at the
                   correct (U,V) points on the C-grid. Two options are available :
                option = 1 : SSH is interpolated on the F point prior derivation.
                option = 2 : Ugeo and Vgeo are interpolated on the C-grid after
                   derivation.
                   Both options should give very similar results...

          REQUIRED FILES :
             mesh_hgr.nc and mesh_zgr.nc

          OUTPUT :
            - netcdf file : ugeo.nc (default)
                variables : vozocrtx
                Unless -C option is used :
                  *** CAUTION:  this variable is located on V-point ***
            - netcdf file : vgeo.nc (default)
                variables : vomecrty
                Unless -C option is used :
                  *** CAUTION:  this variable is located on U-point ***

## cdfgeostrophy

      usage : cdfgeostrophy -f T-file [-o OUT-ufile OUT-vfile] [-nc4] [-vvl]

          PURPOSE :
            Compute the geostrophic velocity components from the pressure gradient
            induced by SSH and in-situ density (T,S of input file), using the
            thermal wind equation.

          WARNING : USE AT YOUR OWN RISKS.

          ARGUMENTS :
            -f T-file : netcdf file with SSH, T and S.

          OPTIONS :
            [-o OUT-ufile OUT-vfile] : Specify output files name's  instead of
                 ugeo.nc and vgeo.nc
            [-nc4 ]:  Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.
            [-vvl] : use time varying vertical metrics.

          REQUIRED FILES :
             mask.nc mesh_hgr.nc and mesh_zgr.nc

          OUTPUT :
            - netcdf file : ugeo.nc
                variables : vozocrtx
            - netcdf file : vgeo.nc
                variables : vomecrty

## cdfgradT

      usage : cdfgradT -t T-file [-s S-file] [-o OUT-file] [-nc4] [-vvl W-file]

          PURPOSE :
           Compute horizontal and vertical gradient of temperature and salinity.
           Results are saved at U point for zonal gradient, V point for meridional
           gradient and W for vertical gradient.

          ARGUMENTS :
            -t T-file : File with votemper and vosaline variables
                If vosaline not in T-file consider the use of -s option.

          OPTIONS :
            [-s S-file  ] : File with vosaline variable if not in T file
            [-o OUT-file] : specify output file name, instead of gradT.nc
            [-nc4 ]       : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.
            [-vvl W-file ] : use time-varying vertical metrics. W-file is a file
                      where the time-varying vertical e3w metrics can be found.

          REQUIRED FILES :
            mesh_hgr.nc mask.nc and mesh_zgr.nc

          OUTPUT :
            netcdf file : gradT.nc
                         6  variables :
                   vozogradt, vomegradt, vovegradt : 3 component of the temperature
                               located respectively at U, V and W points
                   vozograds, vomegrads, vovegrads : 3 component of the salinity
                               located respectively at U, V and W points

          SEE ALSO :
           cdfhgradb

## cdfhgradb

      usage : cdfhgradb -t T-file [-s S-file] [-o OUT-file] [-nc4] ...
                        ...  [-sal SAL-name]  [-tem TEMP-name]

          PURPOSE :
            Compute the norm of the horizontal buoyancy gradient. Results are
            saved at T points.

          ARGUMENTS :
            -t T-file : File with votemper and vosaline variables
                If vosaline not in T-file use -s option.
               Note that salinity and/or temperature variables name can be changed
               with -sal and/or -tem options, respectively.

          OPTIONS :
             [-s S-file ]   : File with vosaline variable if not in T file.
             [-o OUT-file]  : specify the name of output file instead of
                        hgradb_gridT.nc
             [-nc4]         : use netcdf4 chunking and deflation on output.
             [-sal SAL-name]: specify the name of salinity variable.
             [-tem TEM-name]: specify the name of temperature variable.

          REQUIRED FILES :
            mesh_hgr.nc mask.nc and mesh_zgr.nc

          OPENMP SUPPORTED : yes

          OUTPUT :
            netcdf file : hgradb_gridT.nc ( unless specified with -o option)
                         1  variables :
                   vohgradb: norm of the horizontal buoyancy gradient at t-point

          SEE ALSO :
             cdfbuoyflx

## cdflap

      usage : cdflap -f IN-file -v IN-var -t IN-type [-overf2] [-nometric] ...
                    ...[-o OUT-file] [-nc4]

          PURPOSE :
            Compute the Laplacian of the variable IN-var in file IN-file. Assume
            that the data are on a C-grid model (as NEMO).

          ARGUMENTS :
            -f IN-file : netcdf file in input
            -v IN-var  : name of the variable to process
            -t IN-TYPE : Position of the variable on the C-grid [ T U V F ]

          OPTIONS :
            [-overf2] : save laplacien/f/f*g (where f is the local coriolis
                 parameter, and g is the accelaration due to gravity --9.81 m/s2-- )
                 For the SSH field, this is a proxy for geostrophic vorticity
            [-nometric] : compute laplacian without considering metrics
            [-o OUT-file] : specify output file name instead of lap.nc
                 This option must be used after the -overf2 or -nometric option, as
                 output file name is redefined when using these options.
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1..
                 This option is effective only if cdftools are compiled with
                 a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            mesh_hgr.nc mesh_zgr.nc and mask.nc

          OUTPUT :
            netcdf file : lap.nc
              variables : lap<var> (unit/m2)
            if option -overf2 is used, netcdf file is lapoverf2.nc and
            variable is lap<var>overf2

## cdfpvor

      usage : cdfpvor -t T-file  -u U-file -v V-file [-full] [-lspv] ...
                ... [-o OUT-file] [-nc4] [-vvl W-file]

          PURPOSE :
            Compute the Ertel potential vorticity and save the relative
            vorticity, the stretching and the total potential vorticity.
            Qtot = ( f + xsi ) . D(rho)/D(z)  = Qstrech + Qrel
            With -lspv option, compute only Qstretch or Large Scale P V

          ARGUMENTS :
            -t T-file : netcdf file for temperature and salinity.
            -u U-file : netcdf file for zonal component of the velocity.
            -v V-file : netcdf file for meridional component of the velocity.

          OPTIONS :
            [-full ] : indicate a full step configuration.
            [-lspv ] : calculate only the large scale potential vorticity.
                       ( replace the old cdflspv tool).
                       If used only T-file is required, no need for velocities.
            [-nc4 ] :  use netcdf4 with chunking and deflation
            [-o OUT-file] : use output file instead of default pvor.nc
            [-vvl W-file] : use time-varying vertical metrics. W-file holds the
                       time-varying e3w vertical metrics.

          REQUIRED FILES :
            mesh_hgr.nc and mesh_zgr.nc

          OUTPUT :
            netcdf file : pvor.nc
              variables : vorelvor (1.e-7 kg.m-4.s-1 ) relative vorticity
                          vostrvor (1.e-7 kg.m-4.s-1 ) stretching vorticity
                          vototvor (1.e-7 kg.m-4.s-1 ) total potential vorticity
                       Ertel PV are located at T points.

            With option -lspv :
            netcdf file : lspv.nc
              variables :  volspv  (1.e-7 kg.m-4.s-1 ) large scale potential
                   vorticity. LSPV is located at W points.

          SEE ALSO :
            cdfcurl ( compute only the curl on 1 level)

## cdfrhoproj

      usage : cdfrhoproj-v IN-var -s RHO-file -l LST-files [-p C-type] [-debug]...
            ... [-isodep] [-s0 sig0 | -s0 sigmin,sigstp,nsig] [-sig sigma_name]..
            ... [-noiso] [-rholev TXT-file] [-o OUT-isodep] [-nc4]

          PURPOSE :
            This program aims at projecting the model variable IN-var, from a list
            of model files (LST-files) on some isopycnic surfaces, inferred from
            a 3D density file, passed as one the arguments of the program.

            The density values corresponding to the isopycnic surfaces can be
            specified in three ways :
               1. Using a predefined text file rho_lev with density
                  values. The format is straightforward: one value per line, first
                  line giving the number of isopycnic to consider. (The default
                  name of this text file can be changed using -rholev option).
               2. Using the -s0 option, with 3 parameters, defining equally spaced
                  isopycnic surfaces.
               3. Using the -s0 option with only one parameter, defining then a
                  single surface.

          WARNING: This cdftool is one of the few using 3D arrays. Additional
              development is required to work with vertical slabs instead.

          ARGUMENTS :
            -v IN-var   : name of the input variable to be projected
            -s RHO-file : netcdf file with potential density field. If not a sigma0
                  file, use -sig option to indicate the name of the density
                  variable.
            -l LST-files: List of netcdf file with variable IN-var to process.

          OPTIONS :
            [-s0 sigma  | -s0 sigmin,sigstp,nsig] : In the first form define a
                 single sigma surface, while in the 2nd form, it defines a set of
                 'nsig' density values, starting from 'sigmin' and spaced every
                 'sigstp'. This option prevails the use of rho_lev file.
            [-rholev TXT-file] : Specify the name of the 'rholev' text file,
                 instead of rho_lev.
            [-p C-type] : position of IN-var on the C-grid ( either T U V F W S ),
                 default is 'T'. 'S' special point is used in case of section
                 files created by cdf_xtract_brokenline.
            [-sig sigma_name] : name of the density variable in RHO_file. Default is
                vosigma0.
            [-isodep ] : Only computes the isopycnic depth, then stops.
            [-noiso]   : Does not save isopycnic depth (suitable for big files).
            [-debug]   : Produces extra prints.
            [-o OUT-isodep]: specify the name of isodep file (-isodep option),
                instead of isopycdep.nc.
            [ -nc4 ]   : Use netcdf4 output with chunking and deflation level 1..
                 This option is effective only if cdftools are compiled with
                 a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            If not using -s0 option rho_levis required, unless
            the default name is changed by -rholev option.

          OPENMP SUPPORT : yes

          OUTPUT :
            There are as many output files than input files, with '.interp'
            suffix added to the original name.
            netcdf files : <IN-file>.interp
              variables : VAR-in (unit is the same as input var)
                          vodepiso (m) : depth of isopycnic.

            If option -isodep is used, only isopycnic depth is output on
            netcdf file : isopycdep.nc (unless -o option is used).
              variables : vodepiso (m)

          SEE ALSO :
            cdfmocsig

## cdfrichardson

      usage : cdfrichardson  -t gridT -u gridU -v gridV [-W] [-full] ...
               ... [-o OUT-file] [-nc4] [-vvl W-file]

          PURPOSE :
            Compute the Richardson Number (Ri) according to temperature,
            salinity and velocity components, given in the input files.

            Richardson's number is the ratio N2/(Vertical Shear)^2, N being
            the Brunt-Vaissala frequency.

          ARGUMENTS :
            -t gridT : input gridT file for temperature and salinity
            -u gridU : input gridU file for zonal velocity component
            -v gridV : input gridV file for meridional velocity component

          OPTIONS :
            [-W ] : keep N2 at W points. Default is to interpolate N2 at T points
                  on the vertical
            [-full ] : indicate a full step configuration instead of the default
                  partial steps.
            [-o OUT-file ]: specify output file instead of richardson.nc
            [-nc4 ]  : Use netcdf4 output with chunking and deflation level 1.
                  This option is effective only if cdftools are compiled with
                  a netcdf library supporting chunking and deflation.
            [-vvl W-file ]: use time-varying vertical metrics. W-file holds the
                  time-varying e3w vertical metrics.

          REQUIRED FILES :
            mesh_zgr.nc is needed for this program.

          OUTPUT :
            netcdf file : richardson.nc unless option -o is used.
            variables : voric

## cdfspeed

      usage : cdfspeed  -u U-file U-var -v V-file V-var [-t T-file] ...
                 ... [-o OUT-file] [-nc4] [-lev LST-level] [-C]

         PURPOSE :
            Compute the speed of ocean currents or wind speed.

            If the input files are 3D, the input is assumed to be a model
            output on native C-grid. Speed is computed on the A-grid.

            If the input file is 2D then we assume that this is a forcing
            file already on the A-grid, unless -C option is used.

         ARGUMENTS :
            -u U-file U-var : netcdf file for U component and variable name.
            -v V-file V-var : netcdf file for V componentt and variable name.

         OPTIONS :
            [-t T-file] : indicate any file on gridT for correct header of the
                  output file (needed for 3D files or if -C option is used).
            [-lev LST-level] : indicate a list of levels to be processed.
                  If not used, all levels are processed.
            [-C] : indicates that data are on a C-grid even if input files are 2D.
            [-o OUT-file] : use specified output file instead of speed.nc
            [-nc4] : use netcdf4 output with chunking and deflation.

         OUTPUT :
            Output on speed.nc unless -o option is used.
              netcdf variable : U

         SEE ALSO :
            cdfvita also computes the speed.

## cdfvita

      usage : cdfvita -u U-file -v V-file -t T-file [-w W-file] [-geo] [-cubic]
                    ... [-o OUT-file] [-nc4] [-lev LST-level]

          PURPOSE :
            Creates a file with velocity components, module  and direction
            at T points from file on C-grid. T-file is used only for
            getting the header of the output file. Any file on T grid
            can be used.

          ARGUMENTS :
            -u U-file  : netcdf file with zonal component of velocity
            -v V-file  : netcdf file with meridional component of velocity
            -t T-file  : netcdf file with T points header OK.

          OPTIONS :
            [-w W-file ]: if used, also compute vertical velocities at T points.
            [-geo ]     : indicate that input velocity files are produced by
                   cdfgeo-uv, hence ugeo on V-point, vgeo on U-points.
            [-cubic ]   : Save the cube of the velocity module.
            [-nc4 ]     : Use netcdf4 output with chunking and deflation level 1.
                   This option is effective only if cdftools are compiled with
                   a netcdf library supporting chunking and deflation.
            [-o OUT-file ] : Specify name of output file instead of vita.nc
            [-lev LST-level] : specify a blank-separated list of levels to be used.
                   (default option is to use all input levels).

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : vita.nc unless -o option is used
              variables : sovitua, sovitva, sovitmod, sovitdir, [sovitmod3] and
                          [sovitwa]. Note that the direction is relative to the
                          model grid.

          SEE ALSO :
             cdfspeed only computes the speed (velocity module).

## cdfw

      usage : cdfw -u U-file -v V-file [-var U-var V-var] [-full] [-o OUT-file] ...
                   ... [-nc4] [-vvl T-file ]

          PURPOSE :
            Compute the vertical velocity from the vertical integration of
            of the horizontal divergence of the velocity.

          ARGUMENTS :
            -u U-file : netcdf file with the zonal velocity component.
            -v V-file : netcdf file with the meridional velocity component.

          OPTIONS :
            [-var U-var V-var] : names of the zonal and meridional velocity
                   components. Default are vozocrtx and vomecrty
            [ -full ] : in case of full step configuration. Default is partial step.
            [ -o OUT-file] : specify the output file name instead of w.nc
            [ -nc4 ]  : Use netcdf4 output with chunking and deflation level 1.
                   This option is effective only if cdftools are compiled with
                   a netcdf library supporting chunking and deflation.
            [ -vvl T-file ] : Use time varying vertical metrics (e3t), provided
                   in T-file.

          REQUIRED FILES :
            mesh_hgr.nc and mesh_zgr.nc

          OUTPUT :
            netcdf file : w.nc unless -o option is used.
              variables : vovecrtz (m/s)

## cdfzisot

      usage : cdfzisot -t T-file -iso ISO-temp [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the depth of an isotherm surface from the temperature file
            and value of the isotherm given on the command line.

          ARGUMENTS :
            -t T-file  : input netcdf file with the ocean temperature.
            -iso ISO-temp : Indicates the temperature (Celsius) of the chosen
                 isotherm.

          OPTIONS :
             [-o OUT-file] : specify the output file name instead of zisot.nc
             [-nc4]  : Use netcdf4 output with chunking and deflation level 1.
                  This option is effective only if cdftools are compiled with
                  a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
             mesh_zgr.nc
              In case of FULL STEP configuration, bathy_level.nc is also required.

          OUTPUT :
            netcdf file : zisot.nc unless option -o is used.

# ENERGY DIAGNOSTICS

## cdfeddyscale

      usage : cdfeddyscale -f PASS1-meanfile [-o OUT-file] [-nc4]

          PURPOSE :
             This program computes 3 quantities relative to the eddy scales,
             from a file preprocessed by cdfeddyscale_pass1 :
                   -the Taylor scale or large scale eddy (lambda1)
                   -the small scale eddy (lambda2)
                   -and the inertial range (scar) on F-points

                lambda1 = sqrt(mean Kinetic Energie / Enstrophy)
                lambda2 = sqrt(Enstrophy / Palinstrophy)
                Inertial Range    = lambda1 / lambda2

                Enstrophy = 1/2 * ( mean((RV)^2) )
                Palenstrophy = 1/2 * ( mean((dx(RV))^2 + (dy(RV))^2) )

          ARGUMENTS :
            -f  PASS1-meanfile : time average of cdfeddyscale_pass1 preprocessed
                files.

          OPTIONS :
            [-o OUT-file ]: specify the output file name instead of lambda.nc
            [-nc4 ]  : Use netcdf4 output with chunking and deflation level 1.
                   This option is effective only if cdftools are compiled with
                   a netcdf library supporting chunking and deflation.

          OUTPUT :
            netcdf file : lambda.nc unless -o option is used.
              variables : solambda1 (m), solambda2 (m), soscar

          SEE ALSO :
            cdfeddyscale_pass1

## cdfeddyscale_pass1

      usage : cdfeddyscale_pass1 -u U-file U-var -v -V-file V-var -l lev ...
                    ... [-o OUT-file] [-nc4]

          PURPOSE :
             This program computes some elements whose temporal mean is required
             in the determination of the eddyscales (cf cdfeddyscale). These
             elements are :
                   - the curl and the square of curl on F-points,
                   - the gradient components of the curl and the
                     square of the gradient components on UV-points,
                   - the square of velocity components on UV-points,

             They are computed for the set of U/V files given in arguments.
             Therefore, for a particular experiment, the resulting files obtained
             for a series of time-frames, need to be time-averaged (cdfmoy), before
             using the final cdfeddyscale program, for the computation of the eddy
             scales : Taylor scale (Large scale eddy --lambda1--), and small scale
             eddy (lambda2).

          ARGUMENTS :
            -u U-file U-var: zonal component of the vector field:
                      filename and variable name
            -v V-file V-var: meridional component of the vector field:
                      filename and variable name
            -l lev : level to be processed.

          OPTIONS :
            [-o OUT-file] : specify output file instead of lambda_int.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
             mesh_hgr.nc

          OUTPUT :
            netcdf file : lambda_int.nc
              variables : socurl (s^-1), socurl2 (s^-2)
              variables : sodxcurl, sodycurl (s^-1.m^-1)
              variables : sodxcurl2, sodycurl2 (s^-2.m^-2)
              variables : vozocrtx2, vomecrty2 (m^2.s^-2)
              WARNING : variables in the output file are not located at the same
                      C-grid point.

          SEE ALSO :
             cdfmoy, cdfeddyscale

## cdfets

      usage : cdfets -f T-file [-o OUT-file] [-nc4] [-vvl W-file]

          PURPOSE :
            Compute the eddy time scale, and a proxy for rossby radius. The Rossby
            radius is computed as the vertical integral of N2 (Brunt Vaissala
            frequency), scaled by |f|*pi.
            The Eddy Time Scale is the ratio N/|grad B| where N is the square root
            of N2 and |grad B| is the module of the horizontal buoyancy gradient.
            B is the buoyancy computed as B=-g rho/rho0.

          ARGUMENTS :
            -f T-file : netcdf input file for temperature and salinity (gridT).

          OPTIONS :
            [-o OUT-file] : specifiy the name of output file instead of ets.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.
            [-vvl W-file] : use time varying vertical metrics. W-file holds the
                      time-varying e3w vertical metrics.

          REQUIRED FILES :
             mesh_hgr.nc, mesh_zgr.nc

          OUTPUT :
            netcdf file : ets.nc unless -o option is used.
              variables : voets (days)  and sorosrad (m)

## cdfnrj_bci

      usage : cdfnrj_bci -f UVWT-file [-o OUT-file] [-nc4]

          PURPOSE :
            Compute elements (see variable list below) for analysing the baroclinic
            instability.
            Note : this program was formerly named cdfbci.

          ARGUMENTS :
            -f UVWT-file : input file is produced by cdfuvwt, and the mean
                   must be computed on a long-enough period for the statistics
                   to be meaningful. Points are on T grid.

          OPTIONS :
            [-o OUT-file] : specify output file name instead of bci.nc
            [-nc4 ]   : Use netcdf4 output with chunking and deflation level 1.
                   This option is effective only if cdftools are compiled with
                   a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            Need mesh_hgr.nc file

          OUTPUT :
            netcdf file : bci.nc
              variables : 5 output variables
                  dTdx : zonal derivative of Tbar on T point (*1000)
                  dTdy : meridional derivative of Tbar on T point (*1000)
                  uT   : anomaly of u times anomaly of T on T point
                  vT   : anomaly of v times anomaly of T on T point
                  bci  : transfert of energy for the baroclinic instability (*1000)

          SEE ALSO :
            cdfuvwt, cdfnrj_bti, cdfnrj_components, cdfnrj_transfert

## cdfnrj_bti

      usage : cdfnrj_bti -f UVWT-file [-o OUT-file] [-nc4]

          PURPOSE :
            Compute  the terms in the barotropic energy tranfert equation.
            The transfert of energy for the barotropic instability is
            bti= -[(u'bar)^2*dubar/dx ...
                  +(v'bar)^2*dvbar/dy ...
                  +(u'v'*(dubar/dy +dvbar/dx))]
            Note : This program was formerly named cdfbti.

          ARGUMENTS :
            -f UVWT-file : netcdf file produced by cdfuvwt

          OPTIONS :
            [-o OUT-file] : specify the output file name instead of bti.nc
            [-nc4 ]  : Use netcdf4 output with chunking and deflation level 1.
                  This option is effective only if cdftools are compiled with
                  a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            mesh_hgr.nc

          OUTPUT :
            netcdf file : bti.nc
              variables :
                   dudx : zonal derivate of ubar on T point
                   dvdx : zonal derivate of vbar on T point
                   dudy : meridional derivate of ubar on T point
                   dvdy : meridional derivate of vbar on T point
                   anousqrt : mean of (u-ubar)^2 on T point
                   anovsqrt : mean of (v-vbar)^2 on T point
                   anouv : mean of (u-ubar)*(v-vbar) on T point
                   bti  : transfert of energy for the barotropic instability.

          SEE ALSO :
           cdfuvwt, cdfnrj_bci, cdfnrj_components, cdfnrj_transfert

## cdfnrj_components

      usage : cdfnrj_components -f UVWT-file [-o OUT-file] [-nc4]

          PURPOSE :
            Compute contributing terms of the energy equation at T-points.
            Input file contains mean values processed by cdfuvwt.
            The means must have been computed on long enough period for the
            statistics to be meaningful.
            Note : this program was formerly named cdfnrjcomp. It needs some
            additional cleaning and revision. Use with care!

          ARGUMENTS :
            -f UVWT-file: netcdf file produced by cdfuvwt.

          OPTIONS :
            [-o OUT-file]: specify output file name instead of nrjcomp.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                  This option is effective only if cdftools are compiled with
                  a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : nrjcomp.nc
              all variables are located at T point.
              variables : tbar : mean temperature
                          ubar : mean zonal velocity
                          vbar : mean meridional velocity
                          anotsqrt : mean squared temperature anomaly
                          anousqrt : mean squared zonal velocity anomaly
                          anovsqrt : mean squared meridional velocity anomaly

          SEE ALSO :
            cdfuvwt, cdfnrj_bti, cdfnrj_bci, cdfnrj_transfert but also
            cdfeke, cdfmoy, cdfstdevt etc...

## cdfnrj_transfert

      usage :  cdfnrj_transfert -f UVWT-file [-o OUT-file] [-nc4]

          PURPOSE :
            This program computes the energy transfert term from previously
            computed high order moments (cdfuvwt). High order moments must
            have been evaluated on a long enough period, in order to get
            meaningfull statistics.
            Note : this program was formerly named cdfkempemekeepe. (no idea of the
            pronunciation :) ).

          ARGUMENTS :
            -f UVWT-file : Input file is the output of cdfuvwt, holding the required
                  high order moments.

          OPTIONS :
            [-o OUT-file] : Specify the output file name instead of trf_t1t3.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                  This option is effective only if cdftools are compiled with
                  a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : trf_t1t3.nc unless option -o is used.
              variables : WT    : temporal mean of Wbar x Tbar at T point.
                          anoWT : temporal mean of W'xT' at T points.
                  units : 1000 x Celsius x m/s
          SEE ALSO :
           cdfuvwt, cdfnrj_bci, cdfnrj_bti, cdfnrj_components

## cdfokubow

      usage : cdfokubow -u U-file U-var -v V-file V-var [-l lev] ...
                         ... [-o OUT-file] [-nc4]

          PURPOSE :
            Compute Okubo-Weiss parameter of a vector field at all level or at
            specified level (-l option).
            This parameter represents the balance between strain and vorticity.
            W = Sn^2 +Ss^2 - curl(V)^2. Sn and Ss are the non-symetrical and
            symetrical components of the strain, respectively.

          ARGUMENTS :
            -u U-file U-var: zonal component of the vector field:
                      filename and variable name
            -v V-file V-var: meridional component of the vector field:
                      filename and variable name

          OPTIONS :
            [-l lev]: level to be processed. Process all level by default.
            [-o OUT-file] : specify output file instead of okubow.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                 This option is effective only if cdftools are compiled with
                 a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
             mesh_hgr.nc and mask.nc

          OUTPUT :
            netcdf file : okubow.nc
              variables : sokubow (s^-2)

# ENSEMBLE PROCESSING

## cdfenstat

      usage : cdfenstat -l LST-mbr-files [-spval0] [-v4d] [-o OUT-file] [-nc4]

          PURPOSE :
            Compute an ensemble mean and standard deviation for a set of files
            corresponding to different members from an ensemble run.
            This program assumes that each of the member files have the same
            variables, and the same number of time frames.
            This program uses optimal algorithm for computing the mean and std dev,
            in order to reduce truncation errors.

          ARGUMENTS :
            -l LST-mbr-files : A list of members  model output files.

          OPTIONS :
            [ -spval0 ] :  set missing_value attribute to 0 for all output
                    variables and take care of the input missing_value.
                    This option is usefull if missing_values differ from files
                    to files; it was formely done by cdfmoy_chsp).
            [ -v4d ] : uses 4D arrays for improved performance (use more memory !)
            [ -o OUT-file ] : specify a name for output file instead of cdfmoy.nc
            [ -nc4 ] : output file will be in netcdf4, with chunking and deflation

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : cdfmoy.ncunless -o option in use
            variables : are the same than in the input files. Standard Dev are
             named  stdev_<variable>

# FILE INFORMATIONS

## cdfcensus

      usage :  cdfcensus -t T-file [-log nlog] [-zoom imin imax jmin jmax] ...
                   ... [-klim kmin kmax] [-srange smin smax ds] ...
                   ... [-trange tmin tmax dt] [-full] [-vvl] [-o OUT-file] [-nc4]

          PURPOSE :
             Compute the volumetric water mass census: the ocean is divided in
             T,S bins; the program gives the volume of water for each bin.
             A sub-area can be specified, both horizontaly and vertically.
             Temperature and salinity ranges can be also adapted, as well as the
             width of the bins. Default values are provided. In order to attenuate
             the huge maximum values, a log10 operator can be applied many times,
             the number of filter passes being set on the command line.

          ARGUMENTS :
            -t T-file  : netcdf file name for temperature and salinity

          OPTIONS :
            [-log nlog] : number of log10 filter to perform. 0 by default.
            [-zoom imin imax jmin jmax] : define a model sub-area, in model
                   coordinates
            [-klim kmin kmax] : set limits on the vertical.
            [-srange smin smax ds ] : define the size of the salinity bin
                             defaut is : 25.0 40.0  0.020
            [-trange tmin tmax dt ] : define the size of the temperatude bin
                             defaut is : -2.0 38.0  0.050
            [-full ] : use for full step computation
            [-vvl ]  : use time-varying vertical metrics.
            [-o OUT-file] : specify output file name instead of census.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                 This option is effective only if cdftools are compiled with
                 a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            mesh_hgr.nc  and mesh_zgr.nc

          OUTPUT :
            - netcdf file : census.nc
                variables : volcensus  (10^15 m3 )
                            sigma0  (kg/m3 -1000 )
                            sigma2  (kg/m3 -1000 )
                            sigma3  (kg/m3 -1000 )

## cdffindij

      usage :   cdffindij  -w xmin xmax ymin ymax  [-c COOR-file] [-p C-type]...
                      ... [-f LST-file] [-d descriptor] [-o OUT-file] [-A] [-l]

          PURPOSE :
            Return the model limit (i,j space) of the geographical window given on
            the input line. If using -f list_file option, then the output is just
            a single point, not a window, and there are no need to define the
            window with -w.

          ARGUMENTS :
            -w xmin xmax ymin ymax : geographical limits of the window, in lon/lat
            (relevant only if -f option not used.)

          OPTIONS :
            [-c COOR-file ] : specify a particular coordinate file
                          default is coordinates.nc
            [-p C-type] : specify the point on the C-grid (T U V F). Default is F.
            [-f LST-file ] : LST-file is an ascii file describing the location
                     (one per line) of geographical points to be translated to
                     model (i,j) point. Unless specified with -d option, this list
                     file contains Longitude (X) Latitudes (Y) information.
            [-d descriptor] : descriptor is a string indicating the position of
                     X and Y coordinates for the lines of list_file. Default value
                     of the descriptor is 'XY'. Any other field on the line is
                     indicated with any characterm except X or Y. Example of valid
                     descriptor : 'oXYooo' or 'ooYabcdfXooo'
            [-A  ] : With this option, output is similar to input with I,J appended
                     to the corresponding line.
            [-l  ] : With this option, also output the exact model longitude and
                     latitude of the I,J point.
            [-o OUT-file]: write output in text OUT-file instead of standard output.

          REQUIRED FILES :
            coordinates.nc or the specified coordinates file.

          OUTPUT :
            Output is done on standard output.

          SEE ALSO :
            cdfwhereij

## cdfinfo

      usage : cdfinfo -f MODEL-file [-dep dep]

          PURPOSE :
             Gives very basic information about the file given in arguments.

          ARGUMENTS :
             model output file in netcdf.

          OPTIONS :
             [-dep depth ] : return the nearest k index corresponding to depth

          OUTPUT :
             On standard ouput, gives the size of the domain, the depth
             dimension name, the number of variables.

## cdfmax

      usage : cdfmax -f IN-file -v IN-var [-lev kmin kmax ] ...
           ... [-zoom imin imax jmin jmax] [-time tmin tmax ] ...
           ... [-fact multfact] [-xy ]

          PURPOSE :
             Find minimum and maximum of a file as well as their respective
             location. Options allow to restrict the finding to a sub area in time
             time and space. This program also deal with vertical slabs in a domain.

          ARGUMENTS :
            -f IN-file : input file
            -v IN-var  : input variable

          OPTIONS :
            [-lev kmin kmax ] : restrict to level between kmin and kmax.
            [-zoom imin imax jmin jmax] : restrict to sub area specified by the
                       given limits. If the zoomed area is degenerated to a single
                       line, then the vertical slab is considered as the domain.
            [-time tmin tmax ] : restrict to the indicated time windows.
            [-fact multfact] : use a multiplicative factor for the output
            [-xy ] : force horizontal slab even in the case of a degenerated
                            zoomed area.

          REQUIRED FILES :
            none

          OUTPUT :
            output is done on standard output.

## cdfmsk

      usage : cdfmsk MSK-file

          PURPOSE :
            Compute the number of ocean points, land points and displaysome
            statistics: number and percentage of land points, number and
            percentage of sea points.

          ARGUMENTS :
            MSK-file : input mask file (which contains tmask).

          REQUIRED FILES :
             none apart the mask file passed as argument.

          OUTPUT :
            Standard output

## cdfnamelist

      usage :  cdfnamelist [-i] [-p]

          PURPOSE :
            Give information [-i option] on the namelist mechanism implemented
            since CDFTOOLS v3. Write a namelist template [-p option] to initialize
            the mechanism.

            Note also than since CDFTOOLS v4, the name of the mesh/mask files as
            well as the name of the coordinates file can be modified from the
            default, setting corresponding environment variable :
                CDFT_MESH_HGR   to change the default mesh_hgr.nc
                CDFT_MESH_ZGR   to change the default mesh_zgr.nc
                CDFT_MASK       to change the default mask.nc
                CDFT_BASINS     to change the default new_maskglo.nc
                CDFT_COORD      to change the default coordinates.nc

          ARGUMENTS :
            none

          OPTIONS :
            [ -i ] : print informations
            [ -p ] : write a template namelist.

          REQUIRED FILES :
            none

          OUTPUT :
            with option -p, print a template namelist : PrintCdfNames.namlist

## cdfprobe

      usage :  cdfprobe -f IN-file -v IN-var -i ilook -j jlook [-k klook]

          PURPOSE :
           Displays a series of pair of values (time, value) corresponding to the
           IN-var variable in IN-file, at location (ilook, jlook,[klook]). The
           standard output can be piped to a graphical tool such as 'graph' to
           easily plot the time evolution of IN-var.

          ARGUMENTS :
            -f IN-file : input file to look for
            -i ilook   : i position of the probe.
            -j jlook   : j position of the probe.
            -v IN-var  : name of the cdf variabled to be displayed

          OPTIONS :
            [-k klook] : Use the probe at level klook, instead of the first level.

          REQUIRED FILES :
            none

          OUTPUT :
            2 columns ( time , value ) ASCII output on display
            time are given in days since the begining of the run.

## cdfprofile

      usage : cdfprofile  -f IN-file -v IN-var -IJ I J [-dep depth ] [-o OUT-file]

          PURPOSE :
            Extracts a vertical profile at location I J, for the IN-var variable of
            the IN-file. A depth can optionally be specified.

          ARGUMENTS :
           -f  IN-file : input file to work with.
           -v  IN-var  : variable name whose profile is requested.
           -IJ I J     : I, J position of the point to extract from file.

          OPTIONS :
            [-dep depth] : specify a depth where vertical value will be
                          interpolated.
            [-o OUT-file]: specify output file name instead of profile.nc

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : profile.nc unless -o option is used.
               variable : name given as argument.
            Profile is also written on standard output.

## cdfwhereij

      usage : cdfwhereij  -w imin imax jmin jmax [-c COOR-file] [-p C-type]

          PURPOSE :
            Return the geographical coordinates of a model sub-area specified
            by a rectangular window in (i,j) space.

          ARGUMENTS :
            -w imin imax jmin jmax : (i,j) space window coordinates.

          OPTIONS :
            [-c COOR_file ] : specify a coordinates file instead of coordinates.nc
            [-p C-type ] : specify a point type on the C-grid (T U V F),
                    default is T.

          REQUIRED FILES :
            coordinates.nc or COOR-file given in the -c option

          OUTPUT :
            Standard output

          SEE ALSO :
           cdffindij

## cdfzonalout

      usage :  cdfzonalout -f ZONAL-file

          PURPOSE :
             This is a formatting program for zonal files, either mean or integral.
             It displays results on the standard output from the input zonal file.
             It only works with 1D zonal variables, skipping 2D variables, that
             cannot be easily displayed !

          ARGUMENTS :
             -f ZONAL-file : input netcdf zonal file produced by one of the zonal
                          tools.

          REQUIRED FILES :
             none

          OUTPUT :
             - Standard output,  structured in columns:
                  J  LAT  ( zonal mean, var = 1--> nvar)

          SEE ALSO :
              cdfzonalmean, cdfzonalmeanvT, cdfzonalsum

## cdfzoom

      usage : cdfzoom -f IN-file -zoom imin imax jmin jmax -v IN-var ...
                    ... [-lev kmin kmax ] [-time tmin tmax ] [-fact factor]

          PURPOSE :
           Displays the numerical values of a zoomed area. By default, all times
           and levels are shown. If the zoomed area is degenerated to a single
           line, then the vertical slab is displayed.

          ARGUMENTS :
            -f IN-file : name of input file
            -zoom imin imax jmin jmax : spatial window definition
            -v IN-var : cdf variable name to work with.

          OPTIONS :
            [-lev kmin kmax ]  : vertical limits for display.
            [-time tmin tmax ] : time limits for display.
            [-fact factor ]    : use a scaling factor for display.
                                 Values are DIVIDED by factor

          REQUIRED FILES :
             none

          OUTPUT :
            display on standard output

# FILE OPERATIONS

## cdfchgrid

      usage : cdfchgrid -f IN-file -r REF-file -var IN-var [-o OUT-file] [-nc4] [-d]

          PURPOSE :
            Builds a new file on a refined grid, from a coarser grid, assuming that
            the two grids are embedded, with common points (hence an odd scaling
            factor). Grid characteristics are hard wired in the code. Support for
            ORCA025 --> ORCA12, eORCA025 --> eORCA12 is actually provided. Hooks
            are ready in the code for adding new conversion.
            No interpolation, only copying value of a coarse grid cell, onto
            scale x scale cells of the output grid (scale is the refinement factor)

          RESTRICTION :
            Caution for mask coherence !
            This tool is only adapted for drowned fields.

          ARGUMENTS :
            -f IN-file  : input Coarser-grid file
            -r REF-file : Reference file used for identification of the output grid
                    should be of same geometry than the output file.
            -var IN-var : input coarser-grid variable to be converted

          OPTIONS :
            [-o OUT-file] : specify output file name instead of cdfchgrid.nc
            [-nc4 ]       : use netcdf4 chunking and deflation for the output file
            [-d ]         : Display some debugging information

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : cdfchgrid.nc
              variable : same name as in input file

          SEE ALSO :
            cdf2regular cdfdegrad

## cdfclip

      usage : cdfclip -f IN-file  -zoom imin imax jmin jmax ...
                 ...[-klim kmin kmax] [-o OUT-file] [-nc4]

          PURPOSE :
            Clips the input file according to the indices given in the zoom option.
            If no vertical zoomed area is indicated, the whole water column is
            considered.

            This program is able to extract data for a region crossing the E-W
            periodic boundary of a global configuration. It does so if imax < imin.

          ARGUMENTS :
            -f IN-file : specify the input file to be clipped
            -zoom imin imax jmin jmax : specify the domain to be extracted.
                  If imin=imax, or jmin = jmax assume a vertical section either
                  meridional or zonal.

          OPTIONS :
            [-o OUT-file ] : use OUT-file instead of cdfclip.nc for output file
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                  This option is effective only if cdftools are compiled with
                  a netcdf library supporting chunking and deflation.
            [-klim kmin kmax ] : specify vertical limits for the zoom, in order to
                  reduce the extracted area to some levels. Default is to take the
                  while water column.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : cdfclip.nc This can be changed using -o option
              variables : same as input variables.

## cdfcmp

      usage : cdfcmp -f1 IN-file1 -f2 IN-file2 -v IN-var ...
          ... [-lev kmin kmax ] [-zoom imin imax jmin jmax] ...

          PURPOSE :
             Find where IN-var is different between IN-file1 and IN-file2
             Options allow to restrict the finding to a sub area in space

          ARGUMENTS :
            -f1 IN-file1 : input file1
            -f2 IN-file2 : input file2
            -v  IN-var   : input variable

          OPTIONS :
            [-lev kmin kmax ] : restrict to level between kmin and kmax.
            [-zoom imin imax jmin jmax] : restrict to sub area specified
                                          by the given limits.

          REQUIRED FILES :
            none

          OUTPUT :
            output is done on standard output.

## cdfconvert

      usage : cdfconvert -t CLIPPER_tag -c CLIPPER_Confcase

          PURPOSE :
            Convert dimg files (CLIPPER like) to netcdf (DRAKKAR like).
            With recent version of NEMO and XIOS this program is likely to become
            obsolete soon. It is maintained for historical reasons.

          ARGUMENTS :
            CLIPPER_tag      : a string such as y2000m01d15 for time identification.
            CLIPPER_confcase : CONFIG-CASE of the files to be converted (eg ATL6-V6)

          REQUIRED FILES :
             mesh_hgr.nc and mesh_zgr.nc

          OUTPUT :
            netcdf file : gridT, gridU, gridV files
              variables : same as in standard NEMO output

          SEE ALSO :

## cdfcsp

      usage : cdfcsp -l LST-files [-v value]

          PURPOSE :
            Replace missing_values by 0 and update attribute.
            This program is not working properly with NETCDF4/HDF5 files!
            Even more : problem when **compiled**  with NETCDF4.

          CAUTION :
           ################################
           # INPUT FILES ARE OVER-WRITTEN #
           ################################

          ARGUMENTS :
            -l LST-files : The list of cdf file to process, all variables will
                   be processed.

          OPTIONS :
            [-v value] : use value instead of 0 as the new missing_value

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : same as input file (modified)
              variables : same as input file

## cdfdegrad

      usage : cdfdegrad -f IN-file -v IN-var -r ri rj -p C-type  [-start i0 j0]
            ... [-full] [-vvl] [-o OUT-file]

          PURPOSE :
            Degrad the horizontal resolution of a NEMO ouput file,
            for each z-level and time step, with a ratio of ri along
            x direction and rj along y direction. If specified, the input
            grid is considered starting from the indices i0 and j0.

          ARGUMENTS :
            -f IN-file : netcdf input file on grid point corresponding to -p option.
            -v IN-var  : name of netcdf variable to work with
            -r ri rj   : degradation ratio for x-direction and y-direction.
            -p C-type : position of variable on C-grid, one of T|U|V|W.

          OPTIONS :
            [-start i0 j0] : spatial indices from where the procedure of
                             degradation starts.
            [-o OUT-file ]:  output filename instead of 'degraded_<IN-var>.nc'
            [-vvl ] : use time-varying vertical metrics.
            [-full] : flag for full steps grid, instead of default partial
                      steps.

          REQUIRED FILES :
            Files mesh_hgr.nc, mesh_zgr.nc, mask.nc

          OUTPUT :
            netcdf file : degraded_<IN-var>.nc unless -o option is used
               variables : degraded_<IN-VAR>
                           flsdc : fluid subdomain counter

## cdfdifmask

      usage : cdfdifmask -m  mask1 mask2 [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the difference between 2 NEMO mask files.
            This difference is not easy to perform with nco.

          ARGUMENTS :
            -m mask1 mask2 : model mask files to be compared.

          OPTIONS :
            [-o OUT-file ]: specify output file name instead of mask_diff.nc
            [-nc4 ]     : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : mask_diff.nc unless -o option is used.
            variables : tmask umask vmask fmask

## cdfnan

      usage : cdfnan -l LST-files [-r value] [-absmax max]

          PURPOSE :
            Detect NaN values in the input files, and change them to either spval
            (missing_value) or the value given with -r option.

            When absolute value is larger than huge or that the value given with
            the -absmax option, it is also replaced as NaN are replaced.

          CAUTION :
           ################################
           # INPUT FILES ARE OVER-WRITTEN #
           ################################

          ARGUMENTS :
            -l LST-files : A blank-separated list of the name of the files to
                   process. All files in the list must have the same geometry and
                   must contain the same variables.
                   CAUTION : input files are over-written!

          OPTIONS :
            [-r value] : use value instead of missing_value for replacing NaN.
            [-absmax rabsmax ] : replace values whose absolute value is greater
                         than max.

          OUTPUT :
            netcdf file : input file is rewritten without NaN.
              variables : same name as input.

## cdfscale

      usage : cdfscale -f INOUT-file -v IN-var -s SCAL-factor

          PURPOSE :
            Replace IN-var in INOUT-file by its values x SCAL-factor.

          CAUTION :
           #############################
           # INPUT FILE IS OVERWRITTEN #
           #############################

          ARGUMENTS :
            -f INOUT-file : netcdf input file (!overwritten!).
            -v IN-var : netcdf variable to be scaled.
            -s SCAL-factor : Scale value to be used (multiplication factor).

          OUTPUT :
            netcdf file : input file is rewritten
              variables : same name as input.

# FORCING

## cdfbuoyflx

      usage : cdfbuoyflx  -t T-file [-r RNF-file] [-f FLX-file ] [-sss SSS-name]
          ... [-sst SST-name] [-nc4] [-o OUT-file] [-short ]

          PURPOSE :
            Compute (or read) the heat and water fluxes components.
            Compute (or read) the net heat and water fluxes.
            Compute the buoyancy heat and water fluxes components.
            Compute the net buoyancy fluxes.
            Save sss and sst.

          ARGUMENTS :
            -t T-file   : netcdf file with temperature and salinity

          OPTIONS :
            [-r RNF-file ] : Specify a run-off file if runoff not in T-file
                              nor in FLX-file
            [-f FLX-file ] : Use this option if fluxes are not saved in gridT files
            [-sss SSS-name ] : Use this option if SSS variable name in T-file
                               differ from vosaline
            [-sst SST-name ] : Use this option if SST variable name in T-file
                               differ from votemper
            [-nc4 ] Use netcdf4 output with chunking and deflation level 1.
                    This option is effective only if cdftools are compiled with
                    a netcdf library supporting chunking and deflation.
            [-o OUT-file ] Default is buoyflx.nc
            [-short ] With this option only save the buoyancy flux without
                       all the components of the flux.

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : buoyflx.nc
              variables : 25 variables (2D) or 1 variable in case of -short option

          SEE ALSO :

## cdfhflx

      usage : cdfhflx  -f T-file [-o OUTNC-file ] [-ot OUTTXT-file]

          PURPOSE :
            Compute the Meridional Heat Transport (MHT) from surface heat fluxes,
            in function of the latitude.
            If a sub-basin file is available, MHT is computed for each sub-basin.
            Note that the latitude is in fact a line of constant J coordinate, not
            a true parallel, if the model grid is distorted as in the northern most
            part of ORCA configurations.

          ARGUMENTS :
            -f T-file : a file with heat fluxes (gridT).

          OPTIONS :
            [-o OUTNC-file ]: specify the name of the netcdf output file, instead of
                         cdfhflx.nc
            [-ot OUTTXT-file ]: specify the name of the text output file, instead of
                         hflx.out

          REQUIRED FILES :
            Files mesh_hgr.nc, new_maskglo.nc and mask.nc.
            If new_maskglo.nc is not available, only global MHT is computed.

          OUTPUT :
            ASCII file  : hflx.out
            netcdf file : cdfhflx.nc
              variables : hflx_glo, [hflx_atl, hflx_inp, hflx_pac, hflx_ind]

## cdfwflx

      usage : cdfwflx -t T-file -r RNF-file [-f FLX-file] [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the water fluxes components. Suitable for annual means files.
            All output variables are in mm/days.

          ARGUMENTS :
            -t T-file   : model output file with water fluxes (gridT).
            -r RNF-file : file with the climatological runoff on the model grid.

          OPTIONS :
            [-f FLX-file]: model output file with water fluxes if not in T-file.
            [-o OUT-file]: specify output file name instead of wflx.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                 This option is effective only if cdftools are compiled with
                 a netcdf library supporting chunking and deflation.
          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : wflx.nc unless -o option is used.
            variables : soevap, soprecip, sorunoff, sowadmp, sowaflux

# ICE DIAGNOSTICS

## cdficediags

      usage : cdficediag -i ICE-file [-lim3] [-o OUT-file] [-maskfile MSK-file] ...
                        ... [-maskvar MSK-var]

          PURPOSE :
             Compute the ice volume, area and extent for each hemisphere.
             The extent is computed in a similar way to NSIDC for easy
             comparison : the extent is the surface of the grid cells covered
             by ice when the ice concentration is above 0.15

             For compatibility with previous version, another estimate of
             the extend is computed using grid cell surfaces weighted by the
             ice concentration, but it will be deprecated soon.

          ARGUMENTS :
            -i ICE-file : netcdf icemod file (LIM2 by default)

          OPTION :
            [-lim3 ] : LIM3 variable name convention is used. Default is LIM2.
            [-maskfile MSK-file] : specify name of mask file instead of mask.nc
            [-maskvar MSK-var ] : specify name of mask variable instead of tmask
            [-o OUT-file ] : specify output file instead of icediags.nc

          REQUIRED FILES :
             mesh_hgr.nc and mask.nc

          OUTPUT :
            netcdf file : icediags.nc
              variables : [NS]Volume  (10^9 m3 )
                          [NS]Area    (10^9 m2 )
                          [NS]Extent  (10^9 m2 ) -- obsolete --
                          [NS]Exnsidc (10^9 m2 )
                    N = northern hemisphere
                    S = southern hemisphere
            standard output

# ICE SHELF PROCESSING

## cdfisf_fill

      usage : cdfisf_fill  -f ISF-file -v ISF-var -l ISF-list [-nc4 ] [-o OUT-file]

          PURPOSE : Builds nc file with a single value for each pool around a list
                    of given point. A warning is given when neighbouring ice-shelves
                    cannot be discriminated (no gap in between). In this case, hand
                    edit on the ISF-file is required.

          ARGUMENTS :
              -f ISF-file : netcdf file  which contains the ice shelf draft variable
                          (mesh_zgr is OK). It is used as a mask, only.
              -v ISF-var  : variable name corresponding to the ice shelf draft or
                           ice shelf level
              -l ISF-list : text file containing at least the following information:

                      1  NAME    LON  LAT I  J
                      ...
                      i  NAMEi   LON  LAT I  J
                      ...
                      EOF
                      No NAME  X    Y   I  J

          OPTIONS :
               -nc4 : use NetCDF4 chunking and deflation for the output
               -o OUT-file : specify the name of the output file instead of fill.nc
                      This file will be one of the input file for cdfmkforcingisf
                      as the ISF-fill_file

          OUTPUT :
                   netcdf file : fill.nc
                   variable : sofillvar contains for all points in ice shelf NAME
                              the value -i (negative value)
                   text file : <ISF-list>_zmin_zmax.txt
                             this output file is similar to <ISF-list> but updated
                             with the minimum and maximul value of ice-draft for
                             each shelf.

          SEE ALSO :
                cdfisf_forcing,  cdfisf_rnf , cdfisf_poolchk

## cdfisf_forcing

      usage : cdfisf_forcing -f ISF-fill_file  -v ISF-fill_var -l ISF-listfile
                  -m ISF-poolmask [-vm ISF-poolmask_variable] [-p PATTERN-file]
                 [-vp PATTERN-variable] [-nc4] [-o OUT-file ]

          PURPOSE :
              Build basal melting rate file used in NEMO ISF when nn_isf=4

          ARGUMENTS :
               -f ISF-fill_file : file built by cdfisf_fill (all the ice shelves
                                  are tagged with an id)
               -v ISF-fill_var  : name of fill variable to use in ISF-fill_file
               -l ISF-listfile : text file used to build the ISF-fill_file.
                                 Only the last variable on each line is used (GT/y)

          OPTIONS :
               -p PATTERN-file : specify the file use for patterns.
                                 [ default : isfpattern.nc ]
               -vp PATTERN-variable : specify the name of the pattern variable.
                                 [ default : sowflisf ]
               -vm ISF-poolmask_variable : specify the name of the variable used
                      for masking the pools. [ default : isfpoolmask ]
               -nc4 : use netcdf4 chunking and deflation
               -o OUT-file : specify output filename. [ default : isfforcing.nc ]

          REQUIRED FILES :
                mesh_zgr.nc mesh_hgr.nc,
                isfpattern.nc (ie reference file used to define the isf melting
                      pattern), unless -p option is used to give different name.

          OUTPUT :
              netcdf file : isfforcing.nc unless specified with -o option
              variable : sofwfisf

          SEE ALSO : cdfisf_fill, cdfisf_rnf, cdfisf_poolchk

## cdfisf_poolchk

      usage : cdfisf_poolchk -m MASK-file -d ISFDRAFT-file [-v ISFDRAFT-variable]
                 [-nc4] [-o OUT-file]

          PURPOSE :
            Produces a netcdf mask file with 1 everywhere, except for points not
            connected to the open ocean (frequent for cavities below ice-shelves),
            which have 0 value. Both 3D and 2D variables are created, the 2D
            variables being used for cdfisf_forcing.

          ARGUMENTS :
            -m MASK-file : name of the input NEMO mask file, with tmask variable.
            -d ISFDRAFT-file : name of the file with ice shelf draft.

          OPTIONS :
            -v ISFDRAFT-variable: name of the variable for ice shelf draft.
            -nc4 : use netcdf4 with chunking and deflation for the output.
            -o OUT-file : name of the output file. [Default : poolmask.nc ]

          REQUIRED FILES :
            Only the mask file given as argument

          OUTPUT :
            netcdf file : poolmask.nc unless -o option is used.
              variables : tmask_pool3d, tmask_pool2d

          SEE ALSO :
           cdfisf_fill, cdfisf_forcing, cdfisf_rnf

## cdfisf_rnf

      usage : cdfisf_rnf -f ISF-fill-file -v ISF-fill_var -l ISF-listfile -w width
          [-b BATHY-file] [-vb BATHY-var] [-i ISFDRAFT-file] [-vi ISFDRAFT-variable]
          [-nc4] [-o OUT-file ]

          PURPOSE :
             Build a netcdf file runoff file using the basal melting of the
             ice-shelves. This netcdf file is intented to be used with NEMO when
             nn_isf namelist parameter is set to 3.

          ARGUMENTS :
               -f ISF-fill_file : file built by cdffill (all the ice shelves are
                                  tagged with an id)
               -v ISF-fill_var  : name of fill variable to use in ISF-fill_file
               -l ISF-list : Text file with the melting rate (GT/y) given for
                    each ice shelf.
               -w width : specify the width (in grid points) on which the run-off
                    will be applied.

          OPTIONS :
               -b BATHY-file : give name of bathy file.
                           [ default : bathy.nc ]
               -vp BATHY-var : give name of bathy variable.
                           [ default : Bathymetry ]
               -i ISFDRAFT-file : give name of isf_draft file.
                           [ default : isf_draft.nc ]
               -vi ISFDRAFT-var : give name of isf_draft variable.
                           [ default : isf_draft ]
               -nc4 : Use this option to have netcdf4 output file, with chunking
                    and deflation.
               -o OUT-file : Specify the name of the output file instead of
                    the default name rnfisf.nc

          REQUIRED FILES :
            mesh_hgr.nc and all files specified on the command line

          OUTPUT :
            netcdf file : rnfisf.nc unless -o option used
              variables : sozisfmax (m), sozisfmin(m), sofwfisf (kg/m2/s)

          SEE ALSO :
            cdfisf_fill, cdfisf_forcing, cdfisf_poolchk

# ICEBERG PROCESSING

## cdficb_clim

      usage : cdficb_clim -l LST-ICB-monthly-files [-o OUT-file] [-nc4]

          PURPOSE :
             Concatenates 12 monthly input files, into a 12 frames output file.
             This is done for the 2 variables corresponding to mass and melt.
             No process done in this tool.

          ARGUMENTS :
            -l  LST-ICB-monthly-files : A list of 12 monthly-mean ICB files.
                 These files are likely produced by cdfmoy.

          OPTIONS :
            [-o OUT-file] : specify output file name instead of icbdiags.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                 This option is effective only if cdftools are compiled with
                 a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
              none

          OUTPUT :
            netcdf file : icbdiags.nc
              variables : Mass  (Kg/m2 )
                          Melt  (Kg/m2/s )

## cdficb_diags

      usage : cdficb_diags -f ICB-file [-jperio jperio] [-o OUT-file]

          PURPOSE :
             Compute the spatially integrated icb mass and melt flux for
             both hemispheres.

          ARGUMENTS :
            -f ICB-file : a single netcdf icb file

          OPTIONS :
            [-jperio jperio] : specify the NEMO jperio parameter for the north pole
                    folding condition. Default is            4
                     - ORCA2 ORCA025, ORCA12 uses 4
                     - ORCA1 ORCA05  uses 6
            [-o OUT-file] : specifiy output file name instead of icbdiags.nc

          REQUIRED FILES :
             mesh_hgr.nc and mask.nc

          OUTPUT :
            netcdf file : icbdiags.ncwith single values.
              variables : [NS]Mass  (Kg )
                          [NS]Melt    (Kg/s )
                    N = northern hemisphere
                    S = southern hemisphere
            standard output

# INTEGRATION

## cdffwc

      usage : cdffwc -t T-file -bv BASIN-var1,var2,.. [-o OUT-file] [-sref REFSAL]
                     [-full] [-accum] [-ssh] [-vvl]

          PURPOSE :
            Compute the freshwater content in a given basin from top to bottom
            for each layer, using a reference salinity ( 34.7) that
            can be changed with -sref option.

          ARGUMENTS :
             -t T-file   : netcdf input file holding salinity (in general a gridT).
             -bv BASIN-var1,var2,.. : Comma separated list of sub-basin variables
                     to process. E.g.: -bv tmaskatl,tmaskind

          OPTIONS :
             -full  : for full step computation
             -accum : compute accumulated content from top to bottom
             -ssh   : take ssh into account for surface layer
             -sref REFSAL : reference salinity ( 34.7 by default)
             -vvl   : use time-varying vertical metrics
             -o OUT-file :  use specified output file instead of fwc.nc
             -b SUBAS-file :  use specified subbasin file instead of subbasins.nc

          REQUIRED FILES :
            mesh_zgr.nc, mesh_hgr.nc and subbasins.nc and mask.nc

          OUTPUT :
            netcdf file :  fwc.nc (or specified with -o option)
              variables :  fwc_BASIN, where BASIN was set by argument BASIN-var*
                           (cAsE sensitive !)

## cdfheatc

      usage :  cdfheatc  -f T-file [-mxloption option] -[mxlf MXL-file] ...
          [-zoom imin imax jmin jmax kmin kmax] [-full] [-o OUT-file]
          [-M MSK-file VAR-mask ] [-vvl ]

          PURPOSE :
             Compute the heat content in the specified 3D area (Joules)

          ARGUMENTS :
            -f T-file : name of the input file with temperature (and MLD if needed).

          OPTIONS :
            [-zoom imin imax jmin jmax kmin kmax] : limit of a sub domain where
                   the heat content will be calculated.
                     - if imin = 0 then ALL i are taken
                     - if jmin = 0 then ALL j are taken
                     - if kmin = 0 then ALL k are taken
            [-full ] : assume full step model output instead of default
                    partial steps.
            [-mxloption option]: option= 1 : compute only in the mixed layer,
                                 option=-1 : exclude mixed layer in the computation
                                 option= 0 : [Default], do not take care of mxl.
            [-mxlf MXL-file ]: give name where MLD is found, if not in T-file.
                       Only usefull if mxl option is not 0.
            [-o OUT-file ] : specify netcdf output filename instead of heatc.nc
            [-M MSK-file VAR-mask] : Allow the use of a non standard mask file
                   with VAR-mask, instead of mask.nc and tmask
                   This option is a usefull alternative to -zoom option, when the
                   area of interest is not 'box-like'
            [ -vvl ] : use time-varying  e3t for integration

          REQUIRED FILES :
            Files mesh_hgr.nc, mesh_zgr.nc and mask.nc

          OUTPUT :
            netcdf file : heatc.nc unless -o option is used.
                   variables: heatc3d (Joules)
                            : heatc2d(dep) (Joules)
                            : heatc3dpervol (Joules/m3)
            Standard output

           SEE ALSO:
               cdfpolymask

## cdfmean

      usage : cdfmean -f IN-file -v IN-var -p C-point  ...
            ... [-w imin imax jmin jmax kmin kmax] [-full] [-var] [-zeromean]...
            ... [-M MSK-file VAR-mask ] [-o OUT-file] [ -ot OUTASCII-file] ...
            ... [-oz ZEROMEAN-file] [-ov VAR-file] [ -vvl ]

          PURPOSE :
             Compute the mean value of the field (3D, weighted). For 3D fields,
             a horizontal mean for each level is also given. If a spatial window
             is specified, the mean value is computed only in this window.

          ARGUMENTS :
            -f IN-file : input netcdf file.
            -v IN-var  : name of netcdf variable to work with.
            -p C-point : one of T|U|V|F|W indicating the position of IN-var on the
                     C-grid.

          OPTIONS :
            [-w imin imax jmin jmax kmin kmax] : spatial window where mean value
                     is computed:
                       if imin = 0 then ALL i are taken
                       if jmin = 0 then ALL j are taken
                       if kmin = 0 then ALL k are taken
            [-M MSK-file VAR-mask] : Allow the use of a non standard mask file
                   with VAR-mask, instead of mask.nc and the variable
                   associated with the grid point set by -p argument.
                   This option is a usefull alternative to the -w option, when the
                   area of interest is not 'box-like'. However, for vertical
                   selection, both -w and -M can be used together.
            [-full ] : compute the mean for full steps, instead of default
                   partial steps.
            [-var ]: also compute the spatial variance of IN-var.
            [-zeromean ] : create a file with cdfvar having a zero spatial mean.
            [-o OUT-file]: specify the name of the output file instead of cdfmean.nc
            [-ot OUTASCII-file] : specify the name of the output ASCII file instead
                        of cdfmean.txt
            [-oz ZEROMEAN-file] : specify the name of the output netcdf file for
                        option -zeromean, instead of zeromean.nc
            [-ov VAR-file] : specify the name of the output text file for option
                        -var, instead of cdfvar.txt
            [-vvl ] : use time-varying vertical metrics.

          REQUIRED FILES :
            Files mesh_hgr.nc, mesh_zgr.nc, mask.nc

          OUTPUT :
            - netcdf file : cdfmean.nc
                variables : mean_<IN-var>, mean_3D_<IN-var>
                         [var_<IN-VAR>, var_3D_<IN-var>, in case of -var]
            - netcdf file : zeromean.nc [ in case of -zeromean option]
                variables : <IN-var>
            - ASCII files : cdfmean.txt
                            [ cdfvar.txt, in case of -var ]
            - all output on ASCII files are also sent to standard output.

## cdfsigintegr

      usage : cdfsigintegr -v IN-var -s RHO-file -l LST-files [-p C-type ] ...
                   ... [-sig sigma_name] [-full] [-nc4] [-vvl]

          PURPOSE :
            Take a list of input files with specific IN-var variable, associated
            with a reference density file. A set of isopycnal surfaces is defined
            in an ASCII file (rho_lev by default), using same depth reference than
            the input reference density file. This program computes the integral of
            IN-var between the isopycnals defined in rho_lev. It also gives the
            isopycnal depth and thickness of density layers.

            Rho_lev file first line indicates the number of following isopycnals.
            Then a list of the densities is given, one per line.

          ARGUMENTS :
            -v IN-var : input variable to be integrated
            -s RHO-file : netcdf file with already computed density
            -l LST-files : a blank separated list of model netcdf files
                   containing IN-var.

          OPTIONS :
            [-p  C-type ] : one of T U V F W which defined the position of
                    IN-var in the model C-grid. Default is T
            [-sig sigma_name ] : give the name of sigma variable in RHO-file.
                    Default is vosigma0
            [-full ] : indicate a full step configuration.
            [-rholev  file] : indicates name of file defining the limits for
                    integration. Default is rho_lev
            [-vvl ] : use time-varying vertical metrics.
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                 This option is effective only if cdftools are compiled with
                 a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            mesh_zgr.nc and rho_lev

          OPENMP SUPPORT : yes

          OUTPUT :
            netcdf file : IN-file.integr
              variables : inv_<IN-var>  : inventory of IN-var from input file.
                 vodepiso (m) : depth of isopycnal.
                 isothick (m) : thickness of isopycnal layer.
                 mean_<IN-var> (same unit as IN-var) : mean IN-var in the isopycnal

          SEE ALSO :
           cdfrhoproj, cdfsigtrp, cdfisopycdep

## cdfsigintegr_bottom

## cdfsigintegr_pedro

## cdfsum

      usage : cdfsum -f IN-file -v IN-var -p C-type ...
               ... [-w imin imax jmin jmax kmin kmax] [-full ] ...
               ... [-o OUT-file] [-nc4] [-M MSK-file VAR-mask ] [-vvl]

          PURPOSE :
            Compute the sum value of the field (3D, weighted). This sum can be
            optionally limited to a 3D sub-area.

          ARGUMENTS :
            -f IN-file : netcdf input file.
            -v IN-var  : netcdf variable to work with.
            -p C-type  : one of T|U|V|F|W indicating rhe  C-grid point where
                    IN-var is located.

          OPTIONS :
            [-w imin imax jmin jmax kmin kmax]: set the 3D window limiting sub area.
                   if imin=0 all i are taken
                   if jmin=0 all j are taken
                   if kmin=0 all k are taken
            [-full ]:  Use full steps instead of default partial steps
            [-vvl  ]:  use time -varying  vertical metrics
            [-o OUT-file ] : name of the output file instead ofcdfsum.nc
            [-nc4 ] : use netcdf4 chunking and deflation.
            [-M MSK-file VAR-mask] : Allow the use of a non standard mask file
                   with VAR-mask, instead of mask.nc and the variable
                   associated with the grid point set by -p argument.
                   This option is a usefull alternative to the -w option, when the
                   area of interest is not 'box-like'. However, for vertical
                   selection, both -w and -M can be used together.

          REQUIRED FILES :
           mesh_hgr.nc, mesh_zgr.nc and mask.nc. If
              -M option is used, the specified mask file is required instead
              mask.nc

          OUTPUT :
            Standard output.
            netcdf file : cdfsum.nc unless modified with -o option.
                - 2 variables : vertical profile of sum and 3D sum.
                              names are sum_<varname> and sum3D_<varname>.

          SEE ALSO:
            cdfmean

## cdfvertmean

      usage :  cdfvertmean -f IN-file -l LST-var -p C-type -zlim dep1 dep2
                   ... [-full] [-o OUT-file] [-nc4] [-vvl] [-debug]

          PURPOSE :
            Compute the vertical mean between dep1 and dep2 given in m, for the
            list of variables LST-var, belonging to the input file.

          ARGUMENTS :
            -f IN-file  : netcdf input file.
            -l LST-var : Comma separated list of input variables to process.
            -p C-type  : one of T U V W indicating position of variable on C-grid
            -zlim dep1 dep2 : depths limit for vertical integration (in meters),
                from top to bottom, positive depths.

          OPTIONS :
            [-full  ] : for full step configurations. Default is partial step.
            [-debug ] : print some extra informations.
            [-vvl ] : use time-varying vertical metrics.
            [-o OUT-file ] : specify output file instead of vertmean.nc
            [-nc4 ]: Use netcdf4 output with chunking and deflation level 1.
                This option is effective only if cdftools are compiled with
                a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            mesh_zgr.nc and mask.nc

          OUTPUT :
            netcdf file : vertmean.nc
              variables : varin_vertmean (same units as input variable)

## cdfvint

      usage : cdfvint -f T-file [-v IN-var] [-GSOP] [-OCCI] [-full] [-vvl] ...
                   ... [-tmean] [-smean] [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the vertical integral of the variable from top to bottom,
            and save the cumulated valued, level by level. For temperature
            (default variable), the integral is transformed to heat content,
            (unit in 10^6 J/m2) hence for salinity, the units are PSU.m

          ARGUMENTS :
              -f T-file : gridT file holding either temperature or salinity

          OPTIONS :
             [-v IN-var ] : name of input variable to process. Default is votemper
                     Possible other choice is vosaline
             [-GSOP] : Use 7 GSOP standard level for the output
                     Default is to take the model levels for the output
             [-OCCI] : Use 3 levels for the output: 700m, 2000m and bottom
                     Default is to take the model levels for the output
             [-full] : for full step computation
             [-vvl]   : use time-varying metrics for vertical integration
                    (still some details to fix for the last cell including the
                     target deptht).
             [-tmean] : output mean temperature instead of heat content
             [-smean] : output mean salinity instead of PSU.m
             [-o OUT-file] : use specified output file instead of <IN-var>.nc
             [-nc4]  : use netcdf4 output with chunking and deflation

          REQUIRED FILES :
            mask.nc, mesh_hgr.nc and mesh_zgr.nc

          OUTPUT :
            netcdf file :  VAR-name.nc (or specified with -o option)
              variables :  either voheatc or vohsalt, unless -tmean or -smean used
                    In this latter case, variables are votemper and
                   vosaline

          SEE ALSO :
             cdfvertmean, cdfheatc, cdfmxlhcsc and  cdfmxlheatc

## cdfzonalmean

      usage : cdfzonalmean -f IN-file -p C-type [-b BASIN-file] ...
            ... [-l LST-var] [-max ] [-pdep] [-o OUT-file ] [-debug] ...

          PURPOSE :
            Compute the zonal mean of all the variables available in the input
            file. This program assumes that all the variables are located on the
            same C-grid point, specified on the command line. Using -l option
            limits the variables to be processed to the listed variables.

            Zonal mean is in fact the mean value computed along the I coordinate.
            The result is a vertical slice, in the meridional direction.

            REMARK : partial step and vvl output are not handled properly (but
                     probably minor impact on results), e3x not zonally constant.

          ARGUMENTS :
            -f IN-file : input netcdf file.
            -p C-type  : indicate the location on C-grid (T|U|V|F|W)

          OPTIONS :
            [-b BASIN-file] : netcdf file describing sub basins, similar to
                    new_maskglo.nc. If this name is not given as option,
                     only the global zonal mean is computed.
            [-max      ] : output the zonal maximum and minimum of the variable
            [-l LST-var] : Comma separated list of selected variables
            [-pdep ]  : use positive depths in the output file. Default behaviour
                     is to have negative depths.
            [-ndep_in ] : negative depths are used in the input file. Default
                     behaviour is to have positive depths.
            [-o OUT-file ] : specify output file name instead of zonalmean.nc
            [-debug   ] : add some print for debug.

          REQUIRED FILES :
            mesh_hgr.nc, mesh_zgr.nc and mask.nc

          OUTPUT :
            netcdf file : zonalmean.nc unless option -o is used.
              variables : output variable names are built with the following
                   convention: zoxxxx_bas
                   - where zo replace vo/so prefix of the input variable,
                   - where bas is a suffix for each sub-basins (or glo) if a
                      BASIN-file is used.
                   If option -max is used, then <IN-var>_max  and <IN-var>_min
                   variables are created.

## cdfzonalmeanvT

      usage : cdfzonalmeanvT -c CONFIG-CASE -l LST-tags [-b BASIN-file] [-pdep] ...
                      ...  [-ndep_in] [-o OUT-file]

          PURPOSE :
            Compute the time average of zonal-mean(V) x zonal-mean(T/S) for the
            set of files corresponding to the list of tags, passed as arguments.
            This quantity is the mean-flow contribution to the heat/salt transport
            overturning component. < > being the zonal average, we have:
                   Total       =        mean-flow             +     eddy.
             time_mean(<V><T>) = time_mean(<V>)*time_mean(<T>)+time_mean(<V>'<T>')

            Zonal mean is in fact the mean value computed along the I coordinate.
            The result is a vertical slice, in the meridional direction.

            REMARKS:  Partial steps are not handled properly (but probably minor
                impact on results) nor vvl case !.

          ARGUMENTS :
            -c CONFIG-CASE is the config name of a given experiment (eg ORCA025-G70)
                 The program will look for gridT, gridU and gridV files for this
                 config (grid_T, grid_U and grid_V are also accepted). In addition,
                 if gridS or grid_S file is found, it will be taken in place of
                 gridT for the salinity variable.
            -l LST-tags : a blank-separated list of time tags that will be used
                 for time averaging. e.g. y2000m01d05 y2000m01d10 ...

          OPTIONS :
            [-b BASIN-file] : netcdf file describing sub basins, similar to
                 new_maskglo.nc. If this name is not given as option, only
                 the global zonal mean is computed.
            [-pdep  ] : use positive depths in the output file.
                 Default behaviour is to have negative depths.
            [-ndep_in ] : negative depths are used in the input file.
                 Default behaviour is to have positive depths.
            [-o OUT-file] : specify output file name instead of zonalmeanvt.nc
            [-debug] : add some print for debug

          REQUIRED FILES :
            mesh_hgr.nc, mesh_zgr.nc and mask.nc

          OUTPUT :
            netcdf file : zonalmeanvt.nc
              variables : zovzot : mean product of zonal_mean(V) x zonal_mean(T)
                          zovzot : mean product of zonal_mean(V) x zonal_mean(S)
                            A suffix _bas is append to variable name oin order to
                          indicate the basin (atl, inp, ind, pac) or glo for global

## cdfzonalsum

      usage : cdfzonalsum -f IN-file -p C-type [-b BASIN-file] [-l LST-var] ...
                    ... [-pdep] [-pdeg] [-o OUT-file] [-debug]

          PURPOSE :
            Compute the zonal sum of all the variables available in the input file.
            This program assumes that all the variables are located at the same
            C-grid point, specified on the command line. If a list of variables is
            given with  -l option, only the listed variables will be processed.

            Zonal sum is in fact the integral value computed along the I coordinate.
            The result is a vertical slice, in the meridional direction.

            REMARK : partial step and vvl output are not handled properly (but
                     probably minor impact on results), e3x not zonally constant.

          ARGUMENTS :
            -f IN-file : input netcdf file.
            -p C-type  : indicate the location on C-grid (T|U|V|F|W)

          OPTIONS :
            [-b BASIN-file] : netcdf file describing sub basins, similar to
                  new_maskglo.nc. If this name is not given as option, only
                  the global zonal integral is computed.
            [-l LST-var ] : Comma separated list of selected variables
            [-pdep      ] : use positive depths in the output file.
                  Default behaviour is to have negative depths.
            [-pdeg ] : When using this option, the zonal integral is normalized per
                  degree of latitude. This was formerly done with cdfzonalintdeg.
                  Default behaviour is not to normalize.
            [-o OUT-file ] : specify output file name instead of zonalsum.nc
            [-debug ] : add some print for debug

          REQUIRED FILES :
            mesh_hgr.nc, mesh_zgr.nc and mask.nc

           OPENMP SUPPORT : yes

          OUTPUT :
            netcdf file : zonalsum.nc or zonalintdeg.nc (-pdeg option)
              variables : output variable names are built with the following
                          convention: zoixxxx_bas
                           where zoi replace vo/so prefix of the input variable
                           where bas is a suffix for each sub-basins (or glo)
                           if a BASIN-file is used.
                 Units are modified by adding '.m2' at the end. Can be improved !
                 In addition, '.degree-1' is append to unit with -pdeg option.

# MASK

## cdfmeshmask

      usage :  cdfmeshmask -n NAMELIST-file -b BATHY-file  -c COORD-file ...
              ... [-njbloc nbloc]

          PURPOSE :
            Create mesh_mask from bathymetry and namdom information (namelist)

          ARGUMENTS :
            -n NAMELIST-file : name of the namelist file (with NEMO namdom block)
            -b BATHY-file : name of bathymetry (meters)
            -c COORD-file : name of coordinates file

          OPTIONS :
            [-njbloc nbloc]: number of j-bloc of rows to treat together. Increasing
                  nbloc decreases memory usage but increases writing time.
                 default : nbloc = npjglo (worst condition)

          REQUIRED FILES :
             namelist, bathymetry and coordinated passed on the command line

          OUTPUT :
            netcdf files : cdf_mesh_zgr.nc cdf_mesh_hgr.nc and cdf_mask.nc

          SEE ALSO :

## cdfmkmask

      usage : cdfmkmask -f T-file [-zoom lonmin lonmax latmin latmax] ...
                        ... [-zoomij iimin iimax ijmin ijmax] ...
                        ... [-zoombat bathymin bathymax]  ...
                        ... [-zoomvar varname varmin varmax]  ...
                        ... [-time ] [-o OUT-file]

          PURPOSE :
            Builds a mask file from vosaline array read from the input file.
            It assumes that land salinity values are set to 0.

            Additional criteria can be added such as geographical limits, model
            limits, bathymetric limits and variable range limits.

            Any combination of the criteria is valid.

          ARGUMENTS :
            -f T-file : netcdf file with salinity.
                     if T-file = -maskfile, we assume a reference file named mask.nc
                     with tmask variable.
                     if T-file = -mbathy, we assume a reference file named
                     bathylevel.nc with mbathy variable, giving the number of
                     levels in the ocean.

          OPTIONS :
            [-zoom lonmin lonmax latmin latmax] : geographical windows used to
                             limit the area where the mask is builded. Outside
                             this area, the mask is set to 0.
            [-zoomij iimin iimax ijmin ijmax] : model grid windows used to
                             limit the area where the mask is builded. Outside
                             this area, the mask is set to 0.
            [-zoombat bathymin bathymax] : depth windows used to
                             limit the area where the mask is builded. Outside
                             this area, the mask is set to 0.
                             Need mesh_zgr.nc
            [-zoomvar varname varmin varmax] : range of varname variable used to
                             limit the area where the mask is builded. Outside
                             this area, the mask is set to 0.
            [-time ] : If further time step is available
                             a mask for each time step is done
            [-o OUT-file ] : output file name to be used in place of standard
                             name [ mask_sal.nc ]

          REQUIRED FILES :
            If option -zoombat is used, file mesh_zgr.nc is required.
            If option T-file is -maskfile then mask.nc is required.
            If option T-file is -mbathy then bathylevel.nc and mesh_zgr.nc
             are required.

          OUTPUT :
            netcdf file : mask_sal.nc or OUT-file.
              variables : tmask, umask, vmask, fmask
                     fmask can differ from standard fmask because it does not
                     reflect the slip/noslip lateral condition.

## cdfmltmask

      usage : cdfmltmask -f IN-file -m MSK-file -v LST-var -p C-type ...
                   ...  [-s _Fillvalue] [-o OUT-file] [-M MSK-var] [-noup]

          PURPOSE :
            This program is used to apply masking (multiply by 1 or 0 ) some
            selected variables from the input file, according to their position
            on the C-grid. The use of polymask (polygon shape mask, created by
            cdfpolymask) is possible.

            Once the variables are masked, the '_FillValue' attribute of the
            variables is changed to its correct new value. However, when working
            with NETCDF4/HDF4 files, it fails with segmentation fault. The actual
            workaround is either to transform the input file in NETCDF classical, or
            to use -noup option to prevent the update of the _FillValue attribute.

          ARGUMENTS :
            -f IN-file  : input netcdf file.
            -m MSK-file : input netcdf mask file.
            -v LST-var  : Comma separated list of variable names to mask.
            -p C-type : one of T|U|V|F|W|P indicating the  C-grid position of the
                    variables.  P indicates a polygon mask created by cdfpolymask.
           OPTIONS :
             [-s _FillValue] : specify values for masked areas [0 by default]
             [-o OUT-file] : name of output file, instead of <IN-file>_masked
             [-M MSK-var] : use MSK-var in the MSK-file, instead of the one defined
                    by default according to the -p option. Overrid -p option.
             [-noup] : do not update the _FillValue attribute of the masked
                    variables. Usefull for NETCDF4/HDF5 files, to prevent program
                    crash (a better fix will be provided, if possible).

          REQUIRED FILES :
             none, all are given as arguments.

          OUTPUT : (jvar)
            The output file is a copy of the input file with only
            the requested variable masked.
            netcdf file : IN-file_masked unless specified with -o
              variables : IN-var (same as input).

## cdfpolymask

      usage : cdfpolymask -p POLY-file -ref REF-file [-r] [-o OUT_file]

          PURPOSE :
            Create a maskfile with polymask variable having 1 inside the
            polygon, and 0 outside. Option -r revert the behaviour (0 inside,
            1 outside).

          ARGUMENTS :
            -p POLY-file : input ASCII file describing a polyline in I J grid.
                 This file is structured by block, one block corresponding
                 to a polygon:
                   1rst line of the block gives a polygon name
                   2nd line gives the number of vertices (nvert) and a dummy 0
                   the block finishes  with nvert pairs of (I,J) describing
                   the polygon vertices.
            -ref REF-file  : reference netcdf file for header of polymask file.
                  This file will be used to look for domain dimensions, and
                  in order to build the output file (nav_lon, nav_lat etc ...)

          OPTIONS :
             [-r ] : revert option. When used, 0 is inside the polygon,1 outside.
             [-o OUT-file ] : spefify the name of the output mask file instead
                      of polymask.nc

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : polymask.nc
              variables : polymask

# MISCELLANEOUS

## cdfimprovechk

      usage : cdfimprovechk -v IN-var -obs OBS-file -r REF-file -t TST-file ...
                     ... [-o OUT-file] [-nc4]

          PURPOSE :
             Estimates the improvement/deterioration of a test run, compared with a
             reference run relative to some observations.
             This program computes the field zchk= ( REF - TST )/(REF - OBS).
             Where 0 < zchk <= 1, the TST is better than the reference
             Where 1 < zchk, the TST  was corrected in the right sense but too much
             Where  zchk < 0, the TST  was corrected was corrected in the wrong way.
             Although not very much used, this program is maintained as one of the
             first CDFTOOLS.

          ARGUMENTS :
             -v IN-var    : netcdf input variable
             -obs OBS-file: netcdf observation file
             -r REF-file  : netcdf reference file
             -t TST-file  : netcdf test file

          OPTIONS :
             [-o OUT-file] : specifiy the output file name instead of chk.nc
             [-nc4]    : Use netcdf4 output with chunking and deflation level 1.
                    This option is effective only if cdftools are compiled with
                    a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : chk.nc
              variables : same as input variable.

# MIXED LAYER

## cdfmxl

      usage : cdfmxl -t T-file [-s S-file] [-o OUT-file] [-nc4]

          PURPOSE :
            Compute 7 estimates of the mixed layer depth from temperature and
            salinity given in the input file, based on 7 different criteria:
            1- Density criterion (0.01 kg/m3 difference between surface and MLD)
            2- Density criterion (0.03 kg/m3 difference between surface and MLD)
            3- Temperature criterion (0.2 C absolute difference between surface
               and MLD)
            4- Temperature criterion (0.2 C absolute difference between T at 10m
               and MLD)
            5- Temperature criterion (0.5 C absolute difference between T at 10m
               and MLD)
            6- Density criterion (0.03 kg/m3 difference between rho at 10m and MLD)
            7- Density criterion (0.125 kg/m3 difference between rho at 10m and MLD)

          ARGUMENTS :
            -t T-file   : input netcdf file (gridT)

          OPTIONS :
            [-s S-file] : input netcdf file (gridS), if vosaline not in T-file
            [-o OUT-file] : specify the name of output file instead of mxl.nc
            [-nc4] : use netcdf4 chunking and deflation on output

          REQUIRED FILES :
             mesh_zgr.nc
              In case of FULL STEP configuration, bathy_level.nc is also required.

          OUTPUT :
            netcdf file : mxl.nc
              variables : somxl010    = mld on density criterion 0.01 ref. surf.
                          somxl030    = mld on density criterion 0.03 ref. surf.
                          somxlt02    = mld on temperature criterion -0.2 ref. surf.
                          somxlt02z10 = mld on temperature criterion -0.2 ref. 10m
                          somxlt05z10 = mld on temperature criterion -0.5 ref. 10m
                          somxl030z10 = mld on density criterion 0.03 ref. 10m
                          somxl125z10 = mld on density criterion 0.125 ref. 10m

## cdfmxlhcsc

      usage : cdfmxlhcsc -f T-file -C criteria -t THRESH-value [-hmin hmin] ...
                  ... [-o OUT-file] [-nc4] [-vvl] [-mld MLD-file MLD-var]

          PURPOSE :
            Compute the MiXed Layer depth, the Heat Content and Salt Content.

          ARGUMENTS :
            -f T-file : netcdf input file for temperature and salinity (gridT).
            -C criteria : Specify the type of criteria to use for MXL computation
                     can be one of temperature, t,  T for temperature criteria.
                         or one of density, d,  D  for density criteria.
            -t THRESH-value : threshold value for the criteria.
                     (eg: 0.2 for temp, 0.01 or 0.03 for dens)

          OPTIONS :
            [-hmin hmin ] : limit the vertical integral from hmin to mld. By default
     ,
                      hmin is set to 0 so that the integral is performed on the
                      whole mixed layer.
            [-o OUT-file ] : specify output file name instead of mxlhcsc.nc
            [ -nc4 ]     : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.
            [-vvl ] : use time-varying vertical metrics
            [-mld MLD-file MLD-var]: This option replaces both '-C' and '-t'
                      arguments, indicating that the mixed layer depth is to be read
                      as the variable MLD-var in the MLD-file. With this option, the
                      heat and salt content can be computed from the MLD estimates
                      provided by 'cdfmxl'.

          REQUIRED FILES :
            mesh_hgr.nc mesh_zgr.nc and mask.nc
             In case of full step configuration, bathy_level.nc is also required.

          OUTPUT :
            netcdf file : mxlhcsc.nc unless -o option is used
              variables : -  somxl010 (mld based on density criterion 0.01)
               (2D)          or somxl030 (mld on density criterion 0.03)
                             or somxlt02 (mld on temperature criterion -0.2)
                             -  somxlheatc (heat content computed in the MLD)
                             -  somxlsaltc (salt content computed in the MLD)

          SEE ALSO :
            cdfmxl, cdfmxlheatc and  cdfmxlsaltc.

## cdfmxlheatc

      usage : cdfmxlheatc -f T-file [-mxlf MXL-file] [-full] [-vvl] ...
                      ...   [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the heat content in the mixed layer (Joules/m2).

          ARGUMENTS :
            -f T-file : netcdf input file with temperature and mld (gridT).

          OPTIONS :
            [-mxlf MXL-file] : netcdf input file with  mld if not in T-file.
            [-full ] : for full step configurations, default is partial step.
            [-o OUT-file ] : specify output file instead of mxlheatc.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.
            [-vvl ] : use time-varying vertical metrics.

          REQUIRED FILES :
            mesh_zgr.nc and mask.nc

          OUTPUT :
            netcdf file : mxlheatc.nc unless option -o is used.
              variables : somxlheatc (Joules/m2)

          SEE ALSO :
            cdfmxl, cdfmxlhcsc and  cdfmxlsaltc.

## cdfmxlsaltc

      usage : cdfmxlsaltc -f T-file [-mxlf MXL-file] [-full] [-vvl] ...
                      ...   [-o OUT-file] [-nc4] [-vvl]

          PURPOSE :
            Compute the salt content in the mixed layer.

          ARGUMENTS :
            -f T-file : netcdf input file with salinity and mld (gridT).

          OPTIONS :
            [-mxlf MXL-file]: netcdf input file with mld if not in T-file.
            [-full ] : for full step configurations, default is partial step.
            [-o OUT-file ] : specify output file instead of mxlsaltc.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.
            [-vvl ] : use time-varying vertical metrics.

          REQUIRED FILES :
            mesh_zgr.nc and mask.nc

          OUTPUT :
            netcdf file : mxlsaltc.nc unless option -o is used.
              variables : somxlsaltc (Kg/m2)

          SEE ALSO :
            cdfmxl, cdfmxlhcsc, cdfmxlheatc

# PASSIVE TRACER

## cdffracinv

      usage : cdffracinv -trc TRC-file [-inv INV-name] [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the fraction of inventory for passive tracers, which is
            the ratio between inventory at a grid point and the total inventory.

          ARGUMENTS :
            -trc TRC-file : netcdf file with tracer inventory.

          OPTIONS :
            [-inv INV-name ]: netcdf variable name for inventory [ invcfc ]
            [-o OUT-file ]: specify output file name instead of fracinv.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                 This option is effective only if cdftools are compiled with
                 a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : fracinv.nc
              variables : fracinv

## cdfpendep

      usage :  cdfpendep -trc TRC-file -i INV-file [-o OUT-file] [-nc4] ...
                   ... [-vinv inventory_name -vtrc trc_name ]

          PURPOSE :
             Compute the penetration depth for passive tracers. It is the ratio
             between the inventory and the surface concentration of the tracer.

          ARGUMENTS :
            -trc TRC-file : netcdf file with tracer concentration.
            -i INV-file   : netcdf file with inventory of the tracer.

          OPTIONS :
            [-vinv inventory_name ] : specify netcdf variable name for inventory.
                                     Default is INVCFC
            [-vtrc trc_name   ]    : specify netcdf variable name for tracer.
                                     Default is CFC11
            [-o OUT-file ] : specify output file name instead of pendep.nc
            [ -nc4 ]     : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : pendep.nc
              variables : pendep (m)

# PREPROCESSING

## cdfcofdis

      usage :  cdfcofdis -H HGR-file -M MSK-file -T gridT.nc [-jperio jperio ]...
                    ... [-surf] [-o OUT-file[ [-nc4]

          PURPOSE :
             Compute the distance to the coast and create a file with the Tcoast
             variable, indicating the distance to the coast. This computation is
             done for every model level, unless -surf option is used.
             This file is used in NEMO tradmp routine for fading out restoring
             in vicinity of the coast line.

          ARGUMENTS :
            -H HGR-file : name of the mesh_hgr file
            -M MSK-file : name of the mask file
            -T T-file   : netcdf file at T point ( used for looking at jpk)

          OPTIONS :
            [-jperio jperio ] : define the NEMO jperio variable for north fold
                condition. Default is  4.
            [-surf ] : only compute  distance at the surface.
            [-o OUT-file ] : specify name of the output file instead of dist.coast
            [-nc4 ]     : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : dist.coast unless -o option is used.
              variables : Tcoast (m)

## cdfmaskdmp

      usage : cdfmaskdmp -t T-file [-s S-file] [-refdep REF-depth] ...
                  ... [-dens smin width] [-dep hmin width] [-lat latmax width] ...
                  ... [-o OUT-file] [-nc4]

          PURPOSE :
            Compute a damping mask with smooth transition according to density,
            depth and latitude criteria. For each kind of criterion, a minimum
            value and a width of transition is used. Both minimum and width can
            be adjusted with corresponding options. Reasonable default values are
            provided.

            This tool was designed for building a mask in the deep Southern Ocean,
            for dense waters. This explains that we consider the limit as a minimum
            depth and density, but a maximum latitude. It needs some adjustments for
            other situations.

          ARGUMENTS :
            -t T-file : temperature/salinity file used to compute the potential
                  density relative to the reference depth.

          OPTIONS :
            [-s S-file] : salinity file in case it differs from the temperature file
     .
            [-refdep REF-depth] : reference depth for potential density.
            [-dens smin width] : set minimum density and width for density tapering
            [-dep  hmin width] : set minimum depth and width for depth tapering
            [-lat  latmax width]: set max latitude and width for latitude tapering
            [-o OUT-file] : specify output file name instead of mask_dmp.nc
            [-nc4 ]  : Use netcdf4 output with chunking and deflation level 1.
                  This option is effective only if cdftools are compiled with
                  a netcdf library supporting chunking and deflation.

            Actual default values are :
                 -refdep  2000.
                 -dens     37.160   0.025
                 -dep    1000. 100.
                 -lat     -20.   2.

          REQUIRED FILES :
            mask.nc

          OUTPUT :
            netcdf file : mask_dmp.nc unless -o option is used.
              variables : wdmp

## cdfmppini

      usage : cdfmppini -i jpni -j jpnj [-m/-b/-z] [-jperio jperio]

          PURPOSE :
            Performs the mpp initialisation with NEMO routine mpp_init2 and gives
            some statistics about the domains. Save the layout on a text file.

          ARGUMENTS :
            -i jpni : number of domains in the i direction.
            -j jpnj : number of domains in the j direction.

          OPTIONS :
            [-m/-b/-z] : use one of these option to choose the land/sea mask.
                    m  : take mask from mask.nc (tmask) [ default ]
                    b  : take mask from bathy_meter.nc (Bathymetry)
                    z  : take mask from mesh_zgr.nc (mbathy)
                        Default is m
            [-jperio jperio ] : specify jperio.
                              default value is  6

          REQUIRED FILES :
            one of mask.nc, bathy_meter.nc or mesh_zgr.nc according to option

          OUTPUT :
            - Standard output
            - ASCII file mppini.txt

# SECOND ORDER MOMENTS

## cdfuv

      usage : cdfuv -c CONFIG-CASE -l LST-tags [-opt] [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the time average values for U.V product, at T point.
            Mean U, mean V  and mean U'.V'  at T point are also computed.

          ARGUMENTS :
            -c CONFIG-CASE is the config name of a given experiment (eg ORCA025-G70)
                 The program will look for gridU and gridV files for this config
                 grid_U and grid_V are also accepted).
            -l LST-tags : a list of time tags that will be used for time averaging.
                 e.g. :  y2000m01d05 y2000m01d10 ...

          OPTIONS :
            [-opt :] use optimized algorithm, minimizing truncation errors in the
                  evaluation of mean U, meanV and mean (U'.V').
            [-o OUT-file] : specify output filename instead of uv.nc
            [-nc4 ] :  Use netcdf4 output with chunking and deflation level 1.
                  This option is effective only if cdftools are compiled with
                  a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : uv.nc
            variables : vouv  : Mean U.V at T point
                        vozocrtx_t : Mean U at T point
                        vomecrty_t : Mean V at T point
                        vouv_prime : Mean U'.V' at T point

## cdfuvwt

      usage : cdfuvwt -c CONFCASE -l LST-tags [-w imin imax jmin jmax] ...
                    ... [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the time-mean fields for velocity components (u,v,w) and
            temperature (t), as well as second order moments ( u2, v2, t2, uv, ut,
            vt, wt).
            These fields are required in other cdftools which computes either
            barotropic (cdfnrj_bti) or baroclinic (cdfnrj_bci) instabilities, and a
            global energy balance (cdfnrj_components)

          ARGUMENTS :
            -c CONFCASE : the root name for the data files. Grid files are assumed
                     to be gridT, gridU, gridV, gridW. (grid_T, grid_U, grid_V and
                     grid_W are also supported).
            -l LST-tags : set the list of time tags corresponding to the time serie
                     whose mean is being computed.

          OPTIONS :
            [-w imin imax jmin jmax ] : model window limiting the area where the
                     time-means will be computed.
            [-o OUT-file] : specify output file name instead of moyuvwt.nc
            [-nc4]   : Use netcdf4 output with chunking and deflation level 1.
                  This option is effective only if cdftools are compiled with
                  a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : moyuvwt.nc
              variables :  There are 11 variables produced by this program.
                      tbar, t2bar : mean t (Kelvin) and mean t^2 (K^2)   [T-point]
                      ubar, u2bar : mean u (m/s) and mean u^2 (m2/s2)    [U-point]
                      vbar, v2bar : mean v (m/s) and mean v^2 (m2/s2)    [V-point]
                      wbar        : mean w (m/s)                         [W-point]
                      uvbar       : mean product u . v (m2/s2)           [T-point]
                      utbar, vtbar, wtbar : mean product [uvw].t (m/s.K) [T-point]

          SEE ALSO :
           cdfnrj_bti, cdfnrj_bci, cdfnrj_components and cdfnrj_transfert.

## cdfvT

      usage : cdfvT -c CONFIG-CASE -l LST-tags [-o OUT-file ] [-nc4 ] [-vvl]

          PURPOSE :
            Compute the time average values for second order moments V.T, V.S, U.T
            and U.S used in heat and salt transport computation.

          ARGUMENTS :
            -c CONFIG-CASE is the config name of a given experiment (eg ORCA025-G70)
                 The program will look for gridT, gridU and gridV files for this
                 config ( grid_T, grid_U and grid_V are also accepted).
                 Additionaly, if gridS or grid_S file is found, it will be taken
                 in place of gridT for the salinity variable.
            -l LST-tags : a blank-separated list of time tags that will be used for
                 time averaging, e.g.:  y2000m01d05 y2000m01d10 ...

          OPTIONS :
            [-o OUT-file] : specify output file name instead of vt.nc
            [-nc4 ] use netcdf4 output with chunking and deflation 1
            [-vvl ] use time varying vertical metrics.

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : vt.nc unless -o option used.
            variables : vozout time-mean ( U.T ) at U point.
                        vozous time-mean ( U.S ) at U point.
                        vomevt time-mean ( V.T ) at V point.
                        vomevs time-mean ( V.S ) at V point.

## cdfvsig

      usage : cdfvsig -c CONFIG-CASE -l LST-tags [-o OUT-root] [-nc4] [-no-w] ...
                   ... [-no-sig]  [-no-uv] [-T ] [-depref LST-depht]

          PURPOSE :
            Compute the time average values for second order moments U.sig, V.sig
            and W.sig. By default sig is sigma-0, the potential density refered to
            the surface. The user can provide a list of reference depths, to force
            the computation of the respective second order moments, e.g U.sig-2 ...

            In order to ease the post processing, time-mean densities interpolated
            at velocity points, as well as mean velocity components are also saved.
            Various options allows the modulation of the output.

          ARGUMENTS :
            -c CONFIG-CASE is the config name of a given experiment (eg ORCA025-G70)
                 The program will look for gridT, gridU, gridV  and gridW files for
                 this config ( grid_T, grid_U, grid_V and grid_W are also accepted).
            -l LST-tags : a blank-separated list of time tags that will be used for
                 time averaging, e.g. y2000m01d05 y2000m01d10.

          OPTIONS :
             [-o OUT-root]: specify the file name root used for the output.
                 Output file names will be <ROOT>usig.nc, <ROOT>vsig and <ROOT>wsig.
                 Default <ROOT> is empty. Consider then to add an '_' in the root
                 name.
             [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                 This option is effective only if cdftools are compiled with
                 a netcdf library supporting chunking and deflation.
             [-no-w] : do not compute the  mean vertical products.
             [-no-sig] : do not output the mean density on U V points.
             [-no-uv ] : do not  output the mean velocity components.
             [-T ] : computes U and V at T points, so that  U.sig, V.sig will be at
                   at  T point.
             [-depref LST-depht] : give a comma-separated list of reference depths
                   for potential density computation. eg : '-depref  0,2000,3000'
                   If not specified the unique reference depth is  0m (surface).

          REQUIRED FILES :
             mask.nc

          OUTPUT :
            netcdf file : usig.nc, vsig.nc and wsig.nc
            variables : vousig, vovsig, vowsig : mean product v x sigma-0
                                                 at velocity point.
                        vosigu, vosigv, vosigw : mean sigma-0 at velocity point.
                        vozocrtx, vomecrty, vovecrtz : mean velocity components.

# STATISTICS

## cdflinreg

      usage : cdflinreg -l LST-files  [-o OUT-file] [-nc4]

          PURPOSE :
             Compute the linear regression coefficients for a bunch of input files.

          ARGUMENTS :
            -l  LST-files: A blank-separated list of netcdf model file of same kind.

          OPTIONS :
            [-o OUT-file ] : specify name of the output file instead of linreg.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : linreg.nc unless option -o is used.
              variables : for each input variables, there are 3 computed field
                 - slope coefficient
                 - barycenter
                 - Pearson Coefficient

## cdfpdf

      usage :  cdfpdf -f IN-file -v IN-var [-zoom imin imax jmin jmax] ..
            [-lev level] [-range vmin vmax nbin ] [-o OUT-ncfile] [-a OUT-ascfile]

          PURPOSE :
            Build the pdf of a given variable, on a given area, according
            to bin specifications passed as argument of the program. If no
            particular specification is passed to the program, build 100
            bins between minimum and maximum value of the variable.

          ARGUMENTS :
            -f IN-file : input file
            -v IN-var  : variable name

          OPTIONS :
            [-zoom imin imax jmin jmax] : define a sub-area, in model
                                          coordinates
            [-lev level ] : choose a level for pdf computation
                   If not specified, takes level 1.
            [-range vmin vmax nbin  ] : define the limit for binning
                                    and number of bins.
            [-o OUT-file] : specify name for netcdf output file
            [-a ASC-file] : specify name for ascii output file

          REQUIRED FILES :

          OUTPUT :
               (1) ascii file with bin number, value and mean field in bin
               (2) netcdf file for 2d array where x dimension corresponds to bins
                   y dimension corresponds to time, thus the field value being
                   an array count(bin,time). The output file follows the nemo
                   standards, even, if nav_lon, nav_lat are no more longitude or
                   latitude.
                   netdf variable is <IN-var>_pdf

          SEE ALSO :

## cdfrmsssh

      usage : cdfrmsssh -t T-file -t2 T2-file [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the standard deviation of the SSH from its mean value
            its mean square value.

            Note that what is computed in this program is stictly the
            standard deviation. It is very often called RMS, which is
            an abuse. It is the same only in the case of zero mean value.
            However, for historical reason, the name of this tool, remains
            unchanged: cdfrmsssh

          ARGUMENTS :
            -t T-file   : netcdf file with mean values for SSH
            -t2 T2-file : netcdf file with mean squared values for SSH

          OPTIONS :
            [-o OUT-file] : specify the name of the output file instead
                 of default name rms.nc
            [-nc4] : use netcdf4 with chunking and deflation

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : rms.nc unless option -o is used.
              variables : sossheig_rms, same unit than the input.

          SEA ALSO :
            cdfstd, cdfstdevw, cdfstdevts.

## cdfstatcoord

      usage : cdfstatcoord -c COOR-file -m MSK-file [-v MSK-var ]

          PURPOSE :
            Compute and displays statistics about grid metrics vs latitude.
            Bins e1 and e2 by latitude bins, and compute the mean of each bin.

          ARGUMENTS :
            -c COOR-file : coordinates file with e1 e2 metrics
            -m MSK-file  : mask file

          OPTIONS :
            [-v MSK-var] : mask variable name. Default is tmask

          REQUIRED FILES :
            none apart those requested on command line.

          OUTPUT :
            Standard output

## cdfstats

      usage : cdfstats -f IN-file -r REF-file -ncy ncy [-v1 VAR-name1] ...
                  ... [-v2 VAR-name2] [-m MSH-MSK-file ] [-o OUT-file] [-nc4]

          PURPOSE :
              This tool computes some statistics (rms, correlation, signal/noise
              ratio and signal ratio [ratio of std deviation]) between two files.
              In this tool, the files are supposed to hold monthly averages values,
              for many years. Specifying ncy=12, allows to remove the seasonal
              cycle of the data.

              This program was initially written for SSH statistics between model
              output and AVISO files (default variable names are sossheig
              for this reason ). It can now be used with any variables.

          ARGUMENTS :
             -f IN-file  : Model data file.
             -r REF-file : Reference data file (usually observation file)
             -ncy ncy    : ncy can only be 1 or 12. If set to 12, annual cycle is
                      removed  from the data.

          OPTIONS :
             [-v1 VAR-name1] : Variable name in the model file. Default is sossheig.
             [-v2 VAR-name2] : Variable name in the reference file. If not specified
                   assumes that it is the same than in the model file.
             [-m MSH-MSK-file] : specify a mesh_mask file holding the tmaskutil
                   and the horizontal metrics. If this option is not used,
                   mask are taken in mask.nc and horizontal metric
                   is taken in mesh_hgr.nc
             [-o OUT-file] : specify the output file name instead of stats.nc
             [-nc4 ]  : Use netcdf4 output with chunking and deflation level 1.
                   This option is effective only if cdftools are compiled with
                   a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            mask.nc and mesh_hgr.nc
                or mesh_mask file specified in -m option

          OUTPUT :
             netcdf file : stats.nc
              variables are :
                    rms    : RMS between the input files
                    correl : CORREL between the input files
                    rrat   : Signal to noise ratio
                    srat   : Signal ratio (stdev ratio)

## cdfstd

      usage : cdfstd -l LST-files [-save] [-spval0] [-mskmiss] [-opt] ...
                     ... [-o STD-fileout] [-m MEAN-fileout] [-nc4]

          PURPOSE :
            Compute the standard deviation of the variables belonging to a set of
            files given as arguments.  This computation is direct and does not
            required a pre-processing with any of the cdfmoy tools.

          ARGUMENTS :
            -l LST-files : A blank-separated List on netcdf files of the same type,
                    forming a time-series

          OPTIONS :
            [-save ] : Save the mean value of the field, in addition to the
                std deviation.
            [-spval0 ] :  set missing_value attribute to 0 for all output
                variables and take care of the input missing_value.
                This option is usefull if missing_values differ from files
                to files.
            [-mskmiss ] : with this option, the output std and mean are set to
                missing value at any gridpoint where the variable contains a
                missing value for at least one timestep. You should combine
                with -spval0 if missing values are not 0 in all the input files.
            [-opt ]:  use an optimal algorithm to compute std deviation and use an
                unbiased standard deviation estimates.
            [-o STD-fileout]: specify std dev output file name instead of cdfstd.nc
            [-m MEAN-fileout]: specify mean output file name instead of cdfmoy.nc
            [-nc4 ]     : Use netcdf4 output with chunking and deflation level 1.
                This option is effective only if cdftools are compiled with
                a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            - netcdf file : cdfstd.nc
                variables :  IN-var_std, same units than input variables.
            - netcdf file : cdfmoy.nc in case of -save option.
                variables :  IN-var, same units than input variables.

          SEE ALSO :
             cdfmoy, cdfrmsssh, cdfstdevw

## cdfstdevts

      usage : cdfstdevts -t T-file -t2 T2-file [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the standard deviation of the temperature and salinity from
            their mean and  mean squared values.  The mean squared values for T
            and S are not automatically computed with cdfmoy (need some namelist
            modification). Consider using the more generic program 'cdfstd' if
            you do not already have the mean T2 and mean S2.

          ARGUMENTS :
            -t T-file  : netcdf file with mean values for T, S
            -t T2-file : netcdf file with mean squared values for T,S

          OPTIONS :
            [-o OUT-file] : specify output file name instead of stdevts.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                 This option is effective only if cdftools are compiled with
                 a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : stdevts.nc
              variables : votemper_stdev, same unit than the input.
                          vosaline_stdev, same unit than the input.

          SEA ALSO :
            cdfstd, cdfrmsssh, cdfstdevw, cdfstats.

## cdfstdevw

      usage : cdfstdevw -w W-file -w2 W2-file [-v IN-var] [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the standard deviation of the vertical velocity from its mean
            value and its mean square value. If a variable name is given ,then
            the standard deviation of this variable instead of the vertical
            velocity.

          ARGUMENTS :
            -w W-file  : netcdf file with mean values for w or <IN-var>
            -w2 W2-file : netcdf file with mean squared values for w or <IN-var>

          OPTIONS:
             [-v IN-var] : give name of variable if not vovecrtz
             [-o OUT-file] : specify the name of the output file instead of rmsw.nc
             [-nc4 ]   : Use netcdf4 output with chunking and deflation level 1
                   This option is effective only if cdftools are compiled with
                   a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : rmsw.nc (if IN-var specified, output file is rms_var.nc)
              variables : vovecrtz_rms, (or IN-var_rms)  same unit than the input.

          SEE ALSO :
            cdfstd, cdfrmsssh, cdfstdevts, cdfstats.

# SYSTEM

## cdfio

## cdftools

## eos

## modcdfnames

## modpoly

## modutils

# TIME AVERAGING

## cdfmoy

      usage : cdfmoy -l LST-files [-spval0] [-cub] [-zeromean] [-max] [-mskmiss] ...
                 ... [-var VAR-name] [-vvl] [-o OUT-rootname] [-nc4]

          PURPOSE :
            Compute the 'time average' of a list of files given as arguments.
            The program assumes that all files in the list are of same type (shape,
            variables,  etc...). Any file in the list may have many time frames,
            they will be taken into account in the average.

            For some variables, the program also computes the time average of the
            squared variables, which is used in other cdftools (cdfeke, cdfrmsssh,
            cdfstdevw, cdfstddevts...). The actual variables selected for squared
            average are :
              - vozocrtx
              - vomecrty
              - vovecrtz
              - sossheig
            This selection can be adapted with the nam_cdf_namelist process.
            (See cdfnamelist -i for details).

            If you want to compute the average of already averaged files, consider
            using cdfmoy_weighted instead, in order to take into account a
            particular weight for each file in the list.

          ARGUMENTS :
            -l LST-files : A list of similar model output files, whose time average
                           will be computed.

          OPTIONS :
            [-spval0 ] : set missing_value attribute to 0 for all variables and
                    take care of the input missing_value. This option is usefull
                    if missing_values differ from files to files.
            [-cub ] : use this option if you want to compute third order moments
                    for the eligible variables, which are at present :
                     - sossheig
                     - votemper
                   This selection can be adapted with the nam_cdf_namelist process.
                   (See cdfnamelist -i for details).
            [-zeromean ] : with this option, the spatial mean value for each time
                   frame is substracted from the original field before averaging,
                   square averaging and eventually cubic averaging.
            [-max ] : with this option, a file with the minimum and maximum values
                   of the variables (through the list of files) is created.
            [-mskmiss ] : with this option, the output average is set to missing
                   value at any gridpoint where the variable contains a  missing
                   value for at least one timestep. You should combine with option
                   -spval0 if missing values are not 0 in all the input files.
            [-var VAR-name] : Only process VAR-name, instead of all variables.
            [-vvl ] : take into account the time varying vertical scale factor.
            [-o OUT-rootname] : Define output root-name instead of cdfmoy
            [-nc4 ]: Use netcdf4 output with chunking and deflation level 1..
                   This option is effective only if cdftools are compiled with
                   a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            If -zeromean option is used, need mesh_hgr.nc and mask.nc

          OUTPUT :
            netcdf file : cdfmoy.nc and cdfmoy2.nc
            Variables name are the same than in the input files.
            For squared averages '_sqd' is appended to the original variable name.
            If -cub option is used, the file cdfmoy3.nc is also created with
            '_cub' appended to the original variable name.
            If -max option is used, the file cdfmoy_minmax.nc is also created with
            '_max' and '_min' appended to the original variable name.

          SEE ALSO :
            cdfmoy_weighted, cdfstdev

## cdfmoy_freq

      usage : cdfmoy_freq -f IN-file -avg AVG-length [-v3d] [-v4d] [-o OUT-rootname]
                 ... [-nc4]

          PURPOSE :
            This program takes a file covering 1 year of data (evenly spaced) and
            sub-samples the data by performing box averages, which span is given as
            argument. The original data sampling can be hours, days, monthes or
            even seasons.
            The program recognizes leap years, and when feb. 29 is found, it is
            included in the current 'box' (averaging length is thus increased by
            1 day.)

          ARGUMENTS :
            -f IN-file : gives the name of the yearly file containing either 365
                   or 366 days
            -avg AVG-length : Set the time size of the averaging box. Averaging
                   length is specified using XIOS convention (e.g. 1d,5d, 1mo, 1y ;
                   4mo stands for seasonal means )

          OPTIONS :
            [-v3d] : use 3d variable (x,y,t) : save execution time, increase memory
            [-v4d] : use 4d variable (x,y,z,t): save execution time, increase memory
            [-o OUT-rootname] : specify the root of the output file name instead
                        of cdfmoy_. Final name will have <freq> appened
                        to the root.
            [-nc4] : use netcdf4 with chunking and deflation for the output file

          REQUIRED FILES :
             none.

          OUTPUT :
            netcdf file :  cdfmoy_output<freq>.nc
              variables :  same as variables in input file.

          SEE ALSO :
           cdfmoy, cdfmoy_weighted

## cdfmoy_weighted

      usage : cdfmoy_weighted -l LST-files [-old5d ] [-month] [-leap] ...
            ... [-skip variable] [-vvl] [-o OUT-file] [-nc4]

          PURPOSE :
            Compute weighted average of files. The weight for each file is read from
            the iweight variable attribute. In particular, this attribute is set to
            the number of elements used when computing a time average ('cdfmoy').
            A primary application is thus for computing annual mean from monthly
            means.

          ARGUMENTS :
            -l LST-files : The list of files to be averaged, which are supposed to
                  be of the same type and to contain the same variables.

          OPTIONS :
            [-old5d ] : This option is used to mimic/replace the cdfmoy_annual which
                  is no longer available. With this option, 12 monthly files must be
                  given, and it is assumed that the monthly means were computed from
                  5d output of a simulation using a noleap  calendar (weights are
                  fixed, predetermined).
            [-month ] : This option is used to build annual mean from true month
                  output (1mo) in XIOS output for instance.
            [-leap ] : This option has only effect together with the -month option.
                  When used set 29 days in february.
            [-skip variable ] : name of variable to skip, in the input file.
            [-vvl ] : Use time-varying vertical metrics for weighted averages.
            [-o OUT-file] : Specify the name for output file instead of
                cdfmoy_weighted.nc
            [-nc4 ] : Use netcdf4 chunking and deflation in output file.

          REQUIRED FILES :
            none

          OUTPUT :

            netcdf file : cdfmoy_weighted.nc
            variables : same as in the input files

          SEE ALSO :
            cdfmoy, cdfmoyt, cdfmoy_freq

## cdfmoyt

      usage : cdfmoyt -l LST-files [-spval0] [-vvl] [-o OUT-rootname] [-nc4]

          PURPOSE :
            Compute the 'file average' of the files listed on the command line.
            The 'file average' will have the same number of time frame than any
            individual file in the list, the average being done frame by frame.

            The main use of this program is the calculation of a climatological
            average, for instance. It can also be used for the calculation of an
            ensemble mean, although cdfenstat is more appropriate.

            The program assumes that all files in the list are of same type (shape,
            variables, and number of time frames).

            For some variables, the program also computes the 'file average' of the
            squared variables, which is used in other cdftools (cdfeke, cdfrmsssh,
            cdfstdevw, cdfstddevts...). The actual variables selected for squared
            average are :
              - vozocrtx
              - vomecrty
              - vovecrtz
              - sossheig
            This selection can be adapted with the nam_cdf_namelist process.
            (See cdfnamelist -i for details).

          ARGUMENTS :
            -l LST-files: List of files whose average will be computed.

          OPTIONS :
            [-spval0 ] : set missing_value attribute to 0 for all variables and
                   take care of the input missing_value. This option is usefull
                   if missing_values differ from files to files.
            [-vvl] : Use time-varying vertical metrics.
            [-o OUT-rootname] : Define output root-name instead of cdfmoyt
            [-nc4 ]: Use netcdf4 output with chunking and deflation level 1..
                   This option is effective only if cdftools are compiled with
                   a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            none

          OUTPUT :
            netcdf file : cdfmoyt.nc and cdfmoyt2.nc
            Variables name are the same than in the input files.
            For squared averages '_sqd' is appended to the original variable name.

# TRANSPORT

## cdf_xtrac_brokenline

      usage :  cdf_xtrac_brokenline -t T-file -u U-file -v V-file [-i ICE-file] ...
              ... [-b BAT-file] [-mxl MXL-file] [-f section_filei,sec_file2,..] ...
              ... [-l LST-sections] [-ssh] [-mld] [-vt] [-vecrot] [-vvl W-file] ...
              ... [-o ROOT_name] [-ice] [-verbose]

          PURPOSE :
           This tool extracts model variables from model files for a geographical
           broken line, similar to an oceanographic campaign where an oceanic
           section is formed by one or more legs.

           The broken line is specified by the position of ending points of each
           leg, given in an ASCII file. OVIDE section is taken as default, when no
           section file is provided.

           This tool provides a netcdf file similar to a model file, but with a
           degenerated 'y' dimension (1). In order to be able to use standard
           CDFTOOLS, relevant metric variables are saved into the output file, such
           as pseudo e1v and e3v and vmask. Therefore the output file can be
           considered as a mesh_hgr, mesh_zgr and mask file for any 'meridional'
           computation. In the relevant CDFTOOLS, the option '-self' tells the
           program that input data file can be considered as mesh_mask file as well.

           This tools works with temperatures, salinities and normal velocities.
           The broken line is approximated in the model, by a succession of segments
           joining F-points. The velocity is taken as either U or V depending on the
           orientation of the segment, temperatures and salinities are interpolated
           on the velocity points. When progressing along the broken line, normal
           velocity is positive when heading to the right of the progression.

           The barotropic transport across the broken line is computed, using the
           same sign convention. On a closed broken line, the barotropic transport
           should be very small.

          ARGUMENTS :
            -t T-file :  model gridT file
            -u U-file :  model gridU file
            -v V-file :  model gridV file

          OPTIONS :
           [-l LST-sections ] : provides a blank-separated list of files for section
                   definitions. Section_file is an ascii file as follows :
                    * line #1 : name of the section (e.g. ovide).
                         Will be used for naming the output file.
                    * line #2 : number of points defining the broken line.
                    * line #3-end : a pair of Longitude latitude values defining
                         the points. If not supplied, use hard-coded information
                         for OVIDE section. A comment can be added at the end of
                         of the lines, using a # as separator
           [-f section_file1,section_file2,...] : provide a comma-separated list of
                   files for section definition. This option will be deprecated in
                   favor of '-l' option, which passes the same file names, but
                   easier to parse when using a big number of files.
           [-b BAT-file] : Specify a bathymetric file in case the ocean bathymetry
                   is not in mesh_zgr.nc (variable hdepw).
           [-mxl MXL-file] : Give the name of the file containing the MLD if it is
                   not in T-file.
           [-verbose] : increase verbosity
           [-ssh]     : also save ssh along the broken line.
           [-mld]     : also save mld along the broken line.
           [-i ICE-file] : also save ice properties (concentration, thickness)
                  extracted from ICE-file along the broken line.
           [-vt]      : also save products vt and vs along the broken line.
           [-vvl W-file]  : use time-varying vertical metrics. Specify a W-file in
                  order to read  time-varying e3w needed in the computation of
                  depu3d.
           [-o ROOT-name]: specified the prefix to be used for the output file name.
                  Note that it may be a good idea to include a separator character
                  such as '_' at the end of the ROOT_name.
           [-vecrot] : also save normal and tangent velocities along the broken line
                  (for plots purpose only).

          REQUIRED FILES :
            mesh_hgr.nc and mesh_zgr.nc in the current directory

          OUTPUT :
            netcdf file : <section_name>.nc (default). If -o option is used, the
                  name will be <ROOT-name><section_name>.nc
              variables : temperature, salinity, normal velocity, pseudo V metrics,
                  mask, barotropic transport, bathymetry of velocity points.
                  Additional variables can be set when using options.
            ASCII file : <section_name>_section.dat usefull for cdftransport, gives
                  the position in I,J of the geographical input points.

          SEE ALSO :
             cdftransport, cdfmoc, cdfmocsig. This tool replaces cdfovide.

## cdfisopsi

      usage :  cdfisopsi -ref REF-level -sig TGT-sigma -f T-file [-o OUT-file]...
               ... [-nc4] [-vvl]

          PURPOSE :
            Compute a 'geostrophic streamfunction', projected on an isopycn.
            In this program, temperature and salinities on the selected isopync
            are saved, as well as the depth of the isopycnal surface.
            Then the specific volume anomaly at each model level  (1/rho0 -1/rho)
            is integrated from top to isopycnal surface. The resulting 3D field
            is finally projected (and normalized) on the isopycnal surface.

          ARGUMENTS :
             -ref REF-level: reference level for pot. density.
             -sig TGT-sigma: target density level to project on.
             -f T-file : input file for temperature and salinity.

          OPTIONS :
             [-o OUT-file ]: specify output filename instead of isopsi.nc
             [-nc4 ]     : Use netcdf4 output with chunking and deflation level 1.
                      This option is effective only if cdftools are compiled with
                      a netcdf library supporting chunking and deflation.
             [-vvl ] : use time varying vertical metrics.

          REQUIRED FILES :
            mesh_hgr.nc and mesh_zgr.nc

          OUTPUT :
            netcdf file : isopsi.nc unless -o option is used.
              7 variables :
                 votemper_interp : Temperature interpolated on isopycnal layer
                 vosaline_interp : Salinity interpolated on isopycnal layer
                 depth_interp    : Depth of the isopycnal layer
                 soisopsi        : Total streamfunction on the isopycnal layer
                 soisopsi1       : Contribution of the SSH
                 soisopsi2       : Contribution of specific volume anomaly vertical
                                   integration
                 soisopsi3       : Contribution of pressure term on the isopycnal
                                   layer

          SEE ALSO :
            cdfhdy

## cdfmaxmoc

      usage : cdfmaxmoc -f OVT-file -b BASIN-name -w latmin latmax depmin depmax ...
                      ... [-o OUT-file]

          PURPOSE :
             Compute the maximum and minimum of the overturning, from OVT-file,
             for the specified oceanic basin, and in the geographical window
             defined with '-w' option as a range of latitudes and depths.

          ARGUMENTS :
             -f OVT-file   : overturning file from cdfmoc, with or w/o sub basins.
             -b BASIN-name : name of oceanic subbasin as defined in new_maskglo.nc
                     usually it can be one of atl, glo, inp, ind or pac. glo means
                     no subbasins.
             -w latmin latmax depmin depmax : specify the geographical window in
                     maximum and minimum of the overturning will be computed:
                         latmin latmax : limits in latitudes (deg N).
                         depmin depmax : limits in depths (meters).

          OPTIONS :
             [-o OUT-file] : specify the output file name instead of maxmoc.nc

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : maxmoc.nc
              6 variables :
                 maxmoc, minmoc ( sv )      : max and min of overturning
                 latmaxmoc latminmoc ( deg) : latitudes of max and min.
                 depmaxmoc depminmoc ( m)   : depth of max amd min .

          SEE ALSO :
            cdfmoc

## cdfmhst

      usage : cdfmhst  -vt VT-file | (-v V-file -t T-file [-s S-file]) [-MST] ...
                   ... [-b BASIN-mask] [-full] [-Zdim] [-o OUT-file] [-vvl]

          PURPOSE :
            Compute the meridional heat/salt transport as a function of latitude.
            If the basin mask-file new_maskglo.nc is provided, the meridional
            heat/salt transport for each sub-basin is also computed.

            This program is designed to read the time-average products V.T into
            the corresponding VT-file (produced by cdfvT). If VT-files are not
            available, or if working with model snapshot, V-file and T-file can
            be specified as an alternative.

            In the evaluation of the 'meridional' component, a 'zonal' integration
            is performed. Note that in CDFTOOLS, as far as 'zonal' integrals
            are concerned, they in-fact correspond to 'along-model I' integrals.

          ARGUMENTS :
            -vt VT-file  : netcdf file containing the mean value of the products
                       U.S, U.T, V.S and V.T (obtained with cdfvT).
              or
            -v V-file  : specify V-file
            -t T-file  : specify T-file
            If not using '-vt' option, both V-file and T-file MUST be specified.

          OPTIONS :
            [-s S-file] : specify S-file (salinity) if the salinity field is not in
                   T-file.
            [-MST ]   : Indicates the the meridional Salt transport will also be
                   computed.  If not specified, only the MHT is output.
            [-full ] : to be set for full step case.
            [-Zdim ] : to be set to output vertical structure of Heat/salt transport
            [-b BASIN-mask ] : use BASIN-mask instead of default new_maskglo.nc
            [-o OUT-file ] : change name of the output file. Default:mhst.nc
            [-vvl ] : use time-varying vertical metrics.

          REQUIRED FILES :
             mesh_hgr.nc, mesh_zgr.nc and mask.nc
             If new_maskglo.nc is also available, sub-basin meridional transports
             are also computed.

          OUTPUT :
            ASCII files : zonal_heat_trp.dat : Meridional Heat Transport
                          zonal_salt_trp.dat : Meridional Salt Transport
            netcdf file : mhst.nc unless -o option is used.
                variables : ( [... ] : -MST option )
                            zomht_glo  : Meridional Heat Transport (global)
                          [ zomst_glo  : Meridional Salt Transport (global) ]
            If new_maskglo.nc is available, per basin meridional transport
            are also available:
                            zomht_atl  : Meridional Heat Transport
                          [ zomst_atl  : Meridional Salt Transport ]

                            zomht_inp  : Meridional Heat Transport
                          [ zomst_inp  : Meridional Salt Transport ]

                            zomht_ind  : Meridional Heat Transport
                          [ zomst_ind  : Meridional Salt Transport ]

                            zomht_pac  : Meridional Heat Transport
                          [ zomst_pac  : Meridional Salt Transport ]

                            zomht_inp0 : Meridional Heat Transport
                          [ zomst_inp0 : Meridional Salt Transport ]

## cdfmht_gsop

      usage :  cdfmht_gsop -v V-file -t T-file [-o OUT-file]

          PURPOSE :
            Compute the meridional heat transport(MHT) for the Atlantic basin.
            Compute 3 components of the MHT :
               - Barotropic component
               - Vertical shear geostrophic component
               - Vertical shear ageostrophic component (Ekman + residual)

          REMARKS :
            This program has been ported to CDFTOOLS4, without major changes.
            It should work as before but is not optimized for memory (lot of
            3D arrays declared).

          ARGUMENTS :
            -v V-file : name of the meridional velocity file.
            -t T-file : name of the temperatture file.

          OPTIONS :
            [-o OUT-file] : output file name instead of gsopmht.nc

          REQUIRED FILES :
            mesh_hgr.nc, mesh_zgr.nc and new_maskglo.nc

          OUTPUT :
            netcdf file : gsopmht.nc
              variables :  zomhtatl  : MHT Atlantic Ocean
                           zobtmhta  : Barotropic component
                           zoshmhta  : Vertical shear geostrophic component
                           zoagmhta  : vertical shear ageostrophic component

          SEE ALSO :
            cdfmhst (compute MHT without decomposition), cdfmoc

## cdfmoc

      usage : cdfmoc  -v V-file  [-decomp] [-rapid] [-t T-file] [-s S-file] ...
                       ... [-u U-file] [-full] [-vvl ] [-o OUT-file]

          PURPOSE :
            The primary purpose of this tool is to compute the MOC for oceanic
            sub-basins as described in new_maskglo.nc. If this sub-basins
            file is not found, then only computes the global MOC.

            The option '-decomp' was developped in order to decompose the MOC
            into its 3 components : Geostrophic, Barotropic and Ageostrophic.

            With the option '-rapid', the model MOC at the latitude of the RAPID
            section (26.5 N) is evaluated in the same manner as it is done with
            observations of the RAPID MOCHA array, (see details below).

          REFERENCES :
             - MOC decomposition:
               Lee & Marotzke (1998), Baehr, Hirschi, Beismann &  Marotzke (2004),
               Cabanes, Lee, & Fu (2007), Koehl & Stammer (2007).
             - RAPID MOCHA array evaluation:
               See :   http://www.rapid.ac.uk

          ARGUMENTS :
            -v V-file : file with meridional velocity component (mandatory).

          OPTIONS :
            [-decomp ] : decompose MOC in 3 components: Geostrophic, Barotropic and
                      Ageostrophic. For this option temperatures and salinity are
                      needed (for density calculation), hence T-file/S-file.
            [-rapid ] : Compute the AMOC at 26.5 N in the same manner than the
                      RAPID MOCHA array, separating the Gulfstream transport and the
                      contribution of different water masses :
                        - 0-800m      : Thermocline recirculation
                        - 800-1100m   : AIW recirculation
                        - 1100-3000m  : upper-NADW recirculation
                        - 3000-5000m  : lower-NADW recirculation
                        - 5000-bottom : AABW recirculation
            [-t T-file] : file with temperature and salinity. Required for
                    '-decomp' and '-rapid' options.
            [-s S-file]:  Specify a salinity only file if the salinity is not
                     available in T-file.  Required for  '-decomp' and
                    '-rapid' options.
            [-u U-file]:  Specify the U-file (zonal wind-stress), required only for
                     '-rapid' option, for the evaluation of Ekman transport.
            [-full ] : use full step instead of default partial step
            [-vvl  ] : Use time-varying vertical metrics
            [-o OUT-file] : specify output file instead of moc.nc

          REQUIRED FILES :
            Files mesh_hgr.nc mesh_hgr.nc and mask.nc
            File new_maskglo.nc. If this latter file is not available
                  only the MOC for the global domain is computed

          OPENMP SUPPORT : yes

          OUTPUT :
            netcdf file : moc.nc
            variables zomsfglo : Global ocean
            variables zomsfatl : Atlantic Ocean
            variables zomsfinp : Indo Pacific
            variables zomsfind : Indian Ocean alone
            variables zomsfpac : Pacific Ocean alone
            variables zomsfinp0 : Indo Pacific Net

            If decomposition is required , ( option -decomp ) add 3 additional
            variables per basin with suffixes _sh, _bt, _ag.

            If option -rapid is used the output file (rapid_moc.nc) is degenerated
            into 6 scalar values : tr_gs, tr_THERM, tr_AIW, tr_UNADW, tr_LNADW,
            tr_BW and a vertical profile of the AMOC at 26.5N, as computed
            traditionally.
            Additional variables are also computed following CLIVAR-GODAE
            reanalysis intercomparison project recommendations.

## cdfmocsig

      usage : cdfmocsig  -v V-file -t T-file -r REF-depth | -ntr [-eiv] [-full] ...
             ... [-sigmin sigmin] [-sigstp sigstp] [-nbins nbins] [-isodep] ...
             ... [-o OUT-file] [-vvl] [-verbose]

          PURPOSE :
            Compute the MOC in density-latitude coordinates. The global value is
            always computed. Values for oceanic sub-basins are calculated if the
            new_maskglo.nc file is provided.

            The reference depth for potential density is given with '-D' option.
            Density ranges and number of bins to use are pre-defined only for three
            reference depth (0, 1000 and 2000 m). For other reference depth, the
            density binning must be specified using the relevant options for setting
            the minimum density, the density step and the number of bins to use.

          ARGUMENTS :
             -v V-file  : Netcdf gridV file.
             -t T-file  : Netcdf gridT file.
             -r ref-depth : reference depth for density.
                 For depth values of 0 1000 or 2000 m, pre-defined limits for
                 minimum density, number of density bins and width of density
                 bins are provided. For other reference depth, you must use the
                 options '-sigmin', '-sigstp' and '-nbins' (see below).
             or
             -ntr : uses neutral density (no default bin defined so far), no '-r'

          OPTIONS :
            [-eiv ] : takes into account VEIV Meridional eddy induced velocity.
                      -> To be used only if Gent and McWilliams parameterization
                         has been used.
            [-full       ] : Works with full step instead of standard partial steps.
            [-sigmin     ] : Specify minimum of density for bining.
            [-sigstp     ] : Specify density step for bining.
            [-nbins      ] : Specify the number of density bins you want.
            [-isodep     ] : Compute the zonal mean of isopycnal depths used for
                             mocsig.
            [-o OUT-file ] : Specify output file name instead of mocsig.nc
            [-vvl        ] : Use time-varying vertical metrics.
            [-verbose    ] : Verbose option for more info during execution.

          REQUIRED FILES :
             Files mesh_zgr.nc, mesh_hgr.nc, mask.nc
             File new_maskglo.nc is optional [sub basins masks]

          OPENMP SUPPORT : yes

          OUTPUT :
            netcdf file : mocsig.nc
            variables zomsfglo : Global ocean
            variables zomsfatl : Atlantic Ocean
            variables zomsfinp : Indo Pacific
            variables zomsfind : Indian Ocean alone
            variables zomsfpac : Pacific Ocean alone
            If file new_maskglo.nc is not present, mask.nc file is used and
            only zomsfglo is produced.
            If option -isodep is used, each MOC variable is complemented by a iso
            variable, giving the zonal mean of ispycnal depth (e.g.zoisoglo).

          SEE ALSO :
            cdfmoc

## cdfpsi

      usage : cdfpsi -u U-file -v V-file [-V] [-full] [-mask] [-mean] [-nc4] ...
               ... [-ssh T-file] [-open] [-ref iref jref] [-o OUT-file] [-vvl] ...
               ... [-lev]

          PURPOSE :
            Compute the barotropic stream function (a proxy) as the integral of
            the transport. It is a proxy, as far as the flow in not strictly non-
            divergent.

          ARGUMENTS :
            -u U-file  : netcdf file of zonal velocity.
            -v V-file  : netcdf file of meridional velocity.

          OPTIONS :
            [-V ] : use V field instead of U field for integration.
            [-full ] : indicates a full step case. Default is partial steps.
            [-mask ] : mask output fields. Note that the land value is significant.
                   It correspond to the potential on this continent.
            [-mean ] : save the average of the computations done with U and V.
            [-ssh T-file ] : compute the transport in the 'ssh' layer, using
                   surface velocities. Take the ssh from T-file specified in this
                   option. This is an experimental option, not certified ...
            [-open ] : for open domain configuration. See also -ref to set
                   reference point.
            [-ref iref jref ] : Set the reference point in i,j coordinates. BSF at
                   reference point is arbitrarly set to zero.
            [-o  OUT-file ] : specify output file name instead of default psi.nc
            [-nc4  ] : use netcdf4 output files with chunking and deflation
            [-vvl  ] : use time-varying vertical metrics
            [-lev] : This option is still experimental. It has been added to cdfpsi
                 in order to mimic former 'cdfpsi_level', now removed.
                 With this option, integral of transports is saved at every level,
                 giving a 'pseudo' stream-function. It works only for global
                 configurations, so far.

          REQUIRED FILES :
            mesh_hgr.nc and mesh_zgr.nc.
            mask.nc is required only if -mask option used.

          OUTPUT :
            netcdf file : psi.nc
              variables : sobarstf (m3/s )
            If option -ssh is used, 2 additional variables are added to the file :
                          sobarstfssh (m3/s ) : contribution of SSH
                          sobarstftotal (m3/s ) : total BSF

## cdfsigtrp

      usage :  cdfsigtrp -t T-file -u U-file -v V-file [-brk BRK-file] ...
                   ... -smin sigma_min -smax sigma_max -nbins nbins [-print] ...
                   ... [-xtra] [-full ] [-vvl W-file] [-refdep ref_depth] ...
                   ... [-neutral ] [-section file ] [-temp] [-help]

          PURPOSE :
            Compute density class transports, according to the density class
            definition (minimum, maximum and number of bins) given in arguments.

            Sections information are read from the file dens_section.dat
            which is a text file built  with pairs of lines giving: (1) section name
            and (2) section location.
            First line with section name may also have 2 additional strings holding
            a prefix for variable output, and a long name to be used as attribute in
            the output file.
            Second line gives the location of the section with specification of four
            integer values (imin imax jmin jmax), relative to the model grid.
            Only  zonal or meridional sections are allowed.

            This program also offer the possibilty to read 'broken-line' files,
            holding already extracted data along a pseudo zonal section. In this
            particular case, ('-brk' switch), no additional information about the
            section is required, nor metric files, as it is already available in the
            input file.

            This program can also be used to compute transport by temperatures
            classes, provided the temperatures decrease monotonically downward.
            In this case, use -temp option and of course specify sigma_min,
            sigma_max as temperatures.

          ARGUMENTS :
            Input data file can be specified either using the 3 following switches:
            -t T-file : netcdf file with temperature and salinity
            -u U-file : netcdf file with zonal velocity component
            -v V-file : netcdf file with meridional velocity component
            Or, using the '-brk' switch.
             -brk BRK-file : specify a 'broken-line' file produced by the tool
                   cdf_xtrac_brokenline, which is considered already as a pseudo
                   zonal section, holding all the relevant metrics for the section.

            -smin sigma_min : minimum density for binning
            -smax sigma_max : maximum density for binning
            -nbins nbins : number of bins. This will fix the bin 'width'

          OPTIONS :
            [-full] : for full step configuration
            [-vvl W-file]: use time varying vertical metrics. Need a W-file for e3w.
            [-xtra] : produce extra netcdf output file which shows the details
                    of the sections (normal velocity, density, temperature,
                    salinity, transports, isopycnal depths.
            [-print]: write the binned transports on standard output, for each
                    sections.
            [-refdep ref_depth ]: give a reference depths for the computation of
                    potential density. Sigma_min, sigma_max must be adapted
                    accordingly.
            [-neutral]: use neutral density instead of potential density
            [-section file] : give the name of section file.
                    Default is dens_section.dat
            [-temp] : use temperature instead of density for binning
            [-help] : give commented example for the section file.

          REQUIRED FILES :
            mesh_hgr.nc, mesh_zgr.nc and dens_section.dat
              If option '-brk' is used, there is no need for these files, the
              metrics being already embarked into this section file.

          OUTPUT :
            Netcdf file : There is 1 netcdf file per section. File name is build
              from section name : Section_name_trpsig.nc
              variables : sigma_class (upper limit of the bin)
                          sigtrp : transport (Sv per bin)

            ascii file  : trpsig.txt

           Standard output : the results are written on standard output only if
              the -print option is used.

          SEE ALSO :
           cdfrhoproj, cdftransport, cdfsigintegr

## cdfsigtrp_broken

      usage :  cdfsigtrp_broken -f BRK-file -bin sigma_min sigma_max nbins ...
                   ... [-print ] [-full ] [ -refdep ref_depth] ...
                   ... [-neutral ] [-section file ] [-temp ]

          PURPOSE :
            Compute density class transports, according to the density class
            definition ( minimum, maximum and number of bins) given in arguments.
            Section position are given in dens_section.dat, an ASCII file
            with pairs of lines giving section name and section location as
            imin imax jmin jmax. Only zonal or meridional section are allowed.
            The name of this file can be specified with the -section option, if
            it differs from the standard name. Optionaly, a netcdf root variable
            name and a netcdf root long-name can be provided on the line giving
            the section name.
            In this particular tool, the section used is the result of
            cdf_xtrac_brokenline. In this way, it is possible to calculate the
            transport of density class in oblicous sections (non dependance on
            zonal or meridional).

            This program can also be used to compute transport by class of
            temperatures, provided the temperatures decrease monotonically
            downward. In this case, use -temp option and of course specify
            sigma_min, sigma_max as temperatures.

          ARGUMENTS :
            -f BRK-file : netcdf_broken_line file with temperature, salinity
                        and the normal velocity through the section + some
                        usefull metrics.
            -bin  sigma_min sigma_max nbins : 3 values follow -bin switch :
                    sigma_min : minimum density for binning
                    sigma_max : maximum density for binning
                    nbins : number of bins. This will fix the bin 'width'

          OPTIONS :
            [-full ] : for full step configuration
            [-ncdf ] : produce extra netcdf output file which shows the details
                    of the sections (normal velocity, density, temperature,
                    salinity, transports, isopycnal depths.
            [-print ]: write the binned transports on standard output, for each
                    sections.
            [-refdep ref_depth ]: give a reference depths for the computation of
                    potential density. Sigma_min, sigma_max must be adapted
                    accordingly.
            [-neutral ]: use neutral density instead of potential density
            [-section file] : give the name of section file.
                    Default is dens_section.dat
            [-temp ] : use temperature instead of density for binning

          REQUIRED FILES :
            mesh_zgr.nc and dens_section.dat

          OUTPUT :
            Netcdf file : There is 1 netcdf file per section. File name is build
              from section name : Section_name_trpsig.nc
              variables : sigma_class (upper limit of the bin)
                          sigtrp : transport (Sv per bin)

            ascii file  : trpsig.txt

           Standard output : the results are written on standard output only if
              the -print option is used.

          SEE ALSO :
           cdfrhoproj, cdftransport, cdfsigintegr, cdfsigtrp, cdf_xtrac_brokenline

## cdftransig_xy3d

      usage : cdftransig_xy3d -c CONFIG-CASE -l LST-tags [-code code ] ...
                         ... [-depref depref ] [ -nbins nbins ] ...
                         ... [-sigmin smin s-scal] [-sigzoom sminr s-scalr ] ...
                         ... [-full ] [-v ] [-vvl ] [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the time average volume transport at each grid cell in density
            space, for the list of tags given as arguments. Results must be
            condidered as intermediate for further integration.

          ARGUMENTS :
            -c CONFCASE  : a DRAKKAR CONFIG-CASE name
            -l LST-tags : a blank-separated list of time tags to be processed.

          OPTIONS :
            [-code code ] : code corresponds to pre-defined parameters settings
                   in term of reference depths, density limits for  binning, number
                    of bins, deeper layer refinement.
               AVAILABLE code are :
                   _______________________________________________________________
                   code     |  depth_ref nbins   smin  s-scal  szoommin szoom-scal
                   ---------------------------------------------------------------
                     0      |    0      101     23.0    0.05
                   1000     |   1000     93     24.2    0.10   32.3     0.05
                   1000-acc |   1000     88     24.5    0.10
                   2000     |   2000    174     29.0    0.05
                   none     |  parameters must be set individually
                   ---------------------------------------------------------------
               DEFAULT code is : 1000
                   For other setting use the options to specify the settings
                   individually.
            [-depref depref ] : give the depth reference for potential density
            [-nbins nbins ] : give the number of density bins.
            [-sigmin smin s-scal ] : give the minimum of density for binning and
                   the bin width.  ( take care of the reference depth).
            [-sigzoom sminr s-scalr ] : allow density refinement from sminr, with
                   s-scalr bin width.
            [-full ] : indicate a full step configuration.
            [-v ] : verbose mode : extra print are performed during execution.
            [-vvl ] : use time-varying vertical metrics.
            [-o OUT-file ] : specify output file name instead of uvxysig.nc
            [-nc4 ] : Use netcdf4 output with chunking and deflation level 1.
                    This option is effective only if cdftools are compiled with
                    a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
            mesh_hgr.nc and mesh_zgr.nc

          OUTPUT :
            netcdf file : uvxysig.nc unless -o option is used.
              variables : vouxysig and vovxysig in m3/s.

          SEE ALSO :
           cdfrhoproj, cdfsigtrp

## cdftransport

      usage : cdftransport -u U-file -v V-file [-t T-file] [-vt VT-file] ...
                       ... [-test  u v ] [-noheat ] [-pm ] [-obc] [-TS] ...
                       ... [-full] [-time jt] [-vvl] [-self] ...
                       ... [-zlimit dep_list] [-sfx suffix]

         PURPOSE :
           Compute the transports (volume, heat and salt) accross a section.
           The name of the section and the imin, imax, jmin, jmax for the section
           is read from the standard input. To finish the program use the key name
           'EOF' for the section name. It may be usefull to use the syntax :
           'cdftransport [..options.. ] < section_file.txt'. Section corresponds
           to a line between 2 F-points A(imin, jmin) and B(imax,jmax). The order
           of the points does matter: when travelling from A to B, transports to
           the right are positive, transports to the left are negative.
           OBC U,V files can be used if -obc option is specified.
           Extracted broken lines files can also be used with option -self.

          ARGUMENTS :
           -u U-file  : netcdf file with the zonal velocity component.
           -v V-file  : netcdf file with the meridional velocity component.

          OPTIONS :
           [-vt VT-file]: netcdf file with mean values of vt, vs, ut, us for heat
                         and salt transport. This option is mandatory unless
                         -noheat option is used.
           [-t T-file]: Temperature and Salinity file used with -TS option.
           [-test u v]: use constant the u and v velocity components for sign
                         test purpose.
           [-noheat ] : use when heat and salt transport are not requested.
           [-pm ]     : separate positive and negative contribution to
                         the volume transport. This option implicitly set -noheat,
                         and must be used before the file names.
           [-obc ]    : indicates that input files are obc files (vertical slices)
                        Take care that for this case, mesh files must be adapted.
                        This option implicitly set -noheat, and must be used before
                        the file names.
           [-TS ]     : Indicate that UT VT US VS will be recomputed from T U V
                        files. In this case use -t T-file option.
           [-full ]   : use for full step configurations.
           [-time jt ]: compute transports for time index jt. Default is 1.
           [-vvl  ]   : use time varying  vertical metrics e3 read in the data file
           [-zlimit dep_list] : Specify a list of depth (meters) defining the
                        limits of classes for which transports will be computed.
                        If not used, the transports are computed for the whole water
                        column. Example : -zlimit 500 1000 creates 3 classes :
                                0-500
                              500-1000
                             1000-bottom
           [-self ] : This option indicates that input files corresponds to a
                       broken line, hence  data files hold the metrics. In this
                       case, the input file is considered as a V-file, and must
                       specified with -v option.
           [-sfx suffix] : use suffix instead of transport in the netcdf
                       output file.

          REQUIRED FILES :
           Files mesh_hgr.nc, mesh_zgr.nc must be in the current directory.
                 unless -self option is used.

          OUTPUT :
           - Standard output
           - ASCII file reflecting the standard output: section_<SUFFIX>.dat
           - ASCII files for volume, heat and salt transport: v<SUFFIX>.txt,
               h<SUFFIX>.txt and s<SUFFIX>.txt.
           - Netcdf files for each section. <SECTION>_<SUFFIX>.nc.
             Default <SUFFIX> is transport and can be changed with -sfx option.

          SEE ALSO :
            cdfsigtrp cdf_xtrac_brokenline

## cdfvFWov

      usage : cdfvFWov -v V-secfile -s S-secfile -zgr ZGR-secfile -hgr HGR-secfile
                       ... -msk MSK-secfile [-o OUT-file] [-vvl]

          PURPOSE :
             Compute the fresh water transport and its overturning component through
             a section specified by the input files (data and metrics).

             All input files corresponds to a zonal extraction holding 2 rows of
             data. In fact the 2 rows are needed for the salinity to be interpolated
             on the V-points.

          ARGUMENTS :
             All arguments are 'section files', which are assumed to be files with
             2 zonal lines of data ( j and j+1 ):
            -v V_secfile   : meridional velocity section file.
            -s S_secfile   : salinity section file.
            -zgr ZGR_secfile : mesh_zgr section file
            -hgr HGR_secfile : mesh_hgr section file
            -msk MSK_secfile : mask section file

          OPTIONS :
            [-o OUT-file] : specify output file name instead of vFWov.nc
            [-vvl] : use time-varying vertical metrics.

          REQUIRED FILES :
             none

          OUTPUT :
            netcdf file : vFWov.nc unless option -o is used.
            variables : netvFW, totvFW, ovFW
            Output file only has time relevant dimension. Other dims are set to 1.
            Degenerated dimensions can be removed with :
                ncwga -a x,y,depthw vFWov.nc -o out.nc

## cdfvhst

      usage : cdfvhst  -f VT-file [-full] [-vvl] [-o OUT-file] [-nc4]

          PURPOSE :
              Compute the vertically integrated heat and salt transports
              at each grid cell. In other words, it is the vertical integral
              of the VT-file.

          ARGUMENTS :
              -f VT-file : file which contains UT, VT, US, VS quantities
                   (produced by cdfvT.f90)

          OPTIONS :
              [-full ] : use full step computation (default is partial steps).
              [-vvl  ] : use time-varying vertical metrics.
              [-o OUT-file ] : specify output file name, instead of trp.nc
              [-nc4  ] : use netcdf4 chunking and deflation.

          REQUIRED FILES :
              Files mesh_hgr.nc, mesh_zgr.nc

          OUTPUT :
              Netcdf file : trp.nc unless -o option is used.
              Variables : somevt, somevs, sozout and  sozous

## cdfvtrp

      usage : cdfvtrp -u U-file -v V-file [-full] [-bathy] [-vvl] ...
                    ... [-o OUT-file] [-nc4]

          PURPOSE :
            Compute the vertically integrated transports at each grid cell.

          ARGUMENTS :
            -u U-file : netcdf gridU file
            -v V-file : netcdf gridV file

          OPTIONS :
            [-full ]  : To be used in case of full step configuration.
                     Default is partial steps.
            [-bathy ] : When used, cdfvtrp also compute the along slope and cross
                     slope transport components.
                     Bathymetry is read from mesh_zgr.nc file.
            [-vvl  ] : Use time-varying vertical metrics
            [-o OUT-file  ] : specify output file name instead of trp.nc
            [-nc4 ]     : Use netcdf4 output with chunking and deflation level 1.
                     This option is effective only if cdftools are compiled with
                     a netcdf library supporting chunking and deflation.

          REQUIRED FILES :
             mesh_hgr.nc and mesh_zgr.nc
             mask.nc is required only with -bathy option.

          OUTPUT :
            netcdf file : trp.nc
            variables :
                sozoutrp : zonal transport.
                somevtrp : meridional transport.
               If option -bathy is used :
                soastrp : along slope transport
                socstrp : cross slope transport

# AUTHORS

Project headed by Jean-Marc Molines, (IGE, Grenoble - France)

Contributors (alphabetic order ) : C.Q. Akuetevi, M. Balmaseda, E. Behrens, F. Castruccio, M. Chekki, P. Colombo, J. Deshayes, N. Djath, N. Ducousso, C. Dufour, R. Dussin, N. Ferry, F. Hernandez, M. Juza, A. Lecointre, S. Leroux, C. Lique, x G. Mainsant, P. Mathiot, A. Melet, X. Meunier, G. Moreau, N. Merino, W. Rath, J. Regidor, M. Scheinert, A.M. Treguier

# LICENSE AND COPYRIGHT

Copyright (C) 1998-2016 IGE-MEOM (Jean-Marc.Molines@univ-grenoble-alpes.fr )

This software is governed by the CeCILL license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".

As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.

In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security.

The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms.