Neil Best pisze:
Has anyone come up with a way to convert a streched
color table for a
floating point map into a set of discrete colors? I
am thinking especially
of NDVI, so I would like to generate the list of 256
colors along the NDVI
floating point stretch to use with the result of
r.recode that I used to
convert my NDVI map to an integer map. If I could
properly set the color
table for that new map then I could maintain the
symbolization within GRASS
rather than having to spew a list of 256 colors for a
Mapserver configuration. Any thoughts?
Glynn already answered with r.what.color, here is how to automate that:
seq 255 | r.what.color -i mapname
but I wonder, are you using the r.colors color=ndvi rules?
they look like this:
cat $GISBASE/etc/colors/ndvi
-1. white
-0.3000 blue
-0.2000 205 193 173
0. 150 150 150
0.1000 120 100 51
0.3000 120 200 100
0.4000 28 144 3
0.6000 6 55 0
0.8000 10 30 25
1. 6 27 7
just substitute your new range for the -1.0 to 1.0 steps with r.colors
color=rules, as long as the recode was linear.
I think though that your easiest solution is to use NASA's 0-255 color rules. :)
http://oceancolor.gsfc.nasa.gov/DOCS/palette_ndvi.txt
http://oceancolor.gsfc.nasa.gov/PRODUCTS/colorbars.html
you might be able to pipe those directly into r.colors or use them with
r.colors rules=palette_ndvi.txt.
see also http://grass.osgeo.org/wiki/MODIS#Set_colors
Hamish
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user