[GRASS-SVN] r58688 - grass/trunk/raster/r.lake

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 12 15:02:41 PST 2014


Author: wenzeslaus
Date: 2014-01-12 15:02:41 -0800 (Sun, 12 Jan 2014)
New Revision: 58688

Modified:
   grass/trunk/raster/r.lake/main.c
   grass/trunk/raster/r.lake/r.lake.html
Log:
r.lake: add standard option for coordinates (xy changed to coordinates), change wl option to water_level (backwards compatible in bash), parameters and user manual cosmetics (partially backported from r.lake.series in addons)

Modified: grass/trunk/raster/r.lake/main.c
===================================================================
--- grass/trunk/raster/r.lake/main.c	2014-01-12 21:43:37 UTC (rev 58687)
+++ grass/trunk/raster/r.lake/main.c	2014-01-12 23:02:41 UTC (rev 58688)
@@ -149,12 +149,14 @@
     module = G_define_module();
     G_add_keyword(_("raster"));
     G_add_keyword(_("hydrology"));
+    G_add_keyword(_("hazard"));
+    G_add_keyword(_("flood"));
     module->description = _("Fills lake at given point to given level.");
 
     tmap_opt = G_define_standard_option(G_OPT_R_ELEV);
 
     wlvl_opt = G_define_option();
-    wlvl_opt->key = "wl";
+    wlvl_opt->key = "water_level";
     wlvl_opt->description = _("Water level");
     wlvl_opt->type = TYPE_DOUBLE;
     wlvl_opt->required = YES;
@@ -163,18 +165,19 @@
     lake_opt->key = "lake";
     lake_opt->required = NO;
 
-    sdxy_opt = G_define_option();
-    sdxy_opt->key = "xy";
-    sdxy_opt->description = _("Seed point coordinates");
-    sdxy_opt->type = TYPE_DOUBLE;
-    sdxy_opt->key_desc = "east,north";
+    sdxy_opt = G_define_standard_option(G_OPT_M_COORDS);
+    sdxy_opt->label = _("Seed point coordinates");
+    sdxy_opt->description = _("Either this coordinates pair or a seed"
+	" map have to be specified");
     sdxy_opt->required = NO;
     sdxy_opt->multiple = NO;
 
     smap_opt = G_define_standard_option(G_OPT_R_MAP);
     smap_opt->key = "seed";
+    smap_opt->label =
+	_("Input raster map with given starting point(s) (at least 1 cell > 0)");
     smap_opt->description =
-	_("Name of input raster map with given starting point(s) (at least 1 cell > 0)");
+	_("Either this parameter or a coordinates pair have to be specified");
     smap_opt->required = NO;
 
     negative_flag = G_define_flag();
@@ -233,7 +236,7 @@
 	    G_fatal_error(_("Seed point outside the current region"));
     }
 
-    /* Open terran map */
+    /* Open terrain map */
     in_terran_fd = Rast_open_old(terrainmap, "");
 
     /* Open seed map */

Modified: grass/trunk/raster/r.lake/r.lake.html
===================================================================
--- grass/trunk/raster/r.lake/r.lake.html	2014-01-12 21:43:37 UTC (rev 58687)
+++ grass/trunk/raster/r.lake/r.lake.html	2014-01-12 23:02:41 UTC (rev 58688)
@@ -1,7 +1,8 @@
 <h2>DESCRIPTION</h2>
 
 <p>The module fills a lake to a target water level from a given start point. The user
-can think of it as <em>r.grow</em> with additional checks for elevation.  The resulting
+can think of it as <em><a href="r.grow">r.grow</a></em> with additional
+checks for elevation. The resulting
 raster map contains cells with values representing lake depth and NULL for all other 
 cells beyond the lake. Lake depth is reported relative to specified water level
 (specified level = 0 depth).
@@ -11,7 +12,7 @@
 
 <ul>
  <li>cells are below the specified elevation (i.e., water level);</li>
- <li>cells are connected with an initial cell (seed or E,N value);</li>
+ <li>cells are connected with an initial cell (seed or coordinates pair value);</li>
  <li>cells are not NULL or masked.</li>
 </ul>
 
@@ -40,12 +41,14 @@
 Negative output (the <b>-n</b> flag) is useful for visualisations in NVIZ. 
 It equals the mapcalc's expression <em>"negative = 0 - positive"</em>.
 
-<h3>MAPCALC EQUIVALENT - FOR GRASS HACKERS</h3>
+<h3>r.mapcalc equivalent - for GRASS hackers</h3>
 
 This module was initially created as a script using
-<em>r.mapcalc</em>. This had some limitations - it was slow and no
+<em><a href="r.mapcalc">r.mapcalc</a></em>.
+This had some limitations - it was slow and no
 checks where done to find out required iteration count. The shell script 
-code (using <em>r.mapcalc</em>) used in the original script is shown below:
+code (using <em><a href="r.mapcalc">r.mapcalc</a></em>) used
+in the original script is shown below:
 
 <div class="code"><pre>
 ${seedmap} = if( ${dem}, \
@@ -63,17 +66,19 @@
 </pre></div>
 
 <p>
-The ${seedmap} variable is replaced by seed map names, ${dem} with DEM map name, and
-${wlevel} with target water level.  To get single water level, this code block is
+The <tt>${seedmap}</tt> variable is replaced by seed map names, <tt>${dem}</tt>
+with DEM map name, and <tt>${wlevel}</tt> with target water level. To get
+single water level, this code block is
 called with same level numerous times (in a loop) as the lake grows by single cells
 during single run.
 
-<h2>BUGS/KNOWN ISSUES</h2>
+<h2>KNOWN ISSUES</h2>
 
 <ul>
   <li>The entire map is loaded into RAM.</li>
   <li>A completely negative seed map will not work! At least one cell must have 
-  a value > 0. Output from <em>r.lake -n</em> can NOT be used as input in the next run.</li>
+    a value > 0. Output from <tt>r.lake -n</tt> <em>cannot</em> be used
+    as input in the next run.</li>
 </ul>
 
 <h2>EXAMPLE</h2>
@@ -84,7 +89,7 @@
 g.region rast=elev_lid792_1m -p
 
 # water accumulation next to street dam
-r.lake elev_lid792_1m xy=638759.3,220264.1 wl=113.4 lake=flooding
+r.lake elev_lid792_1m coordinates=638759.3,220264.1 wl=113.4 lake=flooding
 
 # draw resulting lake map over shaded terrain map
 r.shaded.relief elev_lid792_1m



More information about the grass-commit mailing list