[GRASS-dev] G_exp_colors()?

Hamish hamish_b at yahoo.com
Tue Apr 1 07:12:32 EDT 2008


Hi,

I am working with MODIS Aqua imagery in HDF4 format. (level 3)
  http://oceancolor.gsfc.nasa.gov/PRODUCTS/

The Chlorophyll-a concentration data comes in log form, 0-65535.
Plotting the data with a bcyr color rules makes it look great.

I added a mini-tutorial here:
  http://grass.gdf-hannover.de/wiki/MODIS


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)"


Extended r.univar results + percentile=33,67 of the chlor-a map:
n=16522204
null_cells=20802596
min=0.01
max=64.5654
range=64.5554
mean=0.263613
mean_of_abs=0.263613
stddev=1.1348
variance=1.28777
coeff_var=430.478
sum=4355475.7290696017
first_quartile=0.0717828
median=0.129749
third_quartile=0.211782
percentile_33=0.0893581
percentile_67=0.176154

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, 'r.colors -e' shows some more detail but isn't really
right. A custom one using 'r.univar precentile=,,,,' cues shows some more
but isn't smooth and is a pain.


Any ideas? Could G_log_colors() be turned on its head to make a
G_exp_colors() function and associated 'r.colors -x' flag? Would it work?


I can convert the colors given here:
  http://oceancolor.gsfc.nasa.gov/PRODUCTS/colorbars.html
from 0-255 to min->max using the 10^(mx+b) formula, and then pass those
as rules to r.colors:
  http://trac.osgeo.org/grass/browser/grass-addons/raster/r.colors.tools/palettes
So this isn't a urgent need, but could be a useful feature.


thanks,
Hamish


More information about the grass-dev mailing list