[Gdal-dev] mean value of rasters

Maciek Sieczka werchowyna at epf.pl
Thu May 4 16:11:01 EDT 2006


On Thu, 04 May 2006 15:59:53 -0400
Frank Warmerdam <warmerdam at pobox.com> wrote:

> Christopher Condit wrote:
> > I've got N raster files (GeoTiffs) of equal size and dimensions.
> > I'd like to create a single raster with the mean value of these N
> > rasters (cell by cell).  Is there a good way to do this with GDAL,
> > or with another tool?  
> 
> Chris,
> 
> There is not direct way of doing this with the commandline utilities.
> It would be relatively easy to implement using Python bindings for
> GDAL and Numerical Python.  I imagine this could also be done in
> something like R or GRASS relatively directly.

Yes, straightforward in Grass:

r.in.gdal to import geotiff rasters

g.region rast=1st_raster

r.mapcalc 'mean_raster=(1st_raster+2nd_raster+3rd_raster)/3'

r.out.gdal to export mean_raster back to geotiff

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/




More information about the Gdal-dev mailing list