3
<em>r.recode</em> creates an output raster map by recoding input
4
raster map based on recode <b>rules</b>. A <b>title</b> for the output
5
raster map may be (optionally) specified by the user.
7
<p>The recode rules can be read from standard input (i.e., from the
8
keyboard, redirected from a file, or piped through another program) by
9
entering <b>rules=-</b>.
11
<p>Rules are defined in one of these formats:
13
<div class="code"><pre>
14
old_low:old_high:new_low:new_high
15
old_low:old_high:new_val (i.e. new_high == new_low)
16
*:old_val:new_val (interval [inf, old_val])
17
old_val:*:new_val (interval [old_val, inf])
20
<p><em>r.recode</em> is loosely based
21
on <em><a href="r.reclass.html">r.reclass</a></em> and uses the GRASS
22
Reclass Library to convert the rasters. It has routines for converting
23
to every possible combination of raster (eg. CELL to DCELL, DCELL to
24
FCELL, etc). Standard floating point raster precision is float
25
(FCELL), with <b>-d</b> double precision (DCELL) will be written.
27
<p>There are four basic routines that it accepts:
30
<li>old-low to old-high is reclassed to new-low to new high , where the
31
user provides all four values. The program figures on the fly what type of
32
raster should be created.
34
<li>old-low to old-high is reclassed to a single new value. Anything outside
37
<li> * to old-high will reclass everything less than old-high to a single
40
<li> old-low to * will reclass everything greater than old-low to a single
44
These four sets of arguments can be given on the command line, or
45
piped via stdin or a file. More than one set of arguments is accepted.
49
<h3>Map type conversion</h3>
51
To simply convert a raster between formats (eg. int to float) the user
52
would use the first argument. For example
54
<div class="code"><pre>
58
would convert an input raster map with range between 10 and 1500 to a
59
float raster raster with range bewteen 0.1 and 15.0.
61
<h3>Value replacement</h3>
63
<em>r.recode</em> can be used to replace existing cell values by
64
others. The formatting is as described above. In following example the
65
values 1, 2 and 3 are replaced by 1.1, 7.5 resp. 0.4:
67
<div class="code"><pre>
68
r.recode input=oldmap output=newmap rules=- << EOF
80
<p><i>Last changed: $Date: 2014-02-25 20:29:46 +0100 (Tue, 25 Feb 2014) $</i>