~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to raster/r.reclass/description.html

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<h2>DESCRIPTION</h2>
2
 
 
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.
10
 
 
11
 
<p>
12
 
The reclass rules are read from standard input (i.e., from
13
 
the keyboard, redirected from a file, or piped through
14
 
another program).
15
 
 
16
 
<p>
17
 
Before using <em>r.reclass</em> the user must know the following:
18
 
 
19
 
<ol>
20
 
<li>The new categories desired;  and, which old categories fit into 
21
 
which new categories.
22
 
<li>The names of the new categories.
23
 
</ol>
24
 
 
25
 
<h2>NOTES</h2>
26
 
 
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.
33
 
 
34
 
<p>
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.
39
 
 
40
 
<p>
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>.
50
 
 
51
 
<p>
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&nbsp;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>.
57
 
 
58
 
<p>
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:
61
 
 
62
 
<div class="code"><pre>
63
 
  r.mapcalc "raster_map = reclass_map"
64
 
</pre></div>
65
 
 
66
 
 
67
 
<p>
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.
70
 
 
71
 
<p>
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.
76
 
 
77
 
<p>
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.
83
 
 
84
 
<p>
85
 
Category values which are not explicitly reclassified to a new value
86
 
by the user will be reclassified to NULL.
87
 
 
88
 
 
89
 
<h3>Reclass Rules</h3>
90
 
 
91
 
Each line of input must have the following format:
92
 
 
93
 
<dl>
94
 
<dd><b>input_categories=</b><em>output_category  </em>[<em>label</em>]
95
 
</dl>
96
 
 
97
 
<p>
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.
108
 
<p>
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.
114
 
<p>
115
 
Categories to become no data are specified by setting the output
116
 
category value to "<tt>NULL</tt>".
117
 
<p>
118
 
 
119
 
A line containing only the word <b>end</b> terminates the
120
 
input.
121
 
 
122
 
 
123
 
<h2>EXAMPLES</h2>
124
 
 
125
 
The following examples may help clarify the reclass rules.
126
 
<p>
127
 
<dl>
128
 
<dt> 
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.
133
 
 
134
 
<pre>
135
 
    1 2 3   = 1    good quality
136
 
    4 5     = 2    poor quality
137
 
</pre>
138
 
 
139
 
 
140
 
<p>
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.
146
 
<pre>
147
 
    1 3 5   = 1    poor quality
148
 
    2 4 6   = 2    good quality
149
 
    *       = NULL
150
 
</pre>
151
 
 
152
 
<p>
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
157
 
NULL.
158
 
<pre>
159
 
     1 thru 10  = 1
160
 
    11 thru 20  = 2
161
 
    21 thru 30  = 3
162
 
    30 thru 40  = NULL
163
 
</pre>
164
 
 
165
 
<p>
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.
172
 
<pre>
173
 
     1 thru 100 = 1    poor quality
174
 
    20 thru 50  = 2    medium quality
175
 
    25          = 3    good quality
176
 
</pre>
177
 
 
178
 
<p>
179
 
<dd>5. The previous example could also have been entered as:
180
 
<pre>
181
 
     1 thru 19  51 thru 100     = 1    poor quality
182
 
    20 thru 24  26 thru 50      = 2    medium quality
183
 
    25                          = 3    good quality
184
 
</pre>
185
 
or as:
186
 
<pre>
187
 
     1 thru 19   = 1    poor quality
188
 
    51 thru 100  = 1
189
 
    20 thru 24   = 2
190
 
    26 thru 50   = 2    medium quality
191
 
    25           = 3    good quality
192
 
</pre>
193
 
</dd>
194
 
</dl>
195
 
<p>
196
 
 
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.
202
 
 
203
 
 
204
 
<h2>SEE ALSO</h2>
205
 
 
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>
209
 
 
210
 
 
211
 
<h2>AUTHORS</h2>
212
 
 
213
 
James Westervelt,<br>
214
 
Michael Shapiro<br>
215
 
U.S.Army Construction Engineering Research Laboratory
216
 
 
217
 
<p>
218
 
<i>Last changed: $Date: 2009-09-19 17:10:59 +0200 (Sat, 19 Sep 2009) $</i>