@BeginModule
@NewPage
@Name      = Setgrid
@Title     = Set grid information
@Section   = Modification
@Class     = Modification
@Arguments = ifile ofile
@Operators = setgrid setgridtype setgridarea

@BeginDescription
This module modifies the metadata of the horizontal grid. Depending on the 
chosen operator a new grid description is set, the coordinates are converted
or the grid cell area is added.
@EndDescription
@EndModule


@BeginOperator_setgrid
@Title     = Set grid
@Parameter = grid

@BeginDescription
Sets a new grid description. The input fields need to have the same grid size
as the size of the target grid description.
@EndDescription
@EndOperator


@BeginOperator_setgridtype
@Title     = Set grid type
@Parameter = gridtype

@BeginDescription
Sets the grid type of all input fields. The following grid types are available:
@BeginList unstructured
@Item = curvilinear
Converts a regular grid to a curvilinear grid
@Item = unstructured
Converts a regular or curvilinear grid to an unstructured grid
@Item = dereference
Dereference a reference to a grid
@Item = regular
Linear interpolation of a reduced Gaussian grid to a regular Gaussian grid
@Item = regularnn
Nearest neighbor interpolation of a reduced Gaussian grid to a regular Gaussian grid
@Item = lonlat
Converts a regular lonlat grid stored as a curvilinear grid back to a lonlat grid
@EndList
@EndDescription
@EndOperator


@BeginOperator_setgridarea
@Title     = Set grid cell area
@Parameter = gridarea

@BeginDescription
Sets the grid cell area. The parameter @var{gridarea} is the path to a data file,
the first field is used as grid cell area. The input fields need to have the same
grid size as the grid cell area. The grid cell area is used to compute
the weights of each grid cell if needed by an operator, e.g. for @oper{fldmean}.
@EndOperator


@BeginParameter
@Item = grid
STRING  Grid description file or name
@Item = gridtype
STRING  Grid type (curvilinear, unstructured, regular, lonlat or dereference)
@Item = gridarea
STRING  Data file, the first field is used as grid cell area
@EndParameter


@BeginExample
Assuming a dataset has fields on a grid with 2048 elements without or with wrong
grid description.
To set the grid description of all input fields to a Gaussian N32 grid (8192 gridpoints) use:
@BeginVerbatim
   cdo setgrid,n32 ifile ofile
@EndVerbatim
@EndExample
