Rechercher une page de manuel
r.colors
Langue: en
Version: 371713 (fedora - 01/12/10)
Section: 1 (Commandes utilisateur)
NAME
r.colors - Creates/modifies the color table associated with a raster map layer.KEYWORDS
raster, color tableSYNOPSIS
r.colorsr.colors help
r.colors [-rwlngeiq] [map=name] [color=style] [raster=string] [rules=name] [--verbose] [--quiet]
Flags:
- -r
Remove existing color table- -w
Only write new color table if one doesn't already exist- -l
List available rules then exit- -n
Invert colors- -g
Logarithmic scaling- -e
Histogram equalization- -i
Enter rules interactively- -q
Run quietly- --verbose
Verbose module output- --quiet
Quiet module output
Parameters:
- map=name
Name of input raster map- color=style
Type of color table
Options: aspect,aspectcolr,bcyr,bgyr,byg,byr,curvature,differences,elevation,etopo2,evi,grey,grey1.0,grey255,gyr,ndvi,population,rainbow,ramp,ryb,ryg,slope,srtm,terrain,wave,random,grey.eq,grey.log,rules
aspect: aspect oriented grey colors
aspectcolr: aspect oriented rainbow colors
bcyr: blue through cyan through yellow to red
bgyr: blue through green through yellow to red
byg: blue through yellow to green colors
byr: blue through yellow to red colors
curvature: for terrain curvatures (from v.surf.rst and r.slope.aspect curvature colors)
differences: differences oriented colors
elevation: maps percentage ranges of raster values to elevation color ramp
etopo2: rainbow color ramp for the ETOPO2 2-minute Worldwide Bathymetry/Topography dataset
evi: enhanced vegetative index colors
grey: grey scale
grey1.0: grey scale for raster values between 0.0-1.0
grey255: grey scale for raster values bewtween 0-255
gyr: green through yellow to red colors
ndvi: Normalized Difference Vegetation Index colors
population: color table covering human population classification breaks
rainbow: rainbow color table
ramp: color ramp
ryb: red through yellow to blue colors
ryg: red through yellow to green colors
slope: r.slope.aspect-type slope colors for raster values 0-90
srtm: color palette for Shuttle Radar Topography Mission elevation values
terrain: global elevation color table covering -11000 to +8850m
wave: color wave
random: random color table
grey.eq: histogram-equalized grey scale
grey.log: histogram logarithmic transformed grey scale
rules: create new color table based on user-specified rules- raster=string
Raster map name from which to copy color table- rules=name
Path to rules file
DESCRIPTION
r.colors allows the user to create and/or modify the color table for a raster map layer. The map layer (specified on the command line by map=name) must exist in the user's current mapset search path. The color table specified by color=type must be one of the following:color type description
aspect (aspect oriented grey colors)
aspectcolr (aspect oriented rainbow colors)
bcyr (blue through cyan through yellow to red)
bgyr (blue through green through yellow to red)
byg (blue through yellow to green colors)
byr (blue through yellow to red colors)
curvature (for terrain curvatures (from v.surf.rst and r.slope.aspect curvature colors))
differences (differences oriented colors)
elevation (maps percentage ranges of raster values to elevation color ramp)
etopo2 (rainbow color ramp for the ETOPO2 2-minute Worldwide Bathymetry/Topography dataset)
evi (enhanced vegetative index colors)
grey (grey scale)
grey1.0 (grey scale for raster values between 0.0-1.0)
grey255 (grey scale for raster values bewtween 0-255)
grey.eq (histogram-equalized grey scale)
grey.log (histogram logarithmic transformed grey scale)
gyr (green through yellow to red colors)
ndvi (Normalized Difference Vegetation Index colors)
population (color table covering human population classification breaks)
rainbow (rainbow color table)
ramp (color ramp)
random (random color table)
rules (create new color table based on user-specified rules)
ryb (red through yellow to blue colors)
ryg (red through yellow to green colors)
slope (r.slope.aspect-type slope colors for raster values 0-90)
srtm (color palette for Shuttle Radar Topography Mission elevation values)
terrain (global elevation color table covering -11000 to +8850m)
wave (color wave)
The rast option allows user to specify a raster map name from which to copy the color map.
Extra color tables (aspect, aspectcolr, bcyr, bgyr, byg, byr, curvature, differences, elevation, etopo2, evi, grey, grey1.0, grey255, gyr, ndvi, population, rainbow, ramp, ryb, ryg, slope, srtm, terrain, wave) are stored in $GISBASE/etc/colors/. User-defined color tables can also be stored in this directory for access from the color parameter.
The -e flag equalizes the original raster's color table. It can preclude the need for grey.eq rule, when used as -e color=grey. Note however, that this will not yield a color table identical to color=grey.eq, because grey.eq scales the fraction by 256 to get a grey level, while -e uses it to interpolate the original colour table. If the original colour table is a 0-255 grey scale, -e is effectively scaling the fraction by 255. Different algorithms are used. -e is designed to work with any color table, both the floating point and the integer raster maps.
The -g flag divides the raster's grey value range into 100 logarithmically equal steps (where "step" is a rule with the same grey level for the start and end points). It can preclude the need for grey.log rule, when used as -g color=grey. Note however, that this will not yield a color table identical to color=grey.log. Different algorithms are used. Unlike color=grey.log, -g is designed to work with both floating point and integer rasters, without performance issues with large datasets, of any original color table. Logarithmic scaling doesn't work on negative values. In the case when the value range includes zero, there's no realistic solution.
The -e and -g flags are not mutually exclusive.
If the user specifies the -w flag, the current color table file for the input map will not be overwritten. This means that the color table is created only if the map does not already have a color table. If this option is not specified, the color table will be created if one does not exist, or modified if it does.
If the user sets the -q flag, r.colors will run quietly, Without printing numerous messages on its progress to standard output.
Color table types aspect, grey, grey.eq (histogram-equalized grey scale), byg (blue-yellow-green), byr (blue-yellow-red), gyr (green-yellow-red), rainbow, ramp, ryg (red-yellow-green), random, and wave are pre-defined color tables that r.colors knows how to create without any further input.
In general, tables which associate colors with percentages (aspect, bcyr, byg, byr, elevation, grey, gyr, rainbow, ramp, ryb, ryg and wave) can be applied to any data, while those which use absolute values (aspectcolr, curvature, etopo2, evi, ndvi, population, slope, srtm, and terrain) only make sense for data with certain ranges. One can get a rough idea of the applicability of a colour table by reading the corresponding rules file ($GISBASE/etc/colors/). For example the slope rule is defined as:
0 255:255:255
2 255:255:0
5 0:255:0
10 0:255 255
15 0:0:255
30 255:0:255
50 255:0:0
90 0:0:0
This is designed for the slope map generated by r.slope.aspect, where the value is a slope angle between 0 and 90 degrees.
Similarly, the aspectcolr rule:
0 white
1 yellow
90 green
180 cyan
270 red
360 yellow
is designed for the aspect maps produced by r.slope.aspect, where the value is a heading between 0 and 360 degrees.
The rules color table type will cause r.colors to read color table specifications from standard input (stdin) and will build the color table accordingly.
Using color table type rules, there are two ways to build a color table: by category values and by "percent" values.
To build a color table by category values' indices, the user should determine the range of category values in the raster map layer with which the color table will be used. Specific category values will then be associated with specific colors. Note that a color does not have to be assigned for every valid category value because r.colors will interpolate a color ramp to fill in where color specification rules have been left out. The format of such a specification is as follows:
category_value color_name
category_value color_name
category_value color_name
end
Each category value must be valid for the raster map layer, category values must be in ascending order and only use standard GRASS color names (see above).
Colors can also be specified by color numbers each in the range 0-255. The format of a category value color table specification using color numbers instead of color names is as follows:
category_value red_number:green_number:blue_number
category_value red_number:green_number:blue_number
category_value red_number:green_number:blue_number
end
Specifying a color table by "percent" values allows one to treat a color table as if it were numbered from 0 to 100. The format of a "percent" value color table specification is the same as for a category value color specification, except that the category values are replaced by "percent" values, each from 0-100, in ascending order. The format is as follows:
percent_value% color_name
percent_value% color_name
percent_value% color_name
end
Using "percent" value color table specification rules, colors can also be specified by color numbers each in the range 0-255. The format of a percent value color table specification using color numbers instead of color names is as follows:
percent_value% red_number:green_number:blue_number
percent_value% red_number:green_number:blue_number
percent_value% red_number:green_number:blue_number
end
Note that you can also mix these two methods of color table specification; for example:
0 black
10% yellow
78 blue
100% 0:255:230
end
To set the NULL (no data) color, use the "nv" parameter:
0 black
10% yellow
nv white
end
EXAMPLES
The below example shows how you can specify colors for a three category map, assigning red to category 1, green to category 2, and blue to category 3. Start by using a text editor to create the following rules specification file (save it with the name rules.file):1 red
2 green
3 blue
end
The color table can then by assigned to map threecats by the following GRASS command:
cat rules.file | r.colors map=threecats color=rules
To create a natural looking LUT for true map layer elevation, use the following rules specification file. It will assign light green shades to the lower elevations (first 20% of the LUT), and then darker greens (next 15%, and next 20%) and light browns (next 20%) for middle elevations, and darker browns (next 15%) for higher elevations, and finally yellow for the highest peaks (last 10% of LUT).
0% 0:230:0
20% 0:160:0
35% 50:130:0
55% 120:100:30
75% 120:130:40
90% 170:160:50
100% 255:255:100
SEE ALSO
d.colors, d.colortable, d.legend, r.supportColorBrewer is an online tool designed to help people select good color schemes for maps and other graphics.
AUTHORS
Michael Shapiro and David JohnsonLast changed: $Date: 2008-02-24 12:16:04 +0100 (Sun, 24 Feb 2008) $
Full index
© 2003-2008 GRASS Development Team
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre