[GRASS-dev] G_exp_colors()?
Hamish
hamish_b at yahoo.com
Tue Apr 8 04:42:04 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.
> Hamish:
> > 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)
Glynn:
> 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?
No, I get the same.
I put some screenshots and r.univar info about the rasters here:
http://bambi.otago.ac.nz/hamish/grass/bugs/r.colors/
You can see on that page the number of samples is not the problem
(reducing it to 5 gives nearly the same result), the problem is the data
is 90% done by 0.4, but the colr/ rules are only written out on integer
values so they are always scaled linearly between the 0 and 1 colr/
rules.
Hamish
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
More information about the grass-dev
mailing list