3
<em>r.reclass</em> creates an <em>output</em> map layer
4
based on an <em>input</em> integer raster map layer. The output
5
map layer will be a reclassification of the input map layer
6
based on reclass rules input to <em>r.reclass</em>, and can
7
be treated in much the same way that raster maps are
8
treated. A <em>TITLE</em> for the output map layer may be
9
(optionally) specified by the user.
12
The reclass rules are read from standard input (i.e., from
13
the keyboard, redirected from a file, or piped through
17
Before using <em>r.reclass</em> the user must know the following:
20
<li>The new categories desired; and, which old categories fit into
22
<li>The names of the new categories.
27
In fact, the <em>r.reclass</em> program does <em>not</em> generate any new
28
raster map layers (in the interests of disk space conservation). Instead, a
29
<b>reclass table</b> is stored which will be used to reclassify the
30
original raster map layer each time the new (reclassed) map name
31
is requested. As far as the user (and programmer) is concerned, that
32
raster map has been created.
35
<em>r.reclass</em> only works on an <i>integer</i> input raster map; if the
36
input map is instead floating point data, you must multiply the input data by some
37
factor to acheive whole number input data, otherwise <em>r.reclass</em> will round
38
the raster values down to the next integer.
41
Also note that although the user can generate a <em>r.reclass</em> map
42
which is based on another <em>r.reclass</em> map,
43
the new <em>r.reclass</em> map map will be stored in GRASS as a reclass
44
of the <em>original</em> raster map on which the first reclassed map was
45
based. Therefore, while GRASS allows the user to provide <em>r.reclass</em>
46
map layer information which is based on an already reclassified map
47
(for the user's convenience), no <em>r.reclass</em> map layer
48
(i.e., <em>reclass table</em>) will ever be <em>stored</em>
49
as a <em>r.reclass</em> of a <em>r.reclass</em>.
52
To convert a reclass map to a regular raster map layer, set your
53
geographic region settings to match the settings in the header for the
54
reclass map (with "<tt>g.region rast=reclass_map</tt>", or
55
viewable by running <em><a href="r.info.html">r.info</a></em>)
56
and then run <em><a href="r.resample.html">r.resample</a></em>.
59
<em><a href="r.mapcalc.html">r.mapcalc</a></em> can be used to convert
60
a reclass map to a regular raster map layer as well:
62
<div class="code"><pre>
63
r.mapcalc "raster_map = reclass_map"
68
where <em>raster_map</em> is the name to be given to the new raster map,
69
and <em>reclass_map</em> is an existing reclass map.
72
Because <em>r.reclass</em> generates a table referencing some original
73
raster map layer rather than creating a reclassed raster map layer,
74
a <em>r.reclass</em> map layer will no longer be accessible if
75
the original raster map layer upon which it was based is later removed.
78
A <em>r.reclass</em> map is not a true raster map layer.
79
Rather, it is a table of reclassification values which reference the
80
input raster map layer. Therefore, users who wish to retain reclassified
81
map layers must also save the original input raster map layers
82
from which they were generated. Alternatively r.recode can be used.
85
Category values which are not explicitly reclassified to a new value
86
by the user will be reclassified to NULL.
89
<h3>Reclass Rules</h3>
91
Each line of input must have the following format:
94
<dd><b>input_categories=</b><em>output_category </em>[<em>label</em>]
98
where each line of input specifies the category values in the
99
input raster map layer to be reclassified to the new
100
<em>output_category</em> category value. Specification of
101
a <em>label</em> to be associated with the new output map
102
layer category is optional. If specified, it is recorded
103
as the category label for the new category value. The
104
equal sign = is required. The <em>input_category(ies)</em>
105
may consist of single category values or a range of such
106
values in the format "<em>low</em> thru <em>high</em>." The
107
word "thru" must be present.
109
To include all (remaining) values the asterix "*" can be used. This
110
rule has to be set as last rule. No further rules are accepted after
111
setting this rule. The special rule "<tt>* = *</tt>" specifies
112
that all categories not expicitly set by one of the above rules
113
should be passed through unaltered instead of being set to NULL.
115
Categories to become no data are specified by setting the output
116
category value to "<tt>NULL</tt>".
119
A line containing only the word <b>end</b> terminates the
125
The following examples may help clarify the reclass rules.
129
<dd>1. This example reclassifies categories 1, 2 and 3 in the input raster
130
map layer "roads" to category 1 with category label "good quality" in the output map
131
layer, and reclassifies input raster map layer categories 4 and 5 to
132
category 2 with the label "poor quality" in the output map layer.
135
1 2 3 = 1 good quality
141
<dd>2. This example reclassifies categories 1, 3 and 5 in the input raster
142
map layer to category 1 with category label "poor quality" in the output
143
map layer, and reclassifies input raster map layer categories 2, 4, and 6
144
to category 2 with the label "good quality" in the output map layer.
145
All other values are reclassified to NULL.
147
1 3 5 = 1 poor quality
148
2 4 6 = 2 good quality
153
<dd>3. This example reclassifies input raster map layer categories 1 thru 10 to output
154
map layer category 1, input map layer categories 11 thru 20 to output map layer
155
category 2, and input map layer categories 21 thru 30 to output map layer
156
category 3, all without labels. The range from 30 to 40 is reclassified as
166
<dd>4. Subsequent rules override previous rules. Therefore, the below example
167
reclassifies input raster map layer categories 1 thru 19 and 51 thru 100
168
to category 1 in the output map layer,
169
input raster map layer categories 20 thru 24 and 26 thru 50 to
170
the output map layer category 2, and input raster map layer category 25
171
to the output category 3.
173
1 thru 100 = 1 poor quality
174
20 thru 50 = 2 medium quality
179
<dd>5. The previous example could also have been entered as:
181
1 thru 19 51 thru 100 = 1 poor quality
182
20 thru 24 26 thru 50 = 2 medium quality
187
1 thru 19 = 1 poor quality
190
26 thru 50 = 2 medium quality
197
The final example was given to show how the labels are handled. If a new
198
category value appears in more than one rule (as is the case with new
199
category values 1 and 2),
200
the last label which was specified becomes the label for that category.
201
In this case the labels are assigned exactly as in the two previous examples.
206
<em><a href="r.resample.html">r.resample</a></em>,
207
<em><a href="r.rescale.html">r.rescale</a></em>,
208
<em><a href="r.recode.html">r.recode</a></em>
213
James Westervelt,<br>
215
U.S.Army Construction Engineering Research Laboratory
218
<i>Last changed: $Date: 2009-09-19 17:10:59 +0200 (Sat, 19 Sep 2009) $</i>