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?
--
View this message in context: http://www.nabble.com/exploding-a-color-table-tp17680217p17680217.html
Sent from the Grass - Users mailing list archive at Nabble.com.
Neil Best wrote:
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?
I just discovered that r.recoe only produced 3 levels -- not what I was
expecting for the rule:
-1.0:1.0:0:255
I guess I would have to use r.mapcalc?
--
View this message in context: http://www.nabble.com/exploding-a-color-table-tp17680217p17680396.html
Sent from the Grass - Users mailing list archive at Nabble.com.
Neil Best wrote:
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?
You can query the colour corresponding to specific values using
r.what.color.
--
Glynn Clements <glynn@gclements.plus.com>
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?
Hi
I cannot help you directly but once had heppened situation when I had integer 16bit (CELL) dem with standard colortable, after operation in mapcalc it had changed into into another integer with color table asigned to each category (to every of 65656 categories!) It was problematic becouse rendering time was veryyy long
and I trid to reproduce it, but it was over year ago
Or maybe it was occasional cvs bug?
Jarek
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.0000 white
-0.3000 blue
-0.2000 205 193 173
0.0000 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.0000 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