r.resamp.interp
Resamples raster map to a finer grid using interpolation.
r.resamp.interp input=name output=name [method=string] [nprocs=integer] [memory=memory in MB] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.resamp.interp input=name output=name
grass.script.run_command("r.resamp.interp", input, output, method="bilinear", nprocs=1, memory=300, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("r.resamp.interp", input="name", output="name")
Parameters
input=name [required]
Name of input raster map
output=name [required]
Name for output raster map
method=string
Sampling interpolation method
Allowed values: nearest, bilinear, bicubic, lanczos
Default: bilinear
nearest: Nearest-neighbor interpolation
bilinear: Bilinear interpolation
bicubic: Bicubic interpolation
nprocs=integer
Number of threads for parallel computing
Default: 1
memory=memory in MB
Maximum memory to be used (in MB)
Cache size for raster rows
Default: 300
--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
output : str, required
Name for output raster map
Used as: output, raster, name
method : str, optional
Sampling interpolation method
Allowed values: nearest, bilinear, bicubic, lanczos
nearest: Nearest-neighbor interpolation
bilinear: Bilinear interpolation
bicubic: Bicubic interpolation
Default: bilinear
nprocs : int, optional
Number of threads for parallel computing
Default: 1
memory : int, optional
Maximum memory to be used (in MB)
Cache size for raster rows
Used as: memory in MB
Default: 300
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.interp resamples an input raster map by interpolating between the neighboring cells via a selectable resampling algorithm. All cells present in the neighborhood of the input raster cell must be non-null to generate a non-null cell in the output raster map. A choice of four interpolation methods is available; each uses the weighted values of a different number of adjacent cells in the input map to determine the value of each cell in the output map as follows:
- nearest neighbour (1 cell)
- bilinear (4 cells)
- bicubic (16 cells)
- lanczos (25 cells)
This module is intended for reinterpolation of continuous data to a different resolution rather than for interpolation from scattered data (use the v.surf.* modules for that purpose).
NOTES
Resampling modules (r.resample, r.resamp.stats, r.resamp.interp, r.resamp.rst) resample the map to match the current region settings.
Note that for bilinear, bicubic and lanczos interpolation, cells of the output raster that cannot be bounded by the appropriate number of input cell centers are set to NULL (NULL propagation). This could occur due to the input cells being outside the current region, being NULL or masked.
For longitude-latitude coordinate reference systems, the interpolation algorithm is based on degree fractions, not on the absolute distances between cell centers. Any attempt to implement the latter would violate the integrity of the interpolation method.
PERFORMANCE
By specifying the number of parallel processes with nprocs option, r.resamp.interp can run significantly faster, see benchmarks below.
Figure: Benchmark shows execution time for different number of cells.
See benchmark scripts in source code.
To reduce the memory requirements to minimum, set option memory to zero. To take advantage of the parallelization, GRASS GIS needs to compiled with OpenMP enabled.
EXAMPLE
Resample elevation raster map to a higher resolution (from 500m to 250m; North Carolina sample dataset):
g.region raster=elev_state_500m -p
g.region res=250 -ap
r.resamp.interp input=elev_state_500m output=elev_state_250m \
method=bilinear
Original 500m resolution elevation map
Resampled (bilinear) 250m resolution elevation map
SEE ALSO
g.region, r.resample, r.resamp.filter, r.resamp.rst, r.resamp.stats
Overview: Interpolation and Resampling in GRASS GIS
AUTHOR
Glynn Clements
SOURCE CODE
Available at: r.resamp.interp source code
(history)
Latest change: Thursday Feb 13 11:55:34 2025 in commit ffc0b8c