On Wed, 13 May 2009 22:21:51 -0700 (PDT),
Hamish <hamis...@yahoo.com> wrote:

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

Thanks Hamish, that's exactly the tool for this job.  Basically,
r.series without the -n flag would do what I described, although the
point about uneven representation of cells across rasters is something
to worry about.


-- 
Seb

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to