@BeginModule
@NewPage
@Name      = Genweights
@Title     = Generate SCRIP grid interpolation weights
@Section   = Interpolation
@Class     = Interpolation
@Arguments = ifile ofile
@Operators = genbil genbic gendis gennn gencon gencon2 genlaf

@BeginDescription
Interpolation between different horizontal grids can be a very time-consuming 
process. Especially if the data are on an unstructured or a large grid. 
In this case the @ref{SCRIP} interpolation process can be split 
into two parts. Firstly the generation of the interpolation weights, which is 
the most time-consuming part. These interpolation weights can be reused for 
every remapping process with the operator @mod{remap}. This method should be 
used only if all input fields are on the same grid and a possibly
mask (missing values) does not change. This module contains operators to 
generate SCRIP interpolation weights of the first input field.
Each operator is using a different interpolation method.
@EndDescription
@EndModule


@BeginOperator_genbil
@Name      = genbil
@Title     = Generate bilinear interpolation weights
@Parameter = grid

@BeginDescription
Generates bilinear interpolation weights and writes the result to a file. 
This interpolation method only works on quadrilateral curvilinear grids.
@EndDescription
@EndOperator


@BeginOperator_genbic
@Name      = genbic
@Title     = Generate bicubic interpolation weights
@Parameter = grid

@BeginDescription
Generates bicubic interpolation weights and writes the result to a file.
This interpolation method only works on quadrilateral curvilinear grids.
@EndDescription
@EndOperator


@BeginOperator_gendis
@Name      = gendis
@Title     = Generate distance-weighted average remap weights
@Parameter = grid

@BeginDescription
Generates distance-weighted average remapping weights of the four
nearest neighbor values and writes the result to a file.
@EndDescription
@EndOperator


@BeginOperator_gennn
@Name      = gennn
@Title     = Generate nearest neighbor remap weights
@Parameter = grid

@BeginDescription
Generates nearest neighbor remapping weights and writes the result to a file.
@EndDescription
@EndOperator


@BeginOperator_gencon
@Title     = Generate 1st order conservative remap weights
@Parameter = grid

@BeginDescription
Generates first order conservative remapping weights and
writes the result to a file.
@EndDescription
@EndOperator


@BeginOperator_gencon2
@Title     = Generate 2nd order conservative remap weights
@Parameter = grid

@BeginDescription
Generates second order conservative remapping weights and
writes the result to a file.
@EndDescription
@EndOperator


@BeginOperator_genlaf
@Title     = Generate largest area fraction remap weights
@Parameter = grid

@BeginDescription
Generates largest area fraction remapping weights and
writes the result to a file.
@EndDescription
@EndOperator


@BeginParameter
@Item = grid
STRING  Target grid description file or name
@EndParameter


@BeginEnvironment
@Item = CDO_REMAP_NORMALIZE_OPT
This variable is used to choose the normalization of the conservative 
interpolation. By default @env{CDO_REMAP_NORMALIZE_OPT} is set to 'fracarea' and will
include the destination area fraction in the output weights; other 
options are 'none' and 'destarea' (for more information see \cite{SCRIP}).
@Item = REMAP_EXTRAPOLATE
This variable is used to switch the extrapolation feature 'on' or 'off'.
By default the extrapolation is enabled for remapdis, remapnn
and for circular grids.
@Item = REMAP_AREA_MIN
This variable is used to set the minimum destination area fraction. The default
of this variable is 0.0.
@Item = CDO_REMAP_SEARCH_RADIUS
Remap search radius in degree, default 180 degree.
@EndEnvironment


@BeginNote
For this module the author has converted the original Fortran 90 SCRIP 
software to ANSI C99. If there are any problems send a bug report to CDO and
not to SCRIP!
@EndNote


@BeginExample
Say @file{ifile} contains fields on a quadrilateral curvilinear grid.
To remap all fields bilinear to a Gaussian N32 grid use:
@BeginVerbatim
   cdo genbil,n32 ifile remapweights.nc
   cdo remap,n32,remapweights.nc ifile ofile
@EndVerbatim
@EndExample
