4
<em>r.average</em> calculates the average value of data
5
contained in a <em>cover</em> raster map layer for areas
6
assigned the same category value in the user-specified
7
<em>base</em> raster map layer. These averaged values are
8
stored in the category labels file associated with a new
9
<em>output</em> map layer.
11
The values to be averaged are taken from a user-specified
12
<em>cover</em> map. The <em>category values</em> for the
13
<em>cover</em> map will be averaged, unless the <b>-c</b>
14
flag is set. If the <b>-c</b> flag is set, the values that
15
appear in the <em>category labels</em> file for the
16
<em>cover</em> map will be averaged instead (see example
21
The <em>output</em> map is actually a <em>reclass</em> of the <em>base</em>
22
map (see <em> <a href="r.reclass.html">r.reclass</a></em>), and will have
23
exactly the same <em>category values</em> as the <em>base</em> map. The
24
averaged values computed by <em>r.average</em> are stored in the
25
<em>output</em> map's <em>category labels</em> file.
27
The <b>base=</b> map is an existing raster map layer in the user's current
28
mapset search path. For each group of cells assigned the same category
29
value in the <em>base</em> map, the values assigned these cells in the
30
<em>cover</em> map will be averaged.
32
The <em>cover</em> map is an existing raster map layer containing the values
33
(in the form of cell category values or cell category labels) to be averaged
34
within each category of the <em>base</em> map.
38
The <b>-c</b> option requires that the category label for
39
each category in the <em>cover</em> map be a valid number,
40
integer, or decimal. To be exact, if the first item in the
41
label is numeric, then that value is used. Otherwise, zero
42
is used. The following table covers all possible cases:
48
______________________
55
(This flag is very similar to the @ operator in
56
<em><a href="r.mapcalc.html">r.mapcalc</a></em>,
57
and the user is encouraged to read the manual entry for
58
<em><a href="r.mapcalc.html">r.mapcalc</a></em>
59
to see how it works there.)
63
The user should use the results of <em>r.average</em> with
64
care. Since this utility assigns a value to each cell
65
which is based on global information (i.e., information at
66
spatial locations other than just the location of the cell
67
itself), the resultant map layer is only valid if the
68
geographic region and mask settings are the same as they
69
were at the time that the result map was created.
73
Results are affected by the current region settings and mask.
79
is a map with 7 farms (i.e., 7 categories), and that
80
<em>soils.Kfactor</em>
81
is a map of soil K factor values with the following category file:
103
<b>r.average -c base=</b><em>farms</em>
104
<b>cover=</b><em>soils.Kfactor</em> <b>output=</b><em>K.by.farm</em>
107
will compute the average soil K factor for each farm, and store the result
108
in the output map <em>K.by.farm</em>, which will be a reclass of
109
<em>farms</em> with category labels as follows (example only):
127
<em><a href="g.region.html">g.region</a></em>,
128
<em><a href="r.category.html">r.category</a></em>,
129
<em><a href="r.clump.html">r.clump</a></em>,
130
<em><a href="r.describe.html">r.describe</a></em>,
131
<em><a href="r.mapcalc.html">r.mapcalc</a></em>,
132
<em><a href="r.mfilter.html">r.mfilter</a></em>,
133
<em><a href="r.mode.html">r.mode</a></em>,
134
<em><a href="r.neighbors.html">r.neighbors</a></em>,
135
<em><a href="r.reclass.html">r.reclass</a></em>,
136
<em><a href="r.statistics.html">r.statistics</a></em>,
137
<em><a href="r.stats.html">r.stats</a></em>
142
U.S. Army Construction Engineering Research Laboratory
144
<p><i>Last changed: $Date: 2008-05-16 21:09:06 +0200 (Fri, 16 May 2008) $</i>