r.resamp.stats
Resamples raster map layers to a coarser grid using aggregation.
r.resamp.stats [-nw] input=name output=name [method=string] [quantile=float] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.resamp.stats input=name output=name
grass.script.run_command("r.resamp.stats", input, output, method="average", quantile=0.5, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("r.resamp.stats", input="name", output="name")
Parameters
input=name [required]
Name of input raster map
output=name [required]
Name for output raster map
method=string
Aggregation method
Allowed values: average, median, mode, minimum, maximum, range, quart1, quart3, perc90, sum, variance, stddev, quantile, count, diversity
Default: average
quantile=float
Quantile to calculate for method=quantile
Allowed values: 0.0-1.0
Default: 0.5
-n
Propagate NULLs
-w
Weight according to area (slower)
--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
Aggregation method
Allowed values: average, median, mode, minimum, maximum, range, quart1, quart3, perc90, sum, variance, stddev, quantile, count, diversity
Default: average
quantile : float, optional
Quantile to calculate for method=quantile
Allowed values: 0.0-1.0
Default: 0.5
flags : str, optional
Allowed values: n, w
n
Propagate NULLs
w
Weight according to area (slower)
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.stats fills a grid cell (raster) matrix with aggregated values generated from a set of input layer data points.
Without the -w switch, the aggregate is computed over all of the input cells whose centers lie within the output cell.
With the -w switch, the aggregate uses the values from all input cells which intersect the output cell, weighted according to the proportion of the source cell which lies inside the output cell. This is slower, but produces a more accurate result.
NOTES
Resampling modules (r.resample, r.resamp.stats, r.resamp.interp, r.resamp.rst) resample the map to match the current region settings.
The notion of weighting doesn't make any sense for the min and max aggregates. However, the -w flag still has significance in that, when multiple destination cells overlap a source cell, the source cell is included in the calculation of all of the destination cells.
EXAMPLE
Resample elevation raster map to a lower resolution (from 6m to 20m; North Carolina sample dataset):
g.region raster=el_D782_6m -p
g.region res=20 -ap
# from 6m to 20m: weighted resampling -w
r.resamp.stats -w input=el_D782_6m output=el_D782_20m
Resampling of 6m DEM (left) to 20m DEM (right) with weighted resampling
(subset)
SEE ALSO
g.region, r.resample, r.resamp.rst, r.resamp.filter, r.resamp.interp, r.neighbors
Overview: Interpolation and Resampling in GRASS GIS
Examples how statistical functions are applied can be found in the r.neighbors module documentation.
AUTHOR
Glynn Clements
SOURCE CODE
Available at: r.resamp.stats source code
(history)
Latest change: Thursday Feb 13 11:55:34 2025 in commit ffc0b8c