@BeginModule
@NewPage
@Name      = Remapdis
@Title     = Distance-weighted average remapping
@Section   = Interpolation
@Class     = Interpolation
@Arguments = ifile ofile
@Operators = remapdis gendis

@BeginDescription
This module contains operators for a distance-weighted average remapping of the four
nearest neighbor values of fields between grids in spherical coordinates.
The interpolation is based on an adapted SCRIP library version. 
For a detailed description of the interpolation method see @cite{SCRIP}.
@IfDoc
Below is a schematic illustration of the distance-weighted average remapping:

\vspace{1mm}

\includegraphics[width=\textwidth]{remapdis.pdf}

\vspace{1mm}

The figure on the left side shows the input data on a regular lon/lat source grid and on the right side
the remapped result on an unstructured triangular target grid. The figure in the middle shows the input data with
the target grid. Grid cells with missing value are grey colored.
@EndifDoc
@EndDescription
@EndModule


@BeginOperator_remapdis
@Name      = remapdis
@Title     = Distance-weighted average remapping
@Parameter = grid [neighbors]

@BeginDescription
Performs a distance-weighted average remapping of the nearest neighbors value on all input fields.
The default number of nearest neighbors is 4.
@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 for the first input field and writes the result to a file.
The format of this file is netCDF following the SCRIP convention.
Use the operator @mod{remap} to apply this remapping weights to a data file with the same source grid.
@EndDescription
@EndOperator


@BeginParameter
@Item = grid
STRING   Target grid description file or name
@Item = neighbors
INTEGER  Number of nearest neighbors
@EndParameter


@BeginEnvironment
@Item = REMAP_EXTRAPOLATE
This variable is used to switch the extrapolation feature 'on' or 'off'.
By default the extrapolation is enabled for this remapping method.
@Item = CDO_GRIDSEARCH_RADIUS
Grid search radius in degree, default 180 degree.
@EndEnvironment
