@BeginModule
@NewPage
@Name      = Gradsdes
@Title     = GrADS data descriptor file
@Section   = Miscellaneous
@Arguments = ifile
@Operators = gradsdes
@EndModule


@BeginOperator_gradsdes
@Title     = GrADS data descriptor file
@Parameter = [mapversion]

@BeginDescription
Creates a @ref{GrADS} data descriptor file. Supported file formats are GRIB1, NetCDF, SERVICE, 
EXTRA and IEG. For GRIB1 files the GrADS map file is also generated. For SERVICE and EXTRA
files the grid have to be specified with the CDO option '-g <grid>'. This module takes @file{ifile}
in order to create filenames for the descriptor (@file{ifile.ctl}) and the map (@file{ifile.gmp}) file.
@EndDescription
@EndOperator

@c @BeginOperator_gradsdes
@c @Title     = GrADS data descriptor file (version 2 GRIB map)
@c 
@c @BeginDescription
@c Creates a GrADS data descriptor file. Generated a machine 
@c independent version 2 GrADS map file for GRIB1 datasets.
@c This map file can be used only with GrADS version 1.8 or newer. 
@c @EndDescription
@c @EndOperator


@BeginParameter
@Item = mapversion
INTEGER  Format version of the GrADS map file for GRIB1 datasets. Use 1 for a machine
specific version 1 GrADS map file, 2 for a machine independent version 2 GrADS map file
and 4 to support GRIB files >2GB. 
A version 2 map file can be used only with GrADS version 1.8 or newer.
A version 4 map file can be used only with GrADS version 2.0 or newer.
The default is 4 for files >2GB, otherwise 2.
@EndParameter


@BeginExample
To create a GrADS data descriptor file from a GRIB1 dataset use:
@BeginVerbatim
   cdo gradsdes ifile.grb
@EndVerbatim
This will create a descriptor file with the name @file{ifile.ctl} and the map file @file{ifile.gmp}.

Assumed the input GRIB1 dataset has 3 variables over 12 timesteps on a Gaussian N16 grid.
The contents of the resulting GrADS data description file is approximately:
@BeginListing
   DSET  ^ifile.grb
   DTYPE  GRIB
   INDEX  ^ifile.gmp
   XDEF 64 LINEAR 0.000000 5.625000
   YDEF 32 LEVELS -85.761 -80.269 -74.745 -69.213 -63.679 -58.143
                  -52.607 -47.070 -41.532 -35.995 -30.458 -24.920
                  -19.382 -13.844  -8.307  -2.769   2.769   8.307
                   13.844  19.382  24.920  30.458  35.995  41.532
                   47.070  52.607  58.143  63.679  69.213  74.745
                   80.269  85.761
   ZDEF 4 LEVELS 925 850 500 200
   TDEF 12 LINEAR 12:00Z1jan1987 1mo
   TITLE  ifile.grb  T21 grid
   OPTIONS yrev
   UNDEF  -9e+33
   VARS  3
   geosp    0  129,1,0  surface geopotential (orography)  [m^2/s^2]
   t        4  130,99,0  temperature  [K]
   tslm1    0  139,1,0  surface temperature of land  [K]
   ENDVARS
@EndListing
@EndExample
