[GRASS-user] average calculation

Seb spluque at gmail.com
Thu May 14 00:46:44 EDT 2009


Hi,

If one were to calculate an average of several rasters, one could simply
do:

r.mapcalc "ave = (A + B + C) / 3"

But how can we get around the problem of null values in any of the
rasters, which would propagate it to the result?  What is an efficient
way to calculate both the numerator and denominator for each pixel so
that it corresponds only to rasters with non-null values.  A second
problem is how to script this (shell) so that a large number of rasters
can be included in this calculation.  I would appreciate some pointers
to some scripts where something along these lines can be read, or any
thoughts about alternative/better approaches.  Thanks.


Cheers,

-- 
Seb



More information about the grass-user mailing list