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

« back to all changes in this revision

Viewing changes to raster/r.colors/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
 
<i>r.colors</i> allows the user to create and/or modify the color table for a
4
 
raster map layer. The map layer (specified on the command line by
5
 
<b>map=</b><i>name</i>) must exist in the user's current mapset search path.
6
 
 
7
 
<p>
8
 
The <b>rast</b> option allows user to specify a raster map <i>name</i> from which
9
 
to copy the color map.
10
 
 
11
 
<p>
12
 
All color tables are stored in $GISBASE/etc/colors/. Further user-defined color tables
13
 
can also be stored in this directory for access from the <em>color</em> parameter.
14
 
<p>
15
 
The <b>-e</b> flag equalizes the original raster's color table. It can preclude
16
 
the need for <em>grey.eq</em> rule, when used as
17
 
<b>-e color=</b><em>grey</em>. Note however, that this will not yield a color
18
 
table identical to <em>color=grey.eq</em>, because <em>grey.eq</em> scales
19
 
the fraction by 256 to get a grey level, while <b>-e</b> uses it to interpolate
20
 
the original colour table. If the original colour table is a 0-255 grey scale,
21
 
<b>-e</b> is effectively scaling the fraction by 255. Different algorithms are
22
 
used. <b>-e</b> is designed to work with any color table, both the floating
23
 
point and the integer raster maps.
24
 
 
25
 
<p>
26
 
The <b>-g</b> flag divides the raster's grey value range into 100
27
 
logarithmically equal steps (where "step" is a rule with the same grey level
28
 
for the start and end points). It can preclude the need for <em>grey.log</em>
29
 
rule, when used as <b>-g color=</b><em>grey</em>. Note however, that this
30
 
will not yield a color table identical to <em>color=grey.log</em>. Different
31
 
algorithms are used. Unlike <b>color=</b><em>grey.log</em>, <b>-g</b> is
32
 
designed to work with both floating point and integer rasters, without
33
 
performance issues with large datasets, of any original color table. Logarithmic
34
 
scaling doesn't work on negative values. In the case when the value range
35
 
includes zero, there's no realistic solution.
36
 
 
37
 
<p>
38
 
The <b>-e</b> and <b>-g</b> flags are not mutually exclusive.
39
 
 
40
 
<p>
41
 
If the user specifies the <b>-w</b> flag, the current color table file for
42
 
the input map will not be overwritten. This means that the color table is
43
 
created only if the <i>map</i> does not already have a color table. If this
44
 
option is not specified, the color table will be created if one does not
45
 
exist, or modified if it does.
46
 
 
47
 
<p>
48
 
If the user sets the <b>-q</b> flag, <i>r.colors</i> will run quietly,
49
 
Without printing numerous messages on its progress to standard output.
50
 
<p>Color table types <i>aspect, grey, grey.eq</i> (histogram-equalized grey
51
 
scale), <i>byg</i> (blue-yellow-green), <i>byr</i> (blue-yellow-red),
52
 
<i>gyr</i> (green-yellow-red), <i>rainbow, ramp, ryg</i> (red-yellow-green),
53
 
<i>random</i>, and <i>wave</i> are pre-defined color tables that
54
 
<i>r.colors</i> knows how to create without any further input.
55
 
 
56
 
<p>
57
 
In general, tables which associate colors with percentages (aspect, bcyr, byg,
58
 
byr, elevation, grey, gyr, rainbow, ramp, ryb, ryg and wave) can be applied to
59
 
any data, while those which use absolute values (aspectcolr, curvature, etopo2,
60
 
evi, ndvi, population, slope, srtm, and terrain) only make sense for data with
61
 
certain ranges.
62
 
 
63
 
One can get a rough idea of the applicability of a colour table by reading the
64
 
corresponding rules file ($GISBASE/etc/colors/&lt;name&gt;).
65
 
For example the <em>slope</em> rule is defined as:
66
 
 
67
 
<div class="code"><pre>
68
 
0  255:255:255
69
 
2  255:255:0
70
 
5  0:255:0
71
 
10 0:255 255
72
 
15 0:0:255
73
 
30 255:0:255
74
 
50 255:0:0
75
 
90 0:0:0
76
 
</pre></div>
77
 
 
78
 
<p>
79
 
This is designed for the slope map generated by r.slope.aspect, where the value
80
 
