1r.resamp.bspline(1) Grass User's Manual r.resamp.bspline(1)
2
3
4
6 r.resamp.bspline - Performs bilinear or bicubic spline interpolation
7 with Tykhonov regularization.
8
10 raster, surface, resample, interpolation, splines, bilinear, bicubic,
11 no-data filling
12
14 r.resamp.bspline
15 r.resamp.bspline --help
16 r.resamp.bspline [-nc] input=name output=name [grid=name]
17 [mask=name] [ew_step=float] [ns_step=float] [method=string]
18 [lambda=float] [memory=integer] [--overwrite] [--help] [--ver‐
19 bose] [--quiet] [--ui]
20
21 Flags:
22 -n
23 Only interpolate null cells in input raster map
24
25 -c
26 Find the best Tykhonov regularizing parameter using a
27 "leave-one-out" cross validation method
28
29 --overwrite
30 Allow output files to overwrite existing files
31
32 --help
33 Print usage summary
34
35 --verbose
36 Verbose module output
37
38 --quiet
39 Quiet module output
40
41 --ui
42 Force launching GUI dialog
43
44 Parameters:
45 input=name [required]
46 Name of input raster map
47
48 output=name [required]
49 Name for output raster map
50
51 grid=name
52 Name for output vector map with interpolation grid
53
54 mask=name
55 Name of raster map to use for masking
56 Only cells that are not NULL and not zero are interpolated
57
58 ew_step=float
59 Length of each spline step in the east-west direction. Default: 1.5
60 * ewres.
61
62 ns_step=float
63 Length of each spline step in the north-south direction. Default:
64 1.5 * nsres.
65
66 method=string
67 Spline interpolation algorithm
68 Options: bilinear, bicubic
69 Default: bicubic
70 bilinear: Bilinear interpolation
71 bicubic: Bicubic interpolation
72
73 lambda=float
74 Tykhonov regularization parameter (affects smoothing)
75 Default: 0.01
76
77 memory=integer
78 Maximum memory to be used (in MB)
79 Cache size for raster rows
80 Default: 300
81
83 r.resamp.bspline performs a bilinear/bicubic spline interpolation with
84 Tykhonov regularization. The input is a raster surface map, e.g. eleva‐
85 tion, temperature, precipitation etc. Output is a raster map. Option‐
86 ally, only input NULL cells are interpolated, useful to fill NULL
87 cells, an alternative to r.fillnulls. Using the -n flag to only inter‐
88 polate NULL cells will considerably speed up the module.
89
90 The input raster map is read at its native resolution, the output
91 raster map will be produced for the current computational region set
92 with g.region. Any MASK will be respected, masked values will be
93 treated as NULL cells in both the input and the output map.
94
95 Spline step values ew_step for the east-west direction and ns_step for
96 the north-south direction should not be smaller than the east-west and
97 north-south resolutions of the input map. For a raster map without NULL
98 cells, 1 * resolution can be used, but check for undershoots and over‐
99 shoots. For very large areas with missing values (NULL cells), larger
100 spline step values may be required, but most of the time the defaults
101 (1.5 x resolution) should be fine.
102
103 The Tykhonov regularization parameter (lambda) acts to smooth the
104 interpolation. With a small lambda, the interpolated surface closely
105 follows observation points; a larger value will produce a smoother
106 interpolation. Reasonable values are 0.0001, 0.001, 0.005, 0.01, 0.02,
107 0.05, 0.1 (needs more testing). For seamless NULL cell interpolation, a
108 small value is required and default is set to 0.005.
109
110 From a theoretical perspective, the interpolating procedure takes place
111 in two parts: the first is an estimate of the linear coefficients of a
112 spline function; these are derived from the observation points using a
113 least squares regression; the second is the computation of the interpo‐
114 lated surface (or interpolated vector points). As used here, the
115 splines are 2D piece-wise non-zero polynomial functions calculated
116 within a limited 2D area. The length of each spline step is defined by
117 ew_step for the east-west direction and ns_step for the north-south
118 direction. For optimal performance, the spline step values should be no
119 less than the east-west and north-south resolutions of the input map.
120 Each non-NULL cell observation is modeled as a linear function of the
121 non-zero splines in the area around the observation. The least squares
122 regression predicts the the coefficients of these linear functions.
123 Regularization avoids the need to have one one observation and one
124 coefficient for each spline (in order to avoid instability).
125
126 A cross validation "leave-one-out" analysis is available to help to
127 determine the optimal lambda value that produces an interpolation that
128 best fits the original observation data. The more points used for
129 cross-validation, the longer the time needed for computation. Empirical
130 testing indicates a threshold of a maximum of 100 points is recom‐
131 mended. Note that cross validation can run very slowly if more than 100
132 observations are used. The cross-validation output reports mean and rms
133 of the residuals from the true point value and the estimated from the
134 interpolation for a fixed series of lambda values. No vector nor raster
135 output will be created when cross-validation is selected.
136
138 Basic interpolation
139 r.resamp.bspline input=raster_surface output=interpolated_surface method=bicubic
140 A bicubic spline interpolation will be done and a raster map with esti‐
141 mated (i.e., interpolated) values will be created.
142
143 Interpolation of NULL cells and patching
144 General procedure:
145 # set region to area with NULL cells, align region to input map
146 g.region n=north s=south e=east w=west align=input -p
147 # interpolate NULL cells
148 r.resamp.bspline -n input=input_raster output=interpolated_nulls method=bicubic
149 # set region to area with NULL cells, align region to input map
150 g.region raster=input -p
151 # patch original map and interpolated NULLs
152 r.patch input=input_raster,interpolated_nulls output=input_raster_gapfilled
153
154 Interpolation of NULL cells and patching (NC data)
155 In this example, the SRTM elevation map in the North Carolina sample
156 dataset location is filtered for outlier elevation values; missing pix‐
157 els are then re-interpolated to obtain a complete elevation map:
158 g.region raster=elev_srtm_30m -p
159 d.mon wx0
160 d.histogram elev_srtm_30m
161 r.univar -e elev_srtm_30m
162 # remove too low elevations (esp. lakes)
163 # Threshold: thresh = Q1 - 1.5 * (Q3 - Q1)
164 r.mapcalc "elev_srtm_30m_filt = if(elev_srtm_30m < 50.0, null(), elev_srtm_30m)"
165 # verify
166 d.histogram elev_srtm_30m_filt
167 d.erase
168 d.rast elev_srtm_30m_filt
169 r.resamp.bspline -n input=elev_srtm_30m_filt output=elev_srtm_30m_complete \
170 method=bicubic
171 d.histogram elev_srtm_30m_complete
172 d.rast elev_srtm_30m_complete
173
174 Estimation of lambda parameter with a cross validation process
175 A random sample of points should be generated first with r.random, and
176 the current region should not include more than 100 non-NULL random
177 cells.
178 r.resamp.bspline -c input=input_raster
179
181 · Brovelli M. A., Cannata M., and Longoni U.M., 2004, LIDAR Data
182 Filtering and DTM Interpolation Within GRASS, Transactions in
183 GIS, April 2004, vol. 8, iss. 2, pp. 155-174(20), Blackwell
184 Publishing Ltd
185
186 · Brovelli M. A. and Cannata M., 2004, Digital Terrain model
187 reconstruction in urban areas from airborne laser scanning
188 data: the method and an example for Pavia (Northern Italy).
189 Computers and Geosciences 30, pp.325-331
190
191 · Brovelli M. A e Longoni U.M., 2003, Software per il filtraggio
192 di dati LIDAR, Rivista dell’Agenzia del Territorio, n. 3-2003,
193 pp. 11-22 (ISSN 1593-2192)
194
195 · Antolin R. and Brovelli M.A., 2007, LiDAR data Filtering with
196 GRASS GIS for the Determination of Digital Terrain Models. Pro‐
197 ceedings of Jornadas de SIG Libre, Girona, España. CD ISBN:
198 978-84-690-3886-9
199
201 r.fillnulls, r.resamp.rst, r.resamp.interp, v.surf.bspline
202
203 Overview: Interpolation and Resampling in GRASS GIS
204
206 Markus Metz
207 based on v.surf.bspline by
208 Maria Antonia Brovelli, Massimiliano Cannata, Ulisse Longoni, Mirko
209 Reguzzoni, Roberto Antolin
210
212 Available at: r.resamp.bspline source code (history)
213
214 Main index | Raster index | Topics index | Keywords index | Graphical
215 index | Full index
216
217 © 2003-2019 GRASS Development Team, GRASS GIS 7.8.2 Reference Manual
218
219
220
221GRASS 7.8.2 r.resamp.bspline(1)