GRASS logo

NAME

r.statistics - Calculates category or object oriented statistics.

KEYWORDS

raster, statistics

SYNOPSIS

r.statistics
r.statistics help
r.statistics [-c] base=name cover=name method=string output=name [--overwrite] [--verbose] [--quiet]

Flags:

-c
Cover values extracted from the category labels of the cover map
--overwrite
Allow output files to overwrite existing files
--verbose
Verbose module output
--quiet
Quiet module output

Parameters:

base=name
Name of base raster map
cover=name
Name of cover raster map
method=string
Method of object-based statistic
Options: diversity,distribution,average,mode,median,avedev,stddev,variance,skewness,kurtosis,min,max,sum
output=name
Resultant raster map (not used with 'distribution')

DESCRIPTION

r.statistics is a tool to analyse exploratory statistics of a "cover layer" according to how it intersects with objects in a "base layer". A variety of standard statistical measures are possible (called "zonal statistics" in some GIS). All cells in the base layer are considered one object for the analysis. For some applications, one will first want to prepare the input data so that all areas of contiguous cell category values in the base layer are uniquely identified, which can be done with r.clump.
The available methods are the following (english - german): The calculations will be performed on each area of data of the cover layers which fall within each unique value, or category, of the base layer.

Setting the -c flag the category lables of the covering raster layer will be used. This is nice to avoid the GRASS limitation to interger in raster maps because using category values floating point numbers can be stored.

All calculations except "distribution" create an output layer. The output layer is a reclassified version of the base layer with identical category values, but modified category labels - the results of the calculations are stored in the category labels of the output layer.

For distributions, the output is printed to the user interface (stdout). If an output file name was specified, it will be ignored. The result will be a text table with three columns. In the first column are the category values of the base layer (a), in the second column the associated value of the cover layers (b), and in the third column the percentage of area in that base layer category (a) that falls into that row's value in the cover layer(b). Example:

1   124  23
1   201  47
1   273  30
2   101  5
2   152  16
2   167  60
2   187  19
     .
     .
     .
So for the first line in the output above, we see that 23% of the cells of the base layer category 1 have a value of 124 in the cover layer. To transfer the values stored as category labels into cell values, r.mapcalc can be used ('@' operator).

EXAMPLES

Calculation of average elevation of each field in the Spearfish region:
r.statistics base=fields cover=elevation.dem out=elevstats method=average
r.category elevstats
r.mapcalc "fieldelev=@elevstats"
r.univar fieldelev

SEE ALSO

r.average, r.clump, r.mode, r.median, r.mapcalc, r.neighbors, r.univar r.category

AUTHOR

Martin Schroeder, Geographisches Institut Heidelberg, Germany

Last changed: $Date: 2008-02-19 12:12:24 -0800 (Tue, 19 Feb 2008) $


Main index - raster index - Full index

© 2003-2008 GRASS Development Team