NAME
r.neighbors - Cada celda es función de los valores
asignados a las celdas, situadas en una vecindad definida por el usuario
alrededor de aquella, en el mapa de entrada.
(GRASS Raster Program)
USO
r.neighbors
r.neighbors help
r.neighbors [-aqz] input=name output=name
method=name
size=value [TITLE="phrase"]
DESCRIPTION
r.neighbors procesa cada celda de un mapa raster examinado los valores
asignados a las celdas situadas en una vecindad definida por el usuario
alrededor de aquella. La salida es un nuevo mapa raster en el que el valor
de cada celda se obtiene a ttravés de una función especificada
por el usuario de los valores de la vecindad.. For example, each cell in
the output layer might be assigned a category value equal to the average
of the category values appearing in its 3 x 3 cell "neighborhood" in the
input layer.
Si no se especifican argumentos, el programa se ejecutará en
modo interactivo, si los parámetros se incorporan a la linea de
comandos lo hará en modo no interactivo.
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
category 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), 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 category value a center cell in a neighborhood will
have after examining category 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
The average category value within the neighborhood. In the following example,
the result would be:
(7*4 + 6 + 5 + 4*3)/9 = 5.66
The result is rounded to the nearest integer (in this case 6).
median
The category value found half-way through a list of the neighborhood's
category values, when these are ranged in numerical order.
mode
The most frequently occurring category value in the neighborhood.
minimum
The minimum category value within the neighborhood.
maximum
The maximum category value within the neighborhood.
Raw Data Operation New Data
---------------- ----------------
| 7 | 7 | 5 | | | | |
|----|----|----| average |----|----|----|
| 4 | 7 | 4 |--------->| | 6 | |
|----|----|----| |----|----|----|
| 7 | 6 | 4 | | | | |
|----|----|----| |----|----|----|
stddev
The statistical standard deviation of category values within the neighborhood
(rounded to the nearest integer).
variance
The statistical variance of category values within the neighborhood (rounded
to the nearest integer).
diversity
The number of different category values within the neighborhood. In the
above example, the diversity is 4.
interspersion
The percentage of cells containing categories which differ from the category
assigned to the center cell in the neighborhood, plus 1. In the above example,
the interspersion is:
5/8 * 100 + 1 = 63.5
The result is rounded to the nearest integer (in this case 64). ERROR
.RE
Neighborhood Size: The neighborhood size specifies which cells
surrounding any given cell fall into the neighborhood for that cell. The
size must be an odd integer. Options are: 1, 3, 5, 7, 9, 11, 13, 15, 17,
19, 21, 23, and 25. For example,
_ _ _
|_|_|_|
3 x 3 neighborhood ---> |_|_|_|
|_|_|_|
-a
If specified, r.neighbors will not align the output raster map layer
with that of the input raster map layer. The r.neighbors program
works in the current geographic region. 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, if unspecified,
r.neighbors will align
these geographic region settings.
-q
If specified, r.neighbors will run relatively quietly (i.e., without
printing to standard output notes on the program's progress). If unspecified,
the program will print messages to standard output by default.
-z
If specified, r.neighbors will preserve zero values in output. The
default is to set all zero values to null in the output raster. If the
input raster contains real zero values, -z should be set to avoid
resetting these values to null.
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 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 category values, no color files are
copied for these map layers. (The user should note that although the color
file is copied for averaged 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.region
r.clump
r.mapcalc
r.mask
r.mfilter
r.support
AUTHOR
Michael Shapiro, U.S.Army Construction Engineering Research Laboratory