File: description.html

package info (click to toggle)
grass 6.0.2-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 40,044 kB
  • ctags: 31,303
  • sloc: ansic: 321,125; tcl: 25,676; sh: 11,176; cpp: 10,098; makefile: 5,025; fortran: 1,846; yacc: 493; lex: 462; perl: 133; sed: 1
file content (142 lines) | stat: -rw-r--r-- 4,154 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<H2>DESCRIPTION</H2>


<EM>r.average</EM> calculates the average value of data
contained in a <EM>cover</EM> raster map layer for areas
assigned the same category value in the user-specified
<EM>base</EM> raster map layer.  These averaged values are
stored in the category labels file associated with a new
<EM>output</EM> map layer.

The values to be averaged are taken from a user-specified
<EM>cover</EM> map.  The <EM>category values</EM> for the
<EM>cover</EM> map will be averaged, unless the <B>-c</B>
flag is set.  If the <B>-c</B> flag is set, the values that
appear in the <EM>category labels</EM> file for the
<EM>cover</EM> map will be averaged instead (see example
below).

<P>

The <EM>output</EM> map is actually a <EM>reclass</EM> of the <EM>base</EM>
map (see <EM> <A HREF="r.reclass.html">r.reclass</A></EM>), and will have
exactly the same <EM>category values</EM> as the <EM>base</EM> map.  The
averaged values computed by <EM>r.average</EM> are stored in the
<EM>output</EM> map's <EM>category labels</EM> file.

The <B>base=</B> 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 <EM>base</EM> map, the values assigned these cells in the
<EM>cover</EM> map will be averaged.

The <B>cover</B> map is n 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 <EM>base</EM> map.

<H2>EXAMPLE</H2>

Assume that 
<EM>farms</EM>
is a map with 7 farms (i.e., 7 categories), and that 
<EM>soils.Kfactor</EM>
is a map of soil K factor values with the following category file: 

<PRE>
	cat 	cat 
	value 	label 
	0 	no soil data 
	1 	.10 
	2 	.15 
	3 	.17 
	4 	.20 
	5 	.24 
	6 	.28 
	7 	.32 
	8 	.37 
	9 	.43 
</PRE>

Then 

<P>
<DL>
<DD>
<B>r.average -c base=</B><EM>farms</EM> 
<B>cover=</B><EM>soils.Kfactor</EM> <B>output=</B><EM>K.by.farm</EM> 
</DL>

will compute the average soil K factor for each farm, and store the result
in the output map <EM>K.by.farm</EM>, which will be a reclass of
<EM>farms</EM> with category labels as follows (example only):

<PRE>
	cat	cat 
	value	label 
	1	.1023 
	2	.1532 
	3	.172 
	4	.3872 
	5	.003 
	6	.28 
	7	.2345 
</PRE>

<H2>NOTES</H2>

The <B>-c</B> option requires that the category label for
each category in the <EM>cover</EM> 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:

<P>
<PRE>
         category    value 
         label       used by -c 
         ______________________
          .12	        .12 
          .80 KF        .8 
          no data      0 
</PRE>

<P>
(This flag is very similar to the @ operator in 
<EM><A HREF="r.mapcalc.html">r.mapcalc</A></EM>,
and the user is encouraged to read the manual entry for 
<EM><A HREF="r.mapcalc.html">r.mapcalc</A></EM>
to see how it works there.) 

<P>

The user should use the results of <EM>r.average</EM> 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.

<P>

Results are affected by the current region settings and mask. 

<H2>SEE ALSO</H2>

<EM><A HREF="g.region.html">g.region</A></EM>,
<EM><A HREF="r.cats.html">r.cats</A></EM>,
<EM><A HREF="r.clump.html">r.clump</A></EM>,
<EM><A HREF="r.describe.html">r.describe</A></EM>,
<EM><A HREF="r.mapcalc.html">r.mapcalc</A></EM>,
<EM><A HREF="r.mask.html">r.mask</A></EM>,
<EM><A HREF="r.mfilter.html">r.mfilter</A></EM>,
<EM><A HREF="r.mode.html">r.mode</A></EM>,
<EM><A HREF="r.neighbors.html">r.neighbors</A></EM>,
<EM><A HREF="r.reclass.html">r.reclass</A></EM>,
<EM><A HREF="r.stats.html">r.stats</A></EM>

<H2>AUTHOR</H2>

Michael Shapiro, 
U.S. Army Construction Engineering Research Laboratory

<p><i>Last changed: $Date: 2003/05/06 12:37:12 $</i>