is a slope angle between 0 and 90 degrees.
81
 
 
82
 
<p>
83
 
Similarly, the <em>aspectcolr</em> rule:
84
 
 
85
 
<div class="code"><pre>
86
 
0 white
87
 
1 yellow
88
 
90 green
89
 
180 cyan
90
 
270 red
91
 
360 yellow
92
 
</pre></div>
93
 
 
94
 
<p>
95
 
is designed for the aspect maps produced by r.slope.aspect, where the value is a
96
 
heading between 0 and 360 degrees.
97
 
 
98
 
<p>
99
 
The <i>rules</i> color table type will cause <i>r.colors</i> to read color
100
 
table specifications from standard input (stdin) and will build the color table
101
 
accordingly.
102
 
 
103
 
<p>
104
 
Using color table type <i>rules</i>, there are <!--three-->two ways to build a color
105
 
table: <!--by color list,--> by category values and by "percent" values.
106
 
 
107
 
<!-- HB: this causes an error in current code, maybe easy to enable functionality from old code??
108
 
<p>
109
 
Building a customized color table by color list is the simplest of the three
110
 
rules methods: just list the colors you wish to appear in the color table in the
111
 
order that you wish them to appear. Use the standard GRASS color names: white,
112
 
black, red, green, blue, yellow, magenta, cyan, aqua, grey, gray, orange, brown,
113
 
purple, violet, and indigo.
114
 
 
115
 
<p>
116
 
For example, to create a color table for the raster map layer <i>elevation</i>
117
 
that assigns greens to low map category values, browns to the next larger
118
 
map category values, and yellows to the still larger map category values,
119
 
one would type:
120
 
 
121
 
<div class="code"><pre>
122
 
<b>r.colors map=</b><i>elevation</i> <b>color=</b><i>rules</i>
123
 
green
124
 
brown
125
 
yellow
126
 
end
127
 
</pre></div>
128
 
-->
129
 
<p>
130
 
To build a color table by category values' indices, the user should determine
131
 
the range of category values in the raster map layer with which the color table
132
 
will be used. Specific category values will then be associated with specific
133
 
colors. Note that a color does not have to be assigned for every valid category
134
 
value because <i>r.colors</i> will interpolate a color ramp to fill in where
135
 
color specification rules have been left out. The format of such a specification
136
 
is as follows:
137
 
 
138
 
<div class="code"><pre>
139
 
category_value color_name
140
 
category_value color_name
141
 
.. ..
142
 
.. ..
143
 
category_value color_name
144
 
end
145
 
</pre></div>
146
 
 
147
 
<p>
148
 
Each category value must be valid for the raster map layer, category values must
149
 
be in ascending order and only use standard GRASS color names (aqua, black, blue,
150
 
brown, cyan, gray, green, grey, indigo, magenta, orange, purple, red, violet, white, yellow).
151
 
 
152
 
<p>
153
 
Colors can also be specified by color numbers each in the range 0-255. The
154
 
format of a category value color table specification using color numbers instead
155
 
of color names is as follows:
156
 
 
157
 
<div class="code"><pre>
158
 
category_value red_number:green_number:blue_number
159
 
category_value red_number:green_number:blue_number
160
 
.. .. .. ..
161
 
.. .. .. ..
162
 
category_value red_number:green_number:blue_number
163
 
end
164
 
</pre></div>
165
 
 
166
 
<p>
167
 
Specifying a color table by "percent" values allows one to treat a color table
168
 
as if it were numbered from 0 to 100. The format of a "percent" value color
169
 
table specification is the same as for a category value color specification,
170
 
except that the category values are replaced by "percent" values, each from
171
 
0-100, in ascending order. The format is as follows:
172
 
 
173
 
<div class="code"><pre>
174
 
percent_value% color_name
175
 
percent_value% color_name
176
 
.. ..
177
 
.. ..
178
 
percent_value% color_name
179
 
end
180
 
</pre></div>
181
 
 
182
 
<p>
183
 
Using "percent" value color table specification rules, colors can also
184
 
be specified by color numbers each in the range 0-255. The format of a
185
 
percent value color table specification using color numbers instead of
186
 
color names is as follows:
187
 
 
188
 
<div class="code"><pre>
189
 
percent_value% red_number:green_number:blue_number
190
 
percent_value% red_number:green_number:blue_number
191
 
