other versions
- jessie 6.4.4-1
- stretch 7.2.0-2
- testing 7.6.0-1
- unstable 7.6.0-1
- experimental 7.6.1-1~exp1
r.neighbors(1grass) | Grass User's Manual | r.neighbors(1grass) |
NAME¶
r.neighbors - Makes each cell category value a function of the category values assigned to the cells around it, and stores new cell values in an output raster map layer.KEYWORDS¶
raster, statisticsSYNOPSIS¶
r.neighborsFlags:¶
- -a
-
- -q
-
- -c
-
- --overwrite
-
- --verbose
-
- --quiet
-
Parameters:¶
- input=name
-
- output=name
-
- method=string
-
- size=integer
-
- title=
-
- weight=string
-
- gauss=float
-
DESCRIPTION¶
r.neighbors looks at each cell in a raster input file, and examines the values assigned to the cells in some user-defined "neighborhood" around it. It outputs a new raster map layer in which each cell is assigned a value that is some (user-specified) function of the values in that cell's neighborhood. For example, each cell in the output layer might be assigned a value equal to the average of the values appearing in its 3 x 3 cell "neighborhood" in the input layer. The program will be run non-interactively if the user specifies program arguments (see OPTIONS) on the command line. Alternately, the user can simply type r.neighbors on the command line, without program arguments. In this case, the user will be prompted for flag settings and parameter values.OPTIONS¶
The user must specify the names of the raster map layers to be used for input and output, the method used to analyze neighborhood values (i.e., the neighborhood function or operation to be performed), and the size of the neighborhood. Optionally, the user can also specify the TITLE to be assigned to the raster map layer output, elect to not align the resolution of the output with that of the input (the -a option), run r.neighbors with a custom matrix weights with the weight option, and elect to run r.neighbors quietly (the -q option). These options are described further below. Neighborhood Operation Methods: The neighborhood operators determine what new value a center cell in a neighborhood will have after examining values inside its neighboring cells. Each cell in a raster map layer becomes the center cell of a neighborhood as the neighborhood window moves from cell to cell throughout the map layer. r.neighbors can perform the following operations:- average
-
- median
-
- mode
-
- minimum
-
- maximum
-
Raw Data Operation New Data
---------------- ----------------
| 7 | 7 | 5 | | | | |
|----|----|----| average |----|----|----|
|----|----|----| |----|----|----|
| 7 | 6 | 4 | | | | |
|----|----|----| |----|----|----|
- range
-
- stddev
-
- sum
-
- variance
-
- diversity
-
- interspersion
-
_ _ _
|_|_|_|
|_|_|_|
|_|_|_|
-------
|3|3|3|
-------
|1|4|8|
-------
|9|5|3|
-------
FLAGS¶
- -a
-
- -c
- This flag will use a circular neighborhood for the moving analysis window, centered on the current cell.
X O X . X X X . . X X X X X .
. X . X X O X X . X X X X X .
. . X . . . X X X X X .
. . . X . . .
. X X X X X X X . . X X X X X X X X X .
. X X X X X X X . . X X X X X X X X X .
X X X X O X X X X . X X X X X X X X X .
. X X X X X X X . X X X X X O X X X X X
. X X X X X X X . . X X X X X X X X X .
. . X X X X X . . . X X X X X X X X X .
. . . . X . . . . . X X X X X X X X X .
- -q
-
NOTES¶
The r.neighbors program works in the current geographic region with the current mask, if any. It is recommended, but not required, that the resolution of the geographic region be the same as that of the raster map layer. By default, r.neighbors will align these geographic region settings. However, the user can elect to keep original input and output resolutions which are not aligned by specifying this (e.g., using the -a option). r.neighbors doesn't propagate NULLs, but computes the aggregate over the non-NULL cells in the neighborhood. The -c flag and the weights parameter are mutually exclusive. Any use of the two together will produce an error. Differently-shaped neighborhood analysis windows may be achieved by using the weight= parameter to specify a weights file where all values are equal. The user can also vary the weights at the edge of the neighborhood according to the proportion of the cell that lies inside the neighborhood circle, effectively anti-aliasing the analysis mask. For aggregates where a weighted calculation isn't meaningful (specifically: minimum, maximum, diversity and interspersion), the weights are used to create a binary mask, where zero causes the cell to be ignored and any non-zero value causes the cell to be used. r.neighbors copies the GRASS color files associated with the input raster map layer for those output map layers that are based on the neighborhood average, median, mode, minimum, and maximum. Because standard deviation, variance, diversity, and interspersion are indices, rather than direct correspondents to input values, no color files are copied for these map layers. (The user should note that although the color file is copied for average neighborhood function output, whether or not the color file makes sense for the output will be dependent on the input data values.)SEE ALSO¶
g.regionAUTHOR¶
Michael Shapiro, U.S.Army Construction Engineering Research Laboratory Last changed: $Date: 2010-09-21 14:53:31 +0200 (Tue, 21 Sep 2010) $ Full index © 2003-2014 GRASS Development TeamGRASS 6.4.4 |