[GRASS-dev] G_exp_colors()?
Glynn Clements
glynn at gclements.plus.com
Wed Apr 2 12:43:55 EDT 2008
Hamish wrote:
> > > I am working with MODIS Aqua imagery in HDF4 format. (level 3)
> ...
> > > I added a mini-tutorial here:
> > > http://grass.gdf-hannover.de/wiki/MODIS
> ...
> > > The Chlorophyll-a concentration data comes in log form, 0-65535.
> ...
> > > The metadata (available through gdalinfo) gives the formula and test
> > > points to convert to mg/m^3:
> > > r.mapcalc "${map}.chlor_a = 10^(($Slope * $map) + $Intercept)"
> >
> > > ie a histogram of that starts high and exponentially drops to 0. By
> > > 2.0 there are few data cells left, but real data continues up to the
> > > max in areas having plankton blooms.
> ...
> > > So how to make nice color rules for that? 'r.colors -g' does the
> > > opposite of what I want,
>
> Glynn.
> > Odd. Theoretically, it should do exactly what you want.
>
> You are right, -g is the right thing to use, it's just that the data is
> /so/ logarithmic that it only brings out a little more detail and it
> appears like nothing happened. (it became clear after displaying a
> legend, changing the color rules, then redrawing)
Strange. I would have expected to see exactly the same results from:
r.colors color=bcyr map=$map
and:
r.colors -g color=bcyr map=${map}.chlor_a
AFAICT, the -g flag should effectively "undo" the exponential
conversion. All of the constant factors (e.g. $Slope and $Intercept)
cancel out from the equations.
Maybe the colour table needs more samples? r.colors is hard-coded to
use 100 samples:
G_log_colors(&colors_tmp, &colors, 100);
Do you get better results if you increase that number?
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list