r.resamp.bspline.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <h2>DESCRIPTION</h2>
  2. <em>r.resamp.bspline</em> performs a bilinear/bicubic spline interpolation with
  3. Tykhonov regularization. The input is a raster surface map, e.g. elevation,
  4. temperature, precipitation etc. Output is a raster map. Optionally, only
  5. input NULL cells are interpolated, useful to fill NULL cells, an alternative
  6. to <em><a href="r.fillnulls.html">r.fillnulls</a></em>. Using the <b>-n</b> flag to only
  7. interpolate NULL cells will considerably speed up the module.
  8. <p>
  9. The input raster map is read at its native resolution, the output raster
  10. map will be produced for the current computational region set with
  11. <em><a href="g.region.html">g.region</a></em>. Any MASK will be respected, masked
  12. values will be treated as NULL cells in both the input and the output map.
  13. <p>Spline step values <b>ew_step</b> for the east-west direction and
  14. <b>ns_step</b> for the north-south direction should not be smaller than
  15. the east-west and north-south resolutions of the input map. For a raster
  16. map without NULL cells, 1 * resolution can be used, but check for
  17. undershoots and overshoots. For very large areas with missing values
  18. (NULL cells), larger spline step values may be required, but most of the
  19. time the defaults (1.5 x resolution) should be fine.
  20. <p>
  21. The Tykhonov regularization parameter (<b>lambda</b>) acts to
  22. smooth the interpolation. With a small <b>lambda</b>, the
  23. interpolated surface closely follows observation points; a larger value
  24. will produce a smoother interpolation. Reasonable values are 0.0001,
  25. 0.001, 0.005, 0.01, 0.02, 0.05, 0.1 (needs more testing). For seamless
  26. NULL cell interpolation, a small value is required and default is set to 0.005.
  27. <p>
  28. From a theoretical perspective, the interpolating procedure takes place in two
  29. parts: the first is an estimate of the linear coefficients of a spline function;
  30. these are derived from the observation points using a least squares regression; the
  31. second is the computation of the interpolated surface (or interpolated vector
  32. points). As used here, the splines are 2D piece-wise non-zero polynomial
  33. functions calculated within a limited 2D area. The length of each spline step
  34. is defined by <b>ew_step</b> for the east-west direction and
  35. <b>ns_step</b> for the north-south direction. For optimal performance, the
  36. spline step values should be no less than the east-west and north-south
  37. resolutions of the input map. Each non-NULL cell observation is modeled as a
  38. linear function of the non-zero splines in the area around the observation.
  39. The least squares regression predicts the the coefficients of these linear functions.
  40. Regularization avoids the need to have one one observation and one coefficient
  41. for each spline (in order to avoid instability).
  42. <p>A cross validation "leave-one-out" analysis is available to help to determine
  43. the optimal <b>lambda</b> value that produces an interpolation that
  44. best fits the original observation data. The more points used for
  45. cross-validation, the longer the time needed for computation. Empirical testing
  46. indicates a threshold of a maximum of 100 points is recommended. Note that cross
  47. validation can run very slowly if more than 100 observations are used. The
  48. cross-validation output reports <i>mean</i> and <i>rms</i> of the residuals from
  49. the true point value and the estimated from the interpolation for a fixed series
  50. of <b>lambda</b> values. No vector nor raster output will be created
  51. when cross-validation is selected.
  52. <h2>EXAMPLES</h2>
  53. <h3>Basic interpolation</h3>
  54. <div class="code"><pre>
  55. r.resamp.bspline input=raster_surface output=interpolated_surface method=bicubic
  56. </pre></div>
  57. A bicubic spline interpolation will be done and a raster map with estimated
  58. (i.e., interpolated) values will be created.
  59. <h3>Interpolation of NULL cells and patching</h3>
  60. General procedure:
  61. <div class="code"><pre>
  62. # set region to area with NULL cells, align region to input map
  63. g.region n=north s=south e=east w=west align=input -p
  64. # interpolate NULL cells
  65. r.resamp.bspline -n input=input_raster output=interpolated_nulls method=bicubic
  66. # set region to area with NULL cells, align region to input map
  67. g.region raster=input -p
  68. # patch original map and interpolated NULLs
  69. r.patch input=input_raster,interpolated_nulls output=input_raster_gapfilled
  70. </pre></div>
  71. <h3>Interpolation of NULL cells and patching (NC data)</h3>
  72. In this example, the SRTM elevation map in the
  73. North Carolina sample dataset location is filtered for outlier
  74. elevation values; missing pixels are then re-interpolated to obtain
  75. a complete elevation map:
  76. <div class="code"><pre>
  77. g.region raster=elev_srtm_30m -p
  78. d.mon wx0
  79. d.histogram elev_srtm_30m
  80. r.univar -e elev_srtm_30m
  81. # remove too low elevations (esp. lakes)
  82. # Threshold: thresh = Q1 - 1.5 * (Q3 - Q1)
  83. r.mapcalc "elev_srtm_30m_filt = if(elev_srtm_30m &lt; 50.0, null(), elev_srtm_30m)"
  84. # verify
  85. d.histogram elev_srtm_30m_filt
  86. d.erase
  87. d.rast elev_srtm_30m_filt
  88. r.resamp.bspline -n input=elev_srtm_30m_filt output=elev_srtm_30m_complete \
  89. method=bicubic
  90. d.histogram elev_srtm_30m_complete
  91. d.rast elev_srtm_30m_complete
  92. </pre></div>
  93. <h3>Estimation of <b>lambda</b> parameter with a cross validation process</h3>
  94. A random sample of points should be generated first with
  95. <em><a href="r.random.html">r.random</a></em>, and the current region should not
  96. include more than 100 non-NULL random cells.
  97. <div class="code"><pre>
  98. r.resamp.bspline -c input=input_raster
  99. </pre></div>
  100. <h2>REFERENCES</h2>
  101. <ul>
  102. <li>Brovelli M. A., Cannata M., and Longoni U.M., 2004, LIDAR Data
  103. Filtering and DTM Interpolation Within GRASS, Transactions in GIS,
  104. April 2004, vol. 8, iss. 2, pp. 155-174(20), Blackwell Publishing Ltd</li>
  105. <li>Brovelli M. A. and Cannata M., 2004, Digital Terrain model
  106. reconstruction in urban areas from airborne laser scanning data: the
  107. method and an example for Pavia (Northern Italy). Computers and
  108. Geosciences 30, pp.325-331</li>
  109. <li>Brovelli M. A e Longoni U.M., 2003, Software per il filtraggio di
  110. dati LIDAR, Rivista dell'Agenzia del Territorio, n. 3-2003, pp. 11-22
  111. (ISSN 1593-2192)</li>
  112. <li>Antolin R. and Brovelli M.A., 2007, LiDAR data Filtering with GRASS GIS for the Determination of Digital Terrain Models. Proceedings of Jornadas de SIG Libre,
  113. Girona, Espa&ntilde;a. CD ISBN: 978-84-690-3886-9</li>
  114. </ul>
  115. <h2>SEE ALSO</h2>
  116. <em>
  117. <a href="r.fillnulls.html">r.fillnulls</a>,
  118. <a href="r.resamp.rst.html">r.resamp.rst</a>,
  119. <a href="r.resamp.interp.html">r.resamp.interp</a>,
  120. <a href="v.surf.bspline.html">v.surf.bspline</a>
  121. </em>
  122. <p>
  123. Overview: <a href="https://grasswiki.osgeo.org/wiki/Interpolation">Interpolation and Resampling</a> in GRASS GIS
  124. <h2>AUTHORS</h2>
  125. Markus Metz<br>
  126. <br>
  127. based on <em><a href="v.surf.bspline.html">v.surf.bspline</a></em> by
  128. <br>
  129. Maria Antonia Brovelli, Massimiliano Cannata, Ulisse Longoni, Mirko Reguzzoni, Roberto Antolin
  130. <p>
  131. <i>Last changed: $Date$</i>