1r.average(1)                  Grass User's Manual                 r.average(1)
2
3
4

NAME

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

KEYWORDS

10       raster
11

SYNOPSIS

13       r.average
14       r.average help
15       r.average [-c] base=name cover=name output=name  [--overwrite]
16
17   Flags:
18       -c  cover values extracted from the category labels of the cover map
19
20       --overwrite
21
22   Parameters:
23       base=name
24           Name of base raster map
25
26       cover=name
27           Name of cover raster map
28
29       output=name
30           Name for output raster map
31

DESCRIPTION

33       r.average calculates the average value of data  contained  in  a  cover
34       raster  map  layer  for  areas  assigned the same category value in the
35       user-specified base raster map layer.  These averaged values are stored
36       in  the  category  labels  file associated with a new output map layer.
37       The values to be averaged are taken from a  user-specified  cover  map.
38       The  category  values for the cover map will be averaged, unless the -c
39       flag is set.  If the -c flag is set, the values that appear in the cat‐
40       egory labels file for the cover map will be averaged instead (see exam‐
41       ple below).
42
43       The output map is actually a reclass of the base map (see   r.reclass),
44       and  will  have  exactly the same category values as the base map.  The
45       averaged values computed by r.average are stored in  the  output  map's
46       category labels file.  The base= map is an existing raster map layer in
47       the user's current  mapset  search  path.   For  each  group  of  cells
48       assigned  the  same category value in the base map, the values assigned
49       these cells in the cover map will be averaged.   The  cover  map  is  n
50       existing  raster  map  layer containing the values (in the form of cell
51       category values or cell category labels) to  be  averaged  within  each
52       category of the base map.
53

EXAMPLE

55       Assume  that farms is a map with 7 farms (i.e., 7 categories), and that
56       soils.Kfactor is a map of soil K factor values with the following cate‐
57       gory file:
58            cat  cat
59            value     label
60            0    no soil data
61            1    .10
62            2    .15
63            3    .17
64            4    .20
65            5    .24
66            6    .28
67            7    .32
68            8    .37
69            9    .43
70        Then
71
72       r.average -c base=farms cover=soils.Kfactor output=K.by.farm
73
74       will  compute  the  average  soil K factor for each farm, and store the
75       result in the output map K.by.farm, which will be a  reclass  of  farms
76       with category labels as follows (example only):
77            cat  cat
78            value     label
79            1    .1023
80            2    .1532
81            3    .172
82            4    .3872
83            5    .003
84            6    .28
85            7    .2345
86
87

NOTES

89       The -c option requires that the category label for each category in the
90       cover map be a valid number, integer, or decimal.  To be exact, if  the
91       first item in the label is numeric, then that value is used. Otherwise,
92       zero is used.  The following table covers all possible cases:
93
94
95                category    value
96                label       used by -c
97                ______________________
98                 .12          .12
99                 .80 KF        .8
100                 no data      0
101
102
103       (This flag is very similar to the @ operator in r.mapcalc, and the user
104       is  encouraged  to  read  the  manual entry for r.mapcalc to see how it
105       works there.)
106
107       The user should use the results of r.average  with  care.   Since  this
108       utility  assigns a value to each cell which is based on global informa‐
109       tion (i.e., information at spatial locations other than just the  loca‐
110       tion  of the cell itself), the resultant map layer is only valid if the
111       geographic region and mask settings are the same as they  were  at  the
112       time that the result map was created.
113
114       Results are affected by the current region settings and mask.
115

SEE ALSO

117       g.region,  r.cats,  r.clump,  r.describe, r.mapcalc, r.mfilter, r.mode,
118       r.neighbors, r.reclass, r.stats
119

AUTHOR

121       Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
122
123       Last changed: $Date: 2006/04/13 19:01:37 $
124
125       Full index
126
127
128
129GRASS 6.2.2                                                       r.average(1)
Impressum