1r.resamp.filter(1) GRASS GIS User's Manual r.resamp.filter(1)
2
3
4
6 r.resamp.filter - Resamples raster map layers using an analytic ker‐
7 nel.
8
10 raster, resample, kernel filter, filter, convolution, FIR, bartlett,
11 blackman, box, gauss, hamming, hann, hermite, lanczos, sinc, parallel
12
14 r.resamp.filter
15 r.resamp.filter --help
16 r.resamp.filter [-n] input=name output=name filter=string[,string,...]
17 [radius=float[,float,...]] [x_radius=float[,float,...]] [y_ra‐
18 dius=float[,float,...]] [memory=memory in MB] [nprocs=integer]
19 [--overwrite] [--help] [--verbose] [--quiet] [--ui]
20
21 Flags:
22 -n
23 Propagate NULLs
24
25 --overwrite
26 Allow output files to overwrite existing files
27
28 --help
29 Print usage summary
30
31 --verbose
32 Verbose module output
33
34 --quiet
35 Quiet module output
36
37 --ui
38 Force launching GUI dialog
39
40 Parameters:
41 input=name [required]
42 Name of input raster map
43
44 output=name [required]
45 Name for output raster map
46
47 filter=string[,string,...]Â [required]
48 Filter kernel(s)
49 Options: box, bartlett, gauss, normal, hermite, sinc, lanczos1,
50 lanczos2, lanczos3, hann, hamming, blackman
51
52 radius=float[,float,...]
53 Filter radius
54
55 x_radius=float[,float,...]
56 Filter radius (horizontal)
57
58 y_radius=float[,float,...]
59 Filter radius (vertical)
60
61 memory=memory in MB
62 Maximum memory to be used (in MB)
63 Cache size for raster rows
64 Default: 300
65
66 nprocs=integer
67 Number of threads for parallel computing
68 Default: 1
69
71 r.resamp.filter resamples an input raster, filtering the input with an
72 analytic kernel. Each output cell is typically calculated based upon a
73 small subset of the input cells, not the entire input. r.resamp.filter
74 performs convolution (i.e. a weighted sum is calculated for every
75 raster cell).
76
77 The module maps the input range to the width of the window function, so
78 wider windows will be "sharper" (have a higher cut-off frequency), e.g.
79 lanczos3 will be sharper than lanczos2.
80
81 r.resamp.filter implements FIR (finite impulse response) filtering. All
82 of the functions are low-pass filters, as they are symmetric. See
83 Wikipedia: Window function for examples of common window functions and
84 their frequency responses.
85
86 A piecewise-continuous function defined by sampled data can be consid‐
87 ered a mixture (sum) of the underlying signal and quantisation noise.
88 The intent of a low pass filter is to discard the quantisation noise
89 while retaining the signal. The cut-off frequency is normally chosen
90 according to the sampling frequency, as the quantisation noise is domi‐
91 nated by the sampling frequency and its harmonics. In general, the
92 cut-off frequency is inversely proportional to the width of the central
93 "lobe" of the window function.
94
95 When using r.resamp.filter with a specific radius, a specific cut-off
96 frequency regardless of the method is chosen. So while lanczos3 uses 3
97 times as large a window as lanczos1, the cut-off frequency remains the
98 same. Effectively, the radius is "normalised".
99
100 All of the kernels specified by the filter parameter are multiplied to‐
101 gether. Typical usage will use either a single kernel or an infinite
102 kernel along with a finite window.
103
105 Resampling modules (r.resample, r.resamp.stats, r.resamp.interp, r.re‐
106 samp.rst, r.resamp.filter) resample the map to match the current region
107 settings.
108
109 When using a kernel which can have negative values (sinc, Lanczos), the
110 -n flag should be used. Otherwise, extreme values can arise due to the
111 total weight being close (or even equal) to zero.
112
113 Kernels with infinite extent (Gauss, normal, sinc, Hann, Hamming,
114 Blackman) must be used in conjunction with a finite windowing function
115 (box, Bartlett, Hermite, Lanczos).
116
117 The way that Lanczos filters are defined, the number of samples is sup‐
118 posed to be proportional to the order ("a" parameter), so lanczos3
119 should use 3 times as many samples (at the same sampling frequency,
120 i.e. cover 3 times as large a time interval) as lanczos1 in order to
121 get a similar frequency response (higher-order filters will fall off
122 faster, but the frequency at which the fall-off starts should be the
123 same). See Wikipedia: Lanczos-kernel.svg for an illustration. If both
124 graphs were drawn on the same axes, they would have roughly the same
125 shape, but the a=3 window would have a longer tail. By scaling the axes
126 to the same width, the a=3 window has a narrower central lobe.
127
128 For longitude-latitude locations, the interpolation algorithm is based
129 on degree fractions, not on the absolute distances between cell cen‐
130 ters. Any attempt to implement the latter would violate the integrity
131 of the interpolation method.
132
133 PERFORMANCE
134 By specifying the number of parallel processes with nprocs option,
135 r.resamp.filter can run faster, see benchmarks below.
136 Figure: Benchmark shows execution time for different number of cells.
137 See benchmark script in the source code.
138
139 To reduce the memory requirements to minimum, set option memory to
140 zero. To take advantage of the parallelization, GRASS GIS needs to
141 compiled with OpenMP enabled.
142
144 g.region, r.mfilter, r.resample, r.resamp.interp, r.resamp.rst, r.re‐
145 samp.stats
146
147 Overview: Interpolation and Resampling in GRASS GIS
148
150 Glynn Clements
151
153 Available at: r.resamp.filter source code (history)
154
155 Accessed: Saturday Oct 28 18:17:54 2023
156
157 Main index | Raster index | Topics index | Keywords index | Graphical
158 index | Full index
159
160 © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
161
162
163
164GRASS 8.3.1 r.resamp.filter(1)