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