[GRASS-user] calculating statistics based upon a raster patch map

Hi list,

I’ve got two maps, a map with patches or areas which I want to evaluate. A second map contains a parameter which I want to evaluate (average, std) based upon areas as delineated in the first map. The output of all this would optimally be a third map with the results of the evaluation (average, std) given to the areas of the first map.

Is this possible in a simple way, or should I write something myself. I can’t seem to find a premade function that does this or something close to it.

Kind regards,
Koen

On Donnerstag, 20. November 2008 13:57:42 Hufkens Koen wrote:

Hi list,

I've got two maps, a map with patches or areas which I want to evaluate. A
second map contains a parameter which I want to evaluate (average, std)
based upon areas as delineated in the first map. The output of all this
would optimally be a third map with the results of the evaluation (average,
std) given to the areas of the first map.

Is this possible in a simple way, or should I write something myself. I
can't seem to find a premade function that does this or something close to
it.

it is quit simple:

1) change your 'patch map' with r.to.vect and v.to.rast into individually
numbered patches

2) change your value_raster to integer and multiplication (e.g. '*100') is
advisable: r.mapcalc "tmp1=int(value_raster*100)"

3) query your raster:
r.statistics base=patch_raster cover=tmp1 method=average
out=value_raster --o

4) perhaps use r.mapcalc to revert the *100 modification in the new map

regards, Martin

--
**********************************************************************

University of Wuerzburg
Institute of Geography
Department of Remote Sensing
Remote Sensing and Biodiversity Unit
Am Hubland
97074 Wuerzburg, Germany
@
German Aerospace Center (DLR)
German Remote Sensing Data Center (DFD)

Phone: +49-(0)931-888-4797
Fax: +49-(0)931-888-4961
Email: martin.wegmann@uni-wuerzburg.de
url: http://www.remote-sensing.uni-wuerzburg.de

**********************************************************************

Hufkens Koen wrote:

I've got two maps, a map with patches or areas which I want to evaluate.
A second map contains a parameter which I want to evaluate (average,
std) based upon areas as delineated in the first map. The output of all
this would optimally be a third map with the results of the evaluation
(average, std) given to the areas of the first map.

Is this possible in a simple way, or should I write something myself. I
can't seem to find a premade function that does this or something close
to it.

r.statistics does this, but both inputs have to be integer raster
maps.

In 7.0-svn, r.statistics2 and r.statistics3 provide similar
functionality, but allow the cover map to be floating-point.

If your base map is a vector map, you can convert it with v.to.rast.

If you need aggregates other than those provided by r.statistics etc,
then you can to use r.stats (with the restriction that both maps must
be integers) to collate the data into tuples of (base category, cover
value, count), and calculate the aggregates with e.g. awk.

--
Glynn Clements <glynn@gclements.plus.com>