r.resamp.filter(1)

πŸ’– r.resamp.filter πŸ’–

okay bestie, so this is r.resamp.filter from the GRASS GIS User's Manual β€” it resamples raster map layers using an analytic kernel. yes, it's giving math, but we're gonna get through it together 🫢


✨ NAME ✨

r.resamp.filter β€” resamples raster map layers using an analytic kernel. slay πŸ’…

πŸŽ€ KEYWORDS πŸŽ€

raster, resample, kernel filter, filter, convolution, FIR, bartlett, blackman, box, gauss, hamming, hann, hermite, lanczos, sinc, parallel


🌸 SYNOPSIS 🌸

r.resamp.filter
r.resamp.filter --help
r.resamp.filter [-n] input=name output=name filter=string[,string,...]
[radius=float[,float,...]]   [x_radius=float[,float,...]]
[y_radius=float[,float,...]]   [memory=memory in MB]   [nprocs=integer]
[--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

Flags 🚩

  • -n β€” Propagate NULLs
  • --overwrite β€” Allow output files to overwrite existing files
  • --help β€” Print usage summary
  • --verbose β€” Verbose module output
  • --quiet β€” Quiet module output
  • --ui β€” Force launching GUI dialog

Parameters 🧚

  • input=name [required] β€” Name of input raster map
  • output=name [required] β€” Name for output raster map
  • filter=string[,string,...] [required] β€” Filter kernel(s) Options: box, bartlett, gauss, normal, hermite, sinc, lanczos1, lanczos2, lanczos3, hann, hamming, blackman
  • radius=float[,float,...] β€” Filter radius
  • x_radius=float[,float,...] β€” Filter radius (horizontal)
  • y_radius=float[,float,...] β€” Filter radius (vertical)
  • memory=memory in MB β€” Maximum memory to be used (in MB) Cache size for raster rows Default: 300
  • nprocs=integer β€” Number of threads for parallel computing Default: 1

πŸ’œ DESCRIPTION πŸ’œ

r.resamp.filter resamples an input raster, filtering the input with an analytic kernel. each output cell is typically calculated based upon a small subset of the input cells, not the entire input. and like, r.resamp.filter performs convolution (i.e. a weighted sum is calculated for every raster cell). iconic behavior honestly.

the radii must be given in map units, no cap. and if you wanna consider more than one input cell, at least one finite radius has to be larger than half the resolution of the input map β€” otherwise the selected kernels will have no effect. literally zero. πŸ’€

the module maps the input range to the width of the window function, so wider windows will be "sharper" (have a higher cut-off frequency), e.g. lanczos3 will be sharper than lanczos2.

r.resamp.filter implements FIR (finite impulse response) filtering. all of the functions are low-pass filters, as they are symmetric. see Wikipedia: Window function for examples of common window functions and their frequency responses.

a piecewise-continuous function defined by sampled data can be considered a mixture (sum) of the underlying signal and quantisation noise. the intent of a low pass filter is to discard the quantisation noise while retaining the signal. the cut-off frequency is normally chosen according to the sampling frequency, as the quantisation noise is dominated by the sampling frequency and its harmonics. in general, the cut-off frequency is inversely proportional to the width of the central "lobe" of the window function.

when using r.resamp.filter with a specific radius, a specific cut-off frequency regardless of the method is chosen. so while lanczos3 uses 3 times as large a window as lanczos1, the cut-off frequency remains the same. effectively, the radius is "normalised". the way that normalisation just works? obsessed. ✨

all of the kernels specified by the filter parameter are multiplied together. typical usage will use either a single finitie window or an infinite kernel along with a finite window.

🌈 Usage hints 🌈

  • to smooth a map, keeping its resolution, a good starting point is to use the filters gauss,box with the radii 0.5 * input resolution, 2 * input resolution. see also r.neighbors
  • when resampling a map to a higher resolution (alternative to interpolation, e.g. r.resamp.interp), a good starting point is to use the filters gauss,box with the radii 1.5 * input resolution, 3 * input resolution.
  • when resampling a map to a lower resolution (alternative to aggregation, e.g. r.resamp.stats), a good starting point is to use the filters gauss,box with the radii 0.25 * output resolution, 1 * output resolution.

these are recommendations for initial settings. the selection of filters and radii might need adjustment according to the actual purpose. lowkey tune it to your vibe πŸ¦‹


πŸ’… NOTES πŸ’…

resampling modules (r.resample, r.resamp.stats, r.resamp.interp, r.resamp.rst, r.resamp.filter) resample the map to match the current region settings.

⚠️ when using a kernel which can have negative values (sinc, Lanczos), the -n flag should be used. otherwise, extreme values can arise due to the total weight being close (or even equal) to zero. bestie please, use the flag 😭

kernels with infinite extent (Gauss, normal, sinc, Hann, Hamming, Blackman) must be used in conjunction with a finite windowing function (box, Bartlett, Hermite, Lanczos). they're a package deal, fr fr 🫢

the way that Lanczos filters are defined, the number of samples is supposed to be proportional to the order ("a" parameter), so lanczos3 should use 3 times as many samples (at the same sampling frequency, i.e. cover 3 times as large a time interval) as lanczos1 in order to get a similar frequency response (higher-order filters will fall off faster, but the frequency at which the fall-off starts should be the same). see Wikipedia: Lanczos-kernel.svg for an illustration. if both graphs were drawn on the same axes, they would have roughly the same shape, but the a=3 window would have a longer tail. by scaling the axes to the same width, the a=3 window has a narrower central lobe. the way math just does that 😌

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. periodt.

πŸ”₯ PERFORMANCE πŸ”₯

by specifying the number of parallel processes with the nprocs option, r.resamp.filter can run faster, see benchmarks below.

Figure: Benchmark shows execution time for different number of cells. See benchmark script in the 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.


πŸ‘‘ SEE ALSO πŸ‘‘

g.region, r.mfilter, r.resample, r.resamp.interp, r.resamp.rst, r.resamp.stats

Overview: Interpolation and Resampling in GRASS GIS


⭐ AUTHOR ⭐

Glynn Clements


πŸ“ SOURCE CODE πŸ“

Available at: r.resamp.filter source code (history)

Accessed: Saturday Jan 17 05:40:57 2026

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index


Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual

and that's the whole page bestie β€” this one shipped in GRASS 8.4.2, and the man page for r.resamp.filter(1) is dated Saturday Jan 17 05:40:57 2026. go resample something gorgeous πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from