[GRASS-user] average calculation

Hamish hamish_b at yahoo.com
Thu May 14 01:21:51 EDT 2009


Seb wrote:
> 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.

be careful with those sorts of tricks because different regions of the
result will end up with different levels of statistical strength and
so the result may be misleading.

> 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.

use r.series method=average. The -n flag will Propagate NULLs.


Hamish



      



More information about the grass-user mailing list