mean value from raster

ng at rti-md.com ng at rti-md.com
Tue May 23 08:38:50 EDT 1995


Eric,

I think r.stats has a -z option that allows you omit cells containg zero values.

You can combine r.stats with awk to accomplish what you want to do.

EX:

To get mean value for entire layer:

r.stats -zcq {mapname} | awk '{ prodsum += $1*$2; sum +=$2 }\
> END{Average=prodsum/sum; print "Average= " Average}'

Good luck

Nalneesh Gaur




More information about the grass-user mailing list