[GRASS-SVN] r44117 -
grass/branches/releasebranch_6_4/raster/r.recode
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Oct 31 04:46:46 EDT 2010
Author: martinl
Date: 2010-10-31 01:46:46 -0700 (Sun, 31 Oct 2010)
New Revision: 44117
Modified:
grass/branches/releasebranch_6_4/raster/r.recode/description.html
grass/branches/releasebranch_6_4/raster/r.recode/main.c
Log:
r.recode: minor changes in parameters, manual updated
(merge r44115 from trunk)
Modified: grass/branches/releasebranch_6_4/raster/r.recode/description.html
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.recode/description.html 2010-10-31 08:38:21 UTC (rev 44116)
+++ grass/branches/releasebranch_6_4/raster/r.recode/description.html 2010-10-31 08:46:46 UTC (rev 44117)
@@ -1,78 +1,85 @@
<h2>DESCRIPTION</h2>
-<em>r.recode</em> creates an output map layer based on an input raster map
-layer. The output map layer will be a recoding of the input map layer based
-on recode rules input to <em>r.recode</em>. A <em>title</em> for the output
-map layer may be (optionally) specified by the user.<p>
+<em>r.recode</em> creates an output raster map by recoding input
+raster map based on recode <b>rules</b>. A <b>title</b> for the output
+raster map may be (optionally) specified by the user.
-The recode rules are read from standard input (i.e., from the keyboard,
-redirected from a file, or piped through another program).<p>
+<p>
+The recode rules can be read from standard input (i.e., from the
+keyboard, redirected from a file, or piped through another program) by
+entering <b>rules=-</b>.
-The program will be run non-interactively if the user specifies the name of
-the raster map layer to be recoded, the <em>name</em> of an output layer to
-hold recoded map, and (optionally) the name of a title for the output map.
+<p>
+Rules are defined in one of these formats:
-Rules are defined in one of these formats:
-<pre>
+<div class="code"><pre>
old_low:old_high:new_low:new_high
old_low:old_high:new_val (i.e. new_high == new_low)
*:old_val:new_val (interval [inf, old_val])
old_val:*:new_val (interval [old_val, inf])
-</pre>
+</pre></div>
-<em>r.recode</em> is loosely based on r.reclass and uses the GRASS reclass
-library to convert the rasters. It has routines for converting to every
-possible combination of raster (eg. int to double, double to float, etc).
-Standard floating point raster precision is float, with <em>-d</em> double
-precision will be written.<br>
+<p>
+<em>r.recode</em> is loosely based
+on <em><a href="r.reclass.html">r.reclass</a></em> and uses the GRASS
+Reclass Library to convert the rasters. It has routines for converting
+to every possible combination of raster (eg. CELL to DCELL, DCELL to
+FCELL, etc). Standard floating point raster precision is float
+(FCELL), with <b>-d</b> double precision (DCELL) will be written.
+
+<p>
There are four basic routines that it accepts:
<ol>
-<li>old-low to old-high is reclassed to new-low to new high , where the
-user provides all four values. The program figures on the fly what type of
-raster should be created.
+ <li>old-low to old-high is reclassed to new-low to new high , where the
+ user provides all four values. The program figures on the fly what type of
+ raster should be created.
-<li>old-low to old-high is reclassed to a single new value. Anything outside
-the range is null.
+ <li>old-low to old-high is reclassed to a single new value. Anything outside
+ the range is null.
-<li> * to old-high will reclass everything less than old-high to a single
-new value.
-
-<li> old-low to * will reclass everything greater than old-low to a single
-new value.
+ <li> * to old-high will reclass everything less than old-high to a single
+ new value.
+
+ <li> old-low to * will reclass everything greater than old-low to a single
+ new value.
</ol>
-These four sets of arguments can be given on the command line, or piped via
-stdin or a file. More than one set of arguments is accepted.
+These four sets of arguments can be given on the command line, or
+piped via stdin or a file. More than one set of arguments is accepted.
<h2>EXAMPLES</h2>
-<b>Map type conversion</b><br>
+<h3>Map type conversion</h3>
-To simply convert a raster between formats (eg. int to float) the user would
-use the first argument. For example <br>
+To simply convert a raster between formats (eg. int to float) the user
+would use the first argument. For example
-<tt>10:1500:0.1:15.0</tt><br>
+<div class="code"><pre>
+ 10:1500:0.1:15.0
+</pre></div>
- would convert an old raster with range between 10 and 1500 to a float
-raster with range bewteen 0.1 and 15.0. <p>
+would convert an input raster map with range between 10 and 1500 to a
+float raster raster with range bewteen 0.1 and 15.0.
-<b>Value replacement</b><br>
+<h3>Value replacement</h3>
-r.recode can be used to replace existing cell values by others. The
-formatting is as described above. In following example the values 1, 2 and
-3 are replaced by 1.1, 7.5 resp. 0.4:<br>
+<em>r.recode</em> can be used to replace existing cell values by
+others. The formatting is as described above. In following example the
+values 1, 2 and 3 are replaced by 1.1, 7.5 resp. 0.4:
-<pre>
- r.recode in=oldmap out=newmap << EOF
+<div class="code"><pre>
+r.recode input=oldmap output=newmap << EOF
1:1:1.1:1.1
2:2:7.5:7.5
3:3:0.4:0.4
- EOF
-</pre>
+EOF
+</pre></div>
<h2>AUTHOR</h2>
+
CERL
-<p><i>Last changed: $Date$</i>
+<p>
+<i>Last changed: $Date$</i>
Modified: grass/branches/releasebranch_6_4/raster/r.recode/main.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.recode/main.c 2010-10-31 08:38:21 UTC (rev 44116)
+++ grass/branches/releasebranch_6_4/raster/r.recode/main.c 2010-10-31 08:46:46 UTC (rev 44117)
@@ -6,11 +6,11 @@
* Bob Covill <bcovill tekmap.ns.ca>, Hamish Bowman <hamish_nospam yahoo.com>,
* Jan-Oliver Wagner <jan intevation.de>
* PURPOSE: Recode categorical raster maps
- * COPYRIGHT: (C) 1999-2008 by the GRASS Development Team
+ * COPYRIGHT: (C) 1999-2006, 2010 by the GRASS Development Team
*
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
+ * This program is free software under the GNU General
+ * Public License (>=v2). Read the file COPYING that
+ * comes with GRASS for details.
*
*****************************************************************************/
#define MAIN
@@ -43,29 +43,31 @@
module->description = _("Recodes categorical raster maps.");
parm.input = G_define_standard_option(G_OPT_R_INPUT);
- parm.input->description = _("Raster map to be recoded");
-
+ parm.input->description = _("Name of raster map to be recoded");
+
parm.output = G_define_standard_option(G_OPT_R_OUTPUT);
parm.rules = G_define_standard_option(G_OPT_F_INPUT);
parm.rules->key = "rules";
+ parm.rules->required = NO;
parm.rules->label = _("File containing recode rules");
- parm.rules->required = NO;
-
+ parm.rules->description = _("\"-\" to read from stdin");
+ parm.rules->guisection = _("Required");
+
parm.title = G_define_option();
parm.title->key = "title";
parm.title->required = NO;
parm.title->type = TYPE_STRING;
- parm.title->description = _("Title for the resulting raster map");
-
+ parm.title->description = _("Title for output raster map");
+
parm.a = G_define_flag();
parm.a->key = 'a';
- parm.a->description = _("Align the current region to the input map");
+ parm.a->description = _("Align the current region to the input raster map");
parm.d = G_define_flag();
parm.d->key = 'd';
- parm.d->description = _("Force output to double map type (DCELL)");
-
+ parm.d->description = _("Force output to 'double' raster map type (DCELL)");
+
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
@@ -89,7 +91,7 @@
if (parm.rules->answer) {
srcfp = fopen(parm.rules->answer, "r");
if (!srcfp)
- G_fatal_error(_("Unable to open rules file <%s>"),
+ G_fatal_error(_("Unable to open file <%s>"),
parm.rules->answer);
}
More information about the grass-commit
mailing list