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

@BeginDescription
Grid interpolation can be a very time-consuming process. Especially if the
data are on an unstructured or a large grid. In this case the \htmlref{SCRIP}{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 rectangular 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 rectangular grids.
@EndDescription
@EndOperator


@BeginOperator_gencon
@Title     = Generate conservative interpolation weights
@Parameter = grid

@BeginDescription
Generates first order conservative interpolation weights and
writes the result to a file.
@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


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


@BeginEnvironment
@Item = NORMALIZE_OPT
This variable is used to choose the normalization of the conservative 
interpolation. By default 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}).
@EndEnvironment


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


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