.. .. .. ..
192
 
.. .. .. ..
193
 
percent_value% red_number:green_number:blue_number
194
 
end
195
 
</pre></div>
196
 
 
197
 
<p>
198
 
Note that you can also mix these <!--three-->two methods of color table
199
 
specification; for example:
200
 
 
201
 
<div class="code"><pre>
202
 
0 black
203
 
10% yellow
204
 
78 blue<!--\n magenta
205
 
purple
206
 
brown-->
207
 
100% 0:255:230
208
 
end
209
 
</pre></div>
210
 
 
211
 
<p>
212
 
To set the NULL (no data) color, use the "nv" parameter:
213
 
 
214
 
<div class="code"><pre>
215
 
0 black
216
 
10% yellow
217
 
nv white
218
 
end
219
 
</pre></div>
220
 
 
221
 
<p>
222
 
To set the color to used for undefined values (beyond the range of
223
 
the color rules) use the "default" parameter:
224
 
 
225
 
<div class="code"><pre>
226
 
0 red
227
 
1 blue
228
 
default grey
229
 
end
230
 
</pre></div>
231
 
 
232
 
 
233
 
<h2>EXAMPLES</h2>
234
 
 
235
 
The below example shows how you can specify colors for a three category map,
236
 
assigning red to category 1, green to category 2, and blue to category 3. Start
237
 
by using a text editor to create the following rules specification file (save it
238
 
with the name <i>rules.file</i>):
239
 
 
240
 
<div class="code"><pre>
241
 
1 red
242
 
2 green
243
 
3 blue
244
 
end
245
 
</pre></div>
246
 
 
247
 
<p>
248
 
The color table can then by assigned to map <i>threecats</i> by the following
249
 
GRASS commands (two ways are available):
250
 
 
251
 
<div class="code"><pre>
252
 
# read input from stdin
253
 
cat rules.file | r.colors map=threecats color=rules
254
 
 
255
 
# read directly from file
256
 
r.colors map=threecats rules=rules.file
257
 
</pre></div>
258
 
 
259
 
<p><br>
260
 
To create a natural looking lookup table (LUT) for true map layer
261
 
<i>elevation</i>, use the
262
 
following rules specification file. It will assign light green shades to the
263
 
lower elevations (first 20% of the LUT), and then darker greens (next 15%, and
264
 
next 20%) and light browns (next 20%) for middle elevations, and darker browns
265
 
(next 15%) for higher elevations, and finally yellow for the highest peaks (last
266
 
10% of LUT).
267
 
 
268
 
<div class="code"><pre>
269
 
0% 0:230:0
270
 
20% 0:160:0
271
 
35% 50:130:0
272
 
55% 120:100:30
273
 
75% 120:130:40
274
 
90% 170:160:50
275
 
100% 255:255:100
276
 
</pre></div>
277
 
 
278
 
<p><br>
279
 
To invert the current rules: 
280
 
<div class="code"><pre>
281
 
r.colors current_raster -n rast=current_raster
282
 
</pre></div>
283
 
 
284
 
 
285
 
<h2>SEE ALSO</h2>
286
 
 
287
 
<em>
288
 
<a href="d.colors.html">d.colors</a>,
289
 
<a href="d.colortable.html">d.colortable</a>,
290
 
<a href="d.histogram.html">d.histogram</a>,
291
 
<a href="d.legend.html">d.legend</a>,
292
 
<a href="r.colors.stddev.html">r.colors.stddev</a>,
293
 
<a href="r.support.html">r.support</a>,
294
 
<a href="r.univar.html">r.univar</a>,
295
 
<a href="v.colors.html">v.colors</a>
296
 
</em>
297
 
 
298
 
<p>
299
 
See also wiki
300
 
page <a href="http://grasswiki.osgeo.org/wiki/Color_tables">Color
301
 
tables</a> (from GRASS User Wiki)
302
 
 
303
 
<p>
304
 
<a href="http://colorbrewer.org">ColorBrewer</a> is an online tool designed to
305
 
help people select good color schemes for maps and other graphics.
306
 
 
307
 
 
308
 
<h2>AUTHORS</h2>
309
 
Michael Shapiro and David Johnson
310
 
 
311
 
<p>
312
 
<i>Last changed: $Date: 2013-02-15 23:04:18 +0100 (Fri, 15 Feb 2013) $</i>