[GRASS-SVN] r57866 - grass-addons/grass7/raster/r.local.relief
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Sep 29 19:12:02 PDT 2013
Author: wenzeslaus
Date: 2013-09-29 19:12:02 -0700 (Sun, 29 Sep 2013)
New Revision: 57866
Modified:
grass-addons/grass7/raster/r.local.relief/r.local.relief.html
grass-addons/grass7/raster/r.local.relief/r.local.relief.py
Log:
adding flag -i for saving some of the intermediate results; changing default size of the window to 11 to be closer to Hesse 2010; docs update (author: Eric Goddard)
Modified: grass-addons/grass7/raster/r.local.relief/r.local.relief.html
===================================================================
--- grass-addons/grass7/raster/r.local.relief/r.local.relief.html 2013-09-30 01:42:09 UTC (rev 57865)
+++ grass-addons/grass7/raster/r.local.relief/r.local.relief.html 2013-09-30 02:12:02 UTC (rev 57866)
@@ -5,39 +5,39 @@
<p>Generating the LRM is accomplished in 7 steps (Hesse 2010:69):</p>
<ol>
<li>Creation of the DEM from the LIDAR data. Buildings, trees and other objects on the earth's surface should be removed.</li>
- <li>Apply a low pass filter to the DEM. The low pass filter approximates the large-scale landscape forms. The kernel size of the low pass filter determines the scale of features that will be visible in the LRM. A default kernel size of 25 is used.</li>
+ <li>Apply a low pass filter to the DEM. The low pass filter approximates the large-scale landforms. The neighborhood size of the low pass filter determines the scale of features that will be visible in the LRM. A default neighborhood size of 11 is used.</li>
<li>Subtract the low-pass filter result from the DEM to get the local relief.</li>
<li>Extract the zero contour lines from the difference map.</li>
- <li>Extract the point elevations from the DEM along the zero contour lines.</li>
- <li>Create a purged DEM from the point elevations extracted in the last step. This layer represents the large-scale landscape forms that will be removed to expose the local relief in the final step. v.surf.bspline is used to interpolate the points to a raster.</li>
+ <li>Extract the input DEM's elevation values along the zero contour lines.</li>
+ <li>Create a purged DEM by interpolating the null values between the rasterized contours generated in the previous step. This layer represents the large-scale landforms that will be removed to expose the local relief in the final step. This step is performed by the <a href="r.fillnulls.html">r.fillnulls</a> module using cubic spline interpolation.</li>
<li>Subtract the purged DEM from the original DEM to get the local relief model.
</ol>
-Note that these steps are not completely valid for Vaclav's implementation which uses <a href="r.fillnulls.html">r.fillnulls</a> module.
<h2>OUTPUT</h2>
<p>
-The final local relief model gets the name specified by the <em>output</em> parameter.
-When the <em>-i</em> is specified <em>r.local.relief</em> creates six additional output files one for each step in the LRM creation process. The names consist of the user-specified <em>output</em> parameter and the following suffixes:</p>
+The final local relief model is named according to the <em>output</em> parameter.
+When the <em>-i</em> flag is specified, <em>r.local.relief</em> creates four additional output files representing the intermediate steps in the LRM generation process. The names of the intermediate fiels are composed of the user-specified <em>output</em> parameter and the following suffixes:</p>
<ul>
<li><tt>_smooth_elevation</tt>: The result of running the low pass filter on the DEM.</li>
- <li><tt>_subtracted_smooth_elevation:s</tt> The result of subtracting the low pass filter map from the DEM.</li>
- <li><tt>_vector_contours:s</tt> The zero contours extracted from the subtracted smooth elevation map.</li>
- <li><tt>raster_contours</tt>: The rasterized zero contours.</li>
+ <li><tt>_subtracted_smooth_elevation</tt>: The result of subtracting the low pass filter map from the DEM.</li>
<li><tt>raster_contours_with_values</tt>: The rasterized zero contours with the values from elevation map.</li>
- <li><tt>_purged_elevation:s</tt> The raster interpolated from the raster map based on zero contours map.</li>
+ <li><tt>_purged_elevation</tt>: The raster interpolated from the raster map based on zero contours map.</li>
</ul>
-Note that this is not implemented yet, you must change the variable save_intermediates in the code itself.
<h2>EXAMPLE</h2>
-Basic example using the default kernel size of 5:
+Basic example using the default neighborhood size of 11:
<div class="code"><pre>
-r.local.relief input=elevation output=lrm5
+r.local.relief input=elevation output=lrm11
</pre></div>
-Example with a custom kernel size of 11:
+Example with a custom neighborhood size of 25:
<div class="code"><pre>
-r.local.relief input=elevation output_prefix=lrm11 neighborhood_size=11
+r.local.relief input=elevation output=lrm25 neighborhood_size=25
</pre></div>
+Example using the default neighborhood size of 11 and saving the intermediate maps:
+<div class="code"><pre>
+r.local.relief -i input=elevation output=lrm11
+</pre></div>
<h2>SEE ALSO</h2>
Modified: grass-addons/grass7/raster/r.local.relief/r.local.relief.py
===================================================================
--- grass-addons/grass7/raster/r.local.relief/r.local.relief.py 2013-09-30 01:42:09 UTC (rev 57865)
+++ grass-addons/grass7/raster/r.local.relief/r.local.relief.py 2013-09-30 02:12:02 UTC (rev 57866)
@@ -5,7 +5,7 @@
# MODULE: r.local.relief
# AUTHOR(S): Vaclav Petras <wenzeslaus gmail.com>,
# Eric Goddard <egoddard memphis.edu>
-# PURPOSE: Create a local relief models from elevation map
+# PURPOSE: Create a local relief model from elevation map
# COPYRIGHT: (C) 2013 by the GRASS Development Team
#
# This program is free software under the GNU General Public
@@ -15,11 +15,13 @@
#############################################################################
#%module
-#% description: Creates a local relief models from elevation map.
+#% description: Creates a local relief model from elevation map.
#% keywords: raster
#% keywords: elevation
#% keywords: terrain
#% keywords: relief
+#% keywords: LRM
+#% keywords: visualization
#%end
#%option
#% type: string
@@ -40,15 +42,17 @@
#% type: integer
#% description: Neighborhood size used when smoothing the elevation model
#% options: 0-
-#% answer: 3
+#% answer: 11
#%end
+#%flag
+#% key: i
+#% description: Save intermediate maps
+#%end
# TODO: The step 5 (contours to smooth elevation) can be replaced by using
# vector tools (v.surf.*), this needs further testing.
# Note, that quality of interpolation highly determines the result.
-# TODO: implement save intermediate results flag
-# (code is ready, but consider also outputting only some useful ones)
import os
import atexit
@@ -71,7 +75,7 @@
def create_tmp_map_name(name):
- return '{mod}_{pid}_{map_}_tmp'.format(mod='r_shaded_pca',
+ return '{mod}_{pid}_{map_}_tmp'.format(mod='r_local_relief',
pid=os.getpid(),
map_=name)
@@ -89,15 +93,15 @@
def main():
atexit.register(cleanup)
- options, unused = gscript.parser()
+ options, flags = gscript.parser()
elevation_input = options['input']
local_relief_output = options['output']
neighborhood_size = int(options['neighborhood_size'])
+ save_intermediates = flags['i']
+
fill_method = 'cubic'
-
color_table = 'differences'
- save_intermediates = True
if save_intermediates:
def local_create(name):
@@ -115,7 +119,11 @@
raster_contours_with_values = create_map_name('raster_contours_with_values')
purged_elevation = create_map_name('purged_elevation')
- if not save_intermediates:
+ # if saving intermediates, keep only 1 contour layer
+ if save_intermediates:
+ RREMOVE.append(raster_contours)
+ VREMOVE.append(vector_contours)
+ else:
RREMOVE.append(smooth_elevation)
RREMOVE.append(subtracted_smooth_elevation)
VREMOVE.append(vector_contours)
More information about the grass-commit
mailing list