1r.average(1) Grass User's Manual r.average(1)
2
3
4
6 r.average - Finds the average of values in a cover map within areas
7 assigned the same category value in a user-specified base map.
8
10 raster
11
13 r.average
14 r.average help
15 r.average [-c] base=name cover=name output=name [--overwrite] [--ver‐
16 bose] [--quiet]
17
18 Flags:
19 -c
20 Cover values extracted from the category labels of the cover map
21
22 --overwrite
23 Allow output files to overwrite existing files
24
25 --verbose
26 Verbose module output
27
28 --quiet
29 Quiet module output
30
31 Parameters:
32 base=name
33 Name of base raster map
34
35 cover=name
36 Name of cover raster map
37
38 output=name
39 Name for output raster map
40
42 r.average calculates the average value of data contained in a cover
43 raster map layer for areas assigned the same category value in the
44 user-specified base raster map layer. These averaged values are stored
45 in the category labels file associated with a new output map layer.
46 The values to be averaged are taken from a user-specified cover map.
47 The category values for the cover map will be averaged, unless the -c
48 flag is set. If the -c flag is set, the values that appear in the cat‐
49 egory labels file for the cover map will be averaged instead (see exam‐
50 ple below).
51
52 The output map is actually a reclass of the base map (see r.reclass),
53 and will have exactly the same category values as the base map. The
54 averaged values computed by r.average are stored in the output map's
55 category labels file. The base= map is an existing raster map layer in
56 the user's current mapset search path. For each group of cells
57 assigned the same category value in the base map, the values assigned
58 these cells in the cover map will be averaged. The cover map is an
59 existing raster map layer containing the values (in the form of cell
60 category values or cell category labels) to be averaged within each
61 category of the base map.
62
64 The -c option requires that the category label for each category in the
65 cover map be a valid number, integer, or decimal. To be exact, if the
66 first item in the label is numeric, then that value is used. Otherwise,
67 zero is used. The following table covers all possible cases:
68
69
70 category value
71 label used by -c
72 ______________________
73 .12 .12
74 .80 KF .8
75 no data 0
76
77
78 (This flag is very similar to the @ operator in r.mapcalc, and the user
79 is encouraged to read the manual entry for r.mapcalc to see how it
80 works there.)
81
82 The user should use the results of r.average with care. Since this
83 utility assigns a value to each cell which is based on global informa‐
84 tion (i.e., information at spatial locations other than just the loca‐
85 tion of the cell itself), the resultant map layer is only valid if the
86 geographic region and mask settings are the same as they were at the
87 time that the result map was created.
88
89 Results are affected by the current region settings and mask.
90
92 Assume that farms is a map with 7 farms (i.e., 7 categories), and that
93 soils.Kfactor is a map of soil K factor values with the following cate‐
94 gory file:
95 cat cat
96 value label
97 0 no soil data
98 1 .10
99 2 .15
100 3 .17
101 4 .20
102 5 .24
103 6 .28
104 7 .32
105 8 .37
106 9 .43
107 Then
108
109 r.average -c base=farms cover=soils.Kfactor output=K.by.farm
110
111 will compute the average soil K factor for each farm, and store the
112 result in the output map K.by.farm, which will be a reclass of farms
113 with category labels as follows (example only):
114 cat cat
115 value label
116 1 .1023
117 2 .1532
118 3 .172
119 4 .3872
120 5 .003
121 6 .28
122 7 .2345
123
124
126 g.region, r.category, r.clump, r.describe, r.mapcalc, r.mfilter,
127 r.mode, r.neighbors, r.reclass, r.statistics, r.stats
128
130 Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
131
132 Last changed: $Date: 2007-12-17 14:53:55 +0100 (Mon, 17 Dec 2007) $
133
134 Full index
135
136 © 2003-2008 GRASS Development Team
137
138
139
140GRASS 6.3.0 r.average(1)