[GRASSLIST:1659] Re: automatic configuration of color table of a raster map

Kenlo Nishida nishida at bres.tsukuba.ac.jp
Mon Nov 3 18:54:51 EST 2003

Dear Hamish & GRASS users:

Thank you very much. It worked.

Kenlo Nishida

Hamish wrote:
Do you know any tools or commands which allow us to set and
customize color table of a raster map in an automatic manner?
Although we can set color table by r.colors and customize it
by d.colors, we cannot set the range or assign specific colors
to some special values (such as sea or filling values) without
interactive manipulation. I would appreciate if some commands
can support such functions automatically (capable for script).

For example, I have more than 100 images of AVHRR/NDVI, and
the water body is masked with a value of 255, and the cloud
is masked with a value of 254, and the range of NDVI values
is 0 to 100, and I want to assign rainbow colors to NDVI,
black to water body, and white to cloud to every image.

try this in your script:

r.colors map=avhrr_map color=rules << EOF
0 yellow
20 green
40 0 255 255   # cyan
60 blue
80 magenta
100 red
101 grey
253 grey
254 white
255 black


Kenlo Nishida
Institute of Agricultural and Forest Engineering
University of Tsukuba, Japan 305-8572
kenlo at sakura.cc.tsukuba.ac.jp

More information about the grass-user mailing list