Skip to content

r.resamp.tps

Performs thin plate spline interpolation with regularization and covariables.

r.resamp.tps [-c] input=name [smooth=float] [overlap=float] [min=float] [max=float] [radius=integer] [icovars=name [,name,...]] [ocovars=name [,name,...]] [lmfilter=float] [epfilter=float] output=name [mask=name] [memory=integer] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.resamp.tps input=name output=name

grass.script.run_command("r.resamp.tps", input, smooth=0, overlap=0.2, min=100, max=None, radius=0, icovars=None, ocovars=None, lmfilter=0, epfilter=0, output, mask=None, memory=300, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r.resamp.tps", input="name", output="name")

Parameters

input=name [required]
    Name of input raster map
smooth=float
    Smoothing factor
    Default: 0
overlap=float
    Overlap factor <= 1
    A larger value increase the tile overlap
    Default: 0.2
min=float
    Minimum number of points to use for TPS interpolation
    Default: 100
max=float
    Maximum number of points to use for TPS interpolation
radius=integer
    Radius for moving window interpolation
    The unit for radius is cells. If radius is > 0, moving window interpolation will be used instead of nearest neighbor search
    Default: 0
icovars=name [,name,...]
    Name of input raster map(s) to use as covariables matching the input raster
    Name of input raster map(s)
ocovars=name [,name,...]
    Name of input raster map(s) to use as covariables matching the current region
    Name of input raster map(s)
lmfilter=float
    Threshold to avoid interpolation outliers when using covariables
    Disabled when set to zero, must be within [0, 1], larger values will cause more outliers
    Default: 0
epfilter=float
    Threshold to avoid extrapolation when using covariables
    Disabled when set to zero, must be > 0, smaller values will cause more outliers
    Default: 0
output=name [required]
    Name for output raster map
mask=name
    Raster map to use for masking
    Only cells where the mask map is not NULL and not zero are interpolated
memory=integer
    Memory in MB
    Default: 300
-c
    Input points are dense clusters separated by empty areas
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Name of input raster map
    Used as: input, raster, name
smooth : float, optional
    Smoothing factor
    Default: 0
overlap : float, optional
    Overlap factor <= 1
    A larger value increase the tile overlap
    Default: 0.2
min : float, optional
    Minimum number of points to use for TPS interpolation
    Default: 100
max : float, optional
    Maximum number of points to use for TPS interpolation
radius : int, optional
    Radius for moving window interpolation
    The unit for radius is cells. If radius is > 0, moving window interpolation will be used instead of nearest neighbor search
    Default: 0
icovars : str | list[str], optional
    Name of input raster map(s) to use as covariables matching the input raster
    Name of input raster map(s)
    Used as: input, raster, name
ocovars : str | list[str], optional
    Name of input raster map(s) to use as covariables matching the current region
    Name of input raster map(s)
    Used as: input, raster, name
lmfilter : float, optional
    Threshold to avoid interpolation outliers when using covariables
    Disabled when set to zero, must be within [0, 1], larger values will cause more outliers
    Default: 0
epfilter : float, optional
    Threshold to avoid extrapolation when using covariables
    Disabled when set to zero, must be > 0, smaller values will cause more outliers
    Default: 0
output : str, required
    Name for output raster map
    Used as: output, raster, name
mask : str, optional
    Raster map to use for masking
    Only cells where the mask map is not NULL and not zero are interpolated
    Used as: input, raster, name
memory : int, optional
    Memory in MB
    Default: 300
flags : str, optional
    Allowed values: c
    c
        Input points are dense clusters separated by empty areas
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

r.resamp.tps performs multivariate thin plate spline interpolation with regularization. The input is a raster map to be resampled to a higher resolution or where NULL cells need to be interpolated. Output is a raster map. Optionally, several raster maps can be specified to be used as covariables which will improve results in areas with few points. Raster maps to be used as covariables need to be provided separately matching the grid geometry of the input raster map with the icovars option and matching the grid geometry of the output raster map with the ocovars option. The module can be regarded as a combination of a multiple regression and spline interpolation.

The min options specifies the minimum number of points to be used for interpolation. r.resamp.tps always performs tiled local TPS interpolation. Tile sizes are variable and dependent on the extents of the min nearest neighbors when a new tile is generated.

The smooth option can be used to reduce the influence of the splines and increase the influence of the covariables. Without covariables, the resulting surface will be smoother. With covariables and a large smooting value, the resulting surface will be mainly determined by the multiple regression component.

The overlap option controls how much tiles are overlapping when the min option is smaller than the numer of input points. Tiling artefacts occur with low values for the min option and the overlap option. Increasing both options will reduce tiling artefacts but processing will take more time.

The module works best with evenly spaced points. In case of highly unevenly spaced points, e.g. remote sensing data with gaps due to cloud cover, the module will take a long time to finish. For data with large gaps, it is recommended to use first a different interpolation method and then optionally use r.resamp.tps with the smooth option to identify outliers (difference between the output of r.resamp.tps and the data interpolated with a different method).

When using covariables, outliers might be created if the values of the covariables of the current output cell are far outside the observed range of covariables, or if the linear regression component of the TPS interpolation for the covariables does not provide a good solution. Two methods are provided to avoid outliers caused by covariables. The first method (lmfilter) will discard covariables if R squared is larger than the value provided with the lmfilter option. The second method (epfilter) will discard covariables if the current value of a covariable is outside the observed range of covariables by a factor of (epfilter). The epfilter option typically results in more interpolations using the supplied covariables than the lmfilter option when both are adjusted to reject the same outliers.

The memory option controls only how much memory should be used for the covariables and the intermediate output. The data needed for TPS interpolation are always completely loaded to memory.

REFERENCES

  • Hutchinson MF, 1995, Interpolating mean rainfall using thin plate smoothing splines. International Journal of Geographical Information Systems, 9(4), pp. 385-403
  • Wahba G, 1990, Spline models for observational data. In CBMS-NSF Regional Conference Series in Applied Mathematics. Philadelpia: Society for Industrial and Applied Mathematics

SEE ALSO

v.surf.tps, v.surf.rst, v.surf.bspline, v.surf.idw

AUTHOR

Markus Metz

SOURCE CODE

Available at: r.resamp.tps source code (history)
Latest change: Friday Feb 21 10:10:05 2025 in commit 7d78fe3