[GRASS-user] Raster histogram or r.info for raster min/max values

Frank Bilki fbilki at gmail.com
Tue Jul 21 01:35:21 EDT 2009

Hello All,

I am brand new to GRASS so I am sure this is a newbie question. (In a
previous role I was an advanced ER Mapper user so I know the task,
just not how to execute it in GRASS.)

I am trying to perform a dark pixel correction on a Landsat ETM mosaic
consisting of 15 scenes. For each band in each scene I need to
determine the minimum brightness value and then subtract that 'bias'
from the entire band. I have figured out how to use r.mapcalc to do
the subtraction, but I am getting what appears to be conflicting
results when I attempt to calculate the minimum value.

My operating system is Windows Vista Business and I am using GRASS
6.4.0svn under the wxPython user interface. My dilemma is this:

If I run r.info on Band 3 (visible red) for a particular scene I get
this result:

Range of data:    min = 1  max = 255

Given that this band is visible red I would expect a minimum value
somewhat greater than 1 -- a value of between 5 and 10 would be more
appropriate for this region.

If I display the raster histogram (using the Analyze button on the Map
Display window), the x-axis extends anywhere from around 10 to around
235 (in a small window) or from 6 to around 247 (if I span the window
across both monitors). And, yes, I know the x-axis units are 'in

Varying the size of the window has a major effect on the histogram! It
is not a visual error - the first tic clearly changes relative to the

Which result do I believe? I cannot get a consistent histogram display
because it changes according to the window size, and I do not trust
the minimum values from r.info.

What I would really like is to generate a summary of the number of
pixels with each brightness value from 0 to 255. Is there an easy way
to do that? I have only been using GRASS a couple weeks and have not
figured out how to script it yet, so would prefer the solution to
involve the UI.



More information about the grass-user mailing list