> 
> 
> Hi,
> 
> This should be an easy question to answer.
> 
> How can you determine the mean value of cells in a raster layer
> not including 0 (no data) values ?
> 
> Presently, i am resorting to turning the raster into an ascii file
> and then computing the mean in fortran.
> 
> Thank you for any help,
> 
> Eric Small
> 

Here's a way...

Compute a 'coverage' map with 1's where you want cells to be averaged and 0's
elsewhere:

	r.mapcalc covermap="if(inputmap,1,0)"

Then use r.average to put the average value of the coverage in each cell of a
a new map:

	r.average base=inputmap cover=covermap output=the_answer

You can do a d.what.rast to find out the answer from the 'the_answer' map.

This is a bit wasteful because a whole map has to be generated for you to get
a single value - but it should work. I wrote a program which spits out a single
value using r.stats - but its not ready for distribution yet.

If there's a better way, I'd be keen to see it.

Cheers,

Fred.


-- 
Fred Watson

PhD student		     Cooperative Research Centre for Catchment Hydrology
fgrw@civag.unimelb.edu.au    Civil & Environmental Engineering Department
+61-3-3447237		     University of Melbourne
+61-3-3446215 (F)	     Parkville, 3052, Victoria, AUSTRALIA


