[GRASS-SVN] r69575 - grass-addons/grass7/raster/r.lfp
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Sep 26 03:41:10 PDT 2016
Author: neteler
Date: 2016-09-26 03:41:10 -0700 (Mon, 26 Sep 2016)
New Revision: 69575
Modified:
grass-addons/grass7/raster/r.lfp/r.lfp.html
grass-addons/grass7/raster/r.lfp/r.lfp.py
Log:
r.lfp addon: add check if r.stream.distance addon is installed; example added
Modified: grass-addons/grass7/raster/r.lfp/r.lfp.html
===================================================================
--- grass-addons/grass7/raster/r.lfp/r.lfp.html 2016-09-26 03:01:30 UTC (rev 69574)
+++ grass-addons/grass7/raster/r.lfp/r.lfp.html 2016-09-26 10:41:10 UTC (rev 69575)
@@ -11,14 +11,33 @@
path. An input drainage map can be created using <em>r.watershed</em> or
<em>r.stream.extract</em>.
-<h2>EXAMPLE</h2>
+<h2>EXAMPLES</h2>
+<h3>Workflow example</h3>
+
<div class="code"><pre>
r.watershed elevation=elev drainage=drain
r.water.outlet input=drain output=basin coordinates=-888857.11,1117788.38
r.lfp input=drain output=lfp coordinates=-888857.11,1117788.38
</pre></div>
+
+<h3>North Carolina sample dataset example</h3>
+
+<div class="code"><pre>
+# set computational region
+g.region raster=elevation -p
+
+# calculate drainage directions
+r.watershed elevation=elevation drainage=drain_directions
+
+# calculate outlet point related watershed
+r.water.outlet input=drain_directions output=basin coordinates=642309,222806
+
+# calculate longest flow path
+r.lfp input=drain_directions output=lfp coordinates=640304,223199
+</pre></div>
+
<h2>SEE ALSO</h2>
<em>
Modified: grass-addons/grass7/raster/r.lfp/r.lfp.py
===================================================================
--- grass-addons/grass7/raster/r.lfp/r.lfp.py 2016-09-26 03:01:30 UTC (rev 69574)
+++ grass-addons/grass7/raster/r.lfp/r.lfp.py 2016-09-26 10:41:10 UTC (rev 69575)
@@ -35,7 +35,20 @@
from grass.exceptions import CalledModuleError
+# check requirements
+def check_progs():
+ found_missing = False
+ prog = 'r.stream.distance'
+ if not grass.find_program(prog, '--help'):
+ found_missing = True
+ grass.warning(_("'%s' required. Please install '%s' first using 'g.extension %s'") % (prog, prog, prog))
+ if found_missing:
+ grass.fatal(_("An ERROR occurred running r.lfp"))
+
def main():
+ # check dependencies
+ check_progs()
+
input = options["input"]
output = options["output"]
coords = options["coordinates"]
More information about the grass-commit
mailing list