.TH r.average 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBr.average\fR\fR - Finds the average of values in a cover map within areas assigned the same category value in a user-specified base map. .SH KEYWORDS raster, statistics .SH SYNOPSIS \fBr.average\fR .br \fBr.average help\fR .br \fBr.average\fR [\-\fBc\fR] \fBbase\fR=\fIname\fR \fBcover\fR=\fIname\fR \fBoutput\fR=\fIname\fR [\-\-\fBoverwrite\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-c\fR" 4m .br Cover values extracted from the category labels of the cover map .IP "\fB\-\-overwrite\fR" 4m .br Allow output files to overwrite existing files .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBbase\fR=\fIname\fR" 4m .br Name of base raster map .IP "\fBcover\fR=\fIname\fR" 4m .br Name of cover raster map .IP "\fBoutput\fR=\fIname\fR" 4m .br Name for output raster map .PP .SH DESCRIPTION \fIr.average\fR calculates the average value of data contained in a \fIcover\fR raster map layer for areas assigned the same category value in the user-specified \fIbase\fR raster map layer. These averaged values are stored in the category labels file associated with a new \fIoutput\fR map layer. The values to be averaged are taken from a user-specified \fIcover\fR map. The \fIcategory values\fR for the \fIcover\fR map will be averaged, unless the \fB-c\fR flag is set. If the \fB-c\fR flag is set, the values that appear in the \fIcategory labels\fR file for the \fIcover\fR map will be averaged instead (see example below). .PP The \fIoutput\fR map is actually a \fIreclass\fR of the \fIbase\fR map (see \fI r.reclass\fR), and will have exactly the same \fIcategory values\fR as the \fIbase\fR map. The averaged values computed by \fIr.average\fR are stored in the \fIoutput\fR map's \fIcategory labels\fR file. The \fBbase=\fR map is an existing raster map layer in the user's current mapset search path. For each group of cells assigned the same category value in the \fIbase\fR map, the values assigned these cells in the \fIcover\fR map will be averaged. The \fIcover\fR map is an existing raster map layer containing the values (in the form of cell category values or cell category labels) to be averaged within each category of the \fIbase\fR map. .SH NOTES The \fB-c\fR option requires that the category label for each category in the \fIcover\fR map be a valid number, integer, or decimal. To be exact, if the first item in the label is numeric, then that value is used. Otherwise, zero is used. The following table covers all possible cases: .PP \fC .DS .br category value .br label used by \-c .br ______________________ .br .12 .12 .br .80 KF .8 .br no data 0 .br .DE \fR .PP (This flag is very similar to the @ operator in \fIr.mapcalc\fR, and the user is encouraged to read the manual entry for \fIr.mapcalc\fR to see how it works there.) .PP The user should use the results of \fIr.average\fR with care. Since this utility assigns a value to each cell which is based on global information (i.e., information at spatial locations other than just the location of the cell itself), the resultant map layer is only valid if the geographic region and mask settings are the same as they were at the time that the result map was created. .PP Results are affected by the current region settings and mask. .SH EXAMPLE Assume that \fIfarms\fR is a map with 7 farms (i.e., 7 categories), and that \fIsoils.Kfactor\fR is a map of soil K factor values with the following category file: \fC .DS .br cat cat .br value label .br 0 no soil data .br 1 .10 .br 2 .15 .br 3 .17 .br 4 .20 .br 5 .24 .br 6 .28 .br 7 .32 .br 8 .37 .br 9 .43 .br .DE \fR Then .PP \fBr.average \-c base=\fR\fIfarms\fR \fBcover=\fR\fIsoils.Kfactor\fR \fBoutput=\fR\fIK.by.farm\fR .PP will compute the average soil K factor for each farm, and store the result in the output map \fIK.by.farm\fR, which will be a reclass of \fIfarms\fR with category labels as follows (example only): \fC .DS .br cat cat .br value label .br 1 .1023 .br 2 .1532 .br 3 .172 .br 4 .3872 .br 5 .003 .br 6 .28 .br 7 .2345 .br .DE \fR .SH SEE ALSO \fIg.region\fR, \fIr.category\fR, \fIr.clump\fR, \fIr.describe\fR, \fIr.mapcalc\fR, \fIr.mfilter\fR, \fIr.mode\fR, \fIr.neighbors\fR, \fIr.reclass\fR, \fIr.statistics\fR, \fIr.stats\fR .SH AUTHOR Michael Shapiro, U.S. Army Construction Engineering Research Laboratory .PP \fILast changed: $Date: 2008-05-16 21:09:06 +0200 (Fri, 16 May 2008) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team