[GRASS-SVN] r72825 - grass-addons/grass7/raster/r.lfp
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 14 07:53:58 PDT 2018
Author: hcho
Date: 2018-06-14 07:53:57 -0700 (Thu, 14 Jun 2018)
New Revision: 72825
Added:
grass-addons/grass7/raster/r.lfp/r_lfp_nc_example_multiple.png
grass-addons/grass7/raster/r.lfp/r_lfp_nc_example_single.png
Removed:
grass-addons/grass7/raster/r.lfp/r_lfp_nc_example.png
Modified:
grass-addons/grass7/raster/r.lfp/r.lfp.html
Log:
r.lfp: Add an example for sub-watershed LFPs
Modified: grass-addons/grass7/raster/r.lfp/r.lfp.html
===================================================================
--- grass-addons/grass7/raster/r.lfp/r.lfp.html 2018-06-14 14:03:57 UTC (rev 72824)
+++ grass-addons/grass7/raster/r.lfp/r.lfp.html 2018-06-14 14:53:57 UTC (rev 72825)
@@ -23,8 +23,9 @@
<h2>EXAMPLES</h2>
-<h3>North Carolina sample dataset example</h3>
+These examples use the North Carolina sample dataset.
+<p>Create the longest flow path for one outlet:
<div class="code"><pre>
# set computational region
g.region raster=elevation -p
@@ -39,10 +40,9 @@
r.lfp input=drain_directions output=lfp coordinates=642455,222614
</pre></div>
-<img src="r_lfp_nc_example.png">
+<img src="r_lfp_nc_example_single.png">
-<h3>Multiple outlets</h3>
-
+<p>There are different ways to calculate multiple longest flow paths in one run:
<div class="code"><pre>
# calculate longest flow paths at two outlets
r.lfp input=drain_directions output=lfp coordinates=642455,222614,642306,222734
@@ -63,6 +63,34 @@
id=1,2 id_column=lfp_id outlet_id_column=outlet_id
</pre></div>
+<p>Calculate the longest flow paths for sub-watersheds:
+<div class="code"><pre>
+# get nsres
+eval `r.info -g map=elevation`
+
+# delineate streams using a threshold
+r.stream.extract elevation=elevation threshold=50000 stream_vector=streams
+
+# populate stream lengths
+v.db.addcolumn map=streams columns="length double"
+v.to.db map=streams option=length columns=length
+
+# create points along the streams starting from downstream
+v.to.points -r input=streams output=stream_points dmax=$nsres
+
+# find outlets (downstream-most less nsres points)
+cats=`db.select -c sql="select stream_points_2.cat from stream_points_2 \
+ inner join stream_points_1 on stream_points_1.cat = stream_points_2.lcat \
+ where length-along > 0.5*$nsres and length-along < 1.5*$nsres"`
+cats=`echo $cats | tr " " ,`
+v.extract input=stream_points layer=2 cats=$cats output=stream_outlets
+
+# create the longest flow paths for all outlets
+r.lfp input=drain_directions output=lfp id_column=id outlet=stream_outlets outlet_id_column=lcat layer=2
+</pre></div>
+
+<img src="r_lfp_nc_example_multiple.png">
+
<h2>SEE ALSO</h2>
<em>
Deleted: grass-addons/grass7/raster/r.lfp/r_lfp_nc_example.png
===================================================================
(Binary files differ)
Added: grass-addons/grass7/raster/r.lfp/r_lfp_nc_example_multiple.png
===================================================================
(Binary files differ)
Index: grass-addons/grass7/raster/r.lfp/r_lfp_nc_example_multiple.png
===================================================================
--- grass-addons/grass7/raster/r.lfp/r_lfp_nc_example_multiple.png 2018-06-14 14:03:57 UTC (rev 72824)
+++ grass-addons/grass7/raster/r.lfp/r_lfp_nc_example_multiple.png 2018-06-14 14:53:57 UTC (rev 72825)
Property changes on: grass-addons/grass7/raster/r.lfp/r_lfp_nc_example_multiple.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Copied: grass-addons/grass7/raster/r.lfp/r_lfp_nc_example_single.png (from rev 72824, grass-addons/grass7/raster/r.lfp/r_lfp_nc_example.png)
===================================================================
(Binary files differ)
More information about the grass-commit
mailing list