Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 413e0bdb3c48563b2d8d9038d07d5533 > files > 1983

grass-6.3.0-15.fc13.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>GRASS GIS: r.average</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
<body bgcolor="white">

<img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>

<h2>NAME</h2>
<em><b>r.average</b></em>  - Finds the average of values in a cover map within areas assigned the same category value in a user-specified base map.
<h2>KEYWORDS</h2>
raster
<h2>SYNOPSIS</h2>
<b>r.average</b><br>
<b>r.average help</b><br>
<b>r.average</b> [-<b>c</b>] <b>base</b>=<em>name</em> <b>cover</b>=<em>name</em> <b>output</b>=<em>name</em>  [--<b>overwrite</b>]  [--<b>verbose</b>]  [--<b>quiet</b>] 

<h3>Flags:</h3>
<DL>
<DT><b>-c</b></DT>
<DD>Cover values extracted from the category labels of the cover map</DD>

<DT><b>--overwrite</b></DT>
<DD>Allow output files to overwrite existing files</DD>
<DT><b>--verbose</b></DT>
<DD>Verbose module output</DD>
<DT><b>--quiet</b></DT>
<DD>Quiet module output</DD>
</DL>

<h3>Parameters:</h3>
<DL>
<DT><b>base</b>=<em>name</em></DT>
<DD>Name of base raster map</DD>

<DT><b>cover</b>=<em>name</em></DT>
<DD>Name of cover raster map</DD>

<DT><b>output</b>=<em>name</em></DT>
<DD>Name for output raster map</DD>

</DL>
<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 <EM>cover</EM> 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 <EM>base</EM> map.

<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>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>SEE ALSO</H2>

<EM><A HREF="g.region.html">g.region</A></EM>,
<EM><A HREF="r.category.html">r.category</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.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.statistics.html">r.statistics</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: 2007-12-17 14:53:55 +0100 (Mon, 17 Dec 2007) $</i>
<HR>
<P><a href="index.html">Main index</a> - <a href="raster.html">raster index</a> - <a href="full_index.html">Full index</a></P>
<P>&copy; 2003-2008 <a href="http://grass.osgeo.org">GRASS Development Team</a></p>
</body>
</html>