@BeginModule
@NewPage
@Name      = Setpartab
@Title     = Set parameter table
@Section   = Modification
@Class     = Modification
@Arguments = ifile ofile
@Operators = setpartabp setpartabn

@BeginDescription
This module transforms data and metadata of @file{ifile} via a parameter table and writes the result to @file{ofile}.
A parameter table is an ASCII formatted file with a set of parameter entries for each variable. Each new set have to
start with "\&parameter" and to end with "/".

The following parameter table entries are supported:

@BeginTable
 @bold{Entry}    & @bold{Type} & @bold{Description}      
 name            & WORD        & Name of the variable
 out_name        & WORD        & New name of the variable
 param           & WORD        & Parameter identifier (GRIB1: code[.tabnum];  GRIB2: num[.cat[.dis]])
 out_param       & WORD        & New parameter identifier
 type            & WORD        & Data type (real or double)
 standard_name   & WORD        & As defined in the CF standard name table
 long_name       & STRING      & Describing the variable
 units           & STRING      & Specifying the units for the variable
 comment         & STRING      & Information concerning the variable
 cell_methods    & STRING      & Information concerning calculation of means or climatologies
 cell_measures   & STRING      & Indicates the names of the variables containing cell areas and volumes
 missing_value   & FLOAT       & Specifying how missing data will be identified
 valid_min       & FLOAT       & Minimum valid value
 valid_max       & FLOAT       & Maximum valid value
 ok_min_mean_abs & FLOAT       & Minimum absolute mean
 ok_max_mean_abs & FLOAT       & Maximum absolute mean
 factor          & FLOAT       & Scale factor
 delete          & INTEGER     & Set to 1 to delete variable
@EndTable

The search key for the variable depends on the operator. Use @oper{setpartabn} to search variables by the name.
This is typically used for netCDF datasets. The operator @oper{setpartabp} searches variables by the parameter ID.
@EndDescription
@EndModule


@BeginOperator_setpartabp
@Title     = Set parameter table
@Parameter = table

@BeginDescription
Search variables by the parameter identifier.
@EndDescription
@EndOperator


@BeginOperator_setpartabn
@Title     = Set parameter table
@Parameter = table

@BeginDescription
Search variables by name.
@EndDescription
@EndOperator


@BeginParameter
@Item = table
STRING   Parameter table file or name
@EndParameter


@BeginExample
Here is an example of a parameter table for one variable:
@BeginVerbatim
prompt> cat mypartab
&parameter
  name            = t
  out_name        = ta
  standard_name   = air_temperature
  units           = "K"
  missing_value   = 1e+20
  valid_min       = 157.1
  valid_max       = 336.3
/
@EndVerbatim

To apply this parameter table to a dataset use:
@BeginVerbatim
cdo setpartabn,mypartab  ifile  ofile
@EndVerbatim
This command renames the variable @bold{t} to @bold{ta}. The standard name of this variable is set to @bold{air_temperature} and 
the units is set to [@bold{K}] (converts the units if necessary). The missing value will be set to @bold{1e+20}. 
In addition it will be checked whether the values of the variable are in the range of @bold{157.1} to @bold{336.3}.

@EndExample
