table of contents
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.mfilter(1grass) | Grass User's Manual | r.mfilter(1grass) |
NAME¶
r.mfilter - Performs raster map matrix filter.KEYWORDS¶
raster, map algebraSYNOPSIS¶
r.mfilterFlags:¶
- -q
-
- -z
-
- --overwrite
-
- --verbose
-
- --quiet
-
Parameters:¶
- input=name
-
- output=name
-
- filter=name
-
- repeat=integer
-
- title=string
-
DESCRIPTION¶
r.mfilter filters the raster input to produce the raster output according to the matrix filter designed by the user (see FILTERS below). The filter is applied repeat times (default value is 1). The output raster map layer can be given a TITLE if desired. (This TITLE should be put in quotes if it contains more than one word.) With -z flag the filter is applied only to zero category values in the input raster map layer. The non-zero category values are not changed. Note that if there is more than one filter step, this rule is applied to the intermediate raster map layer -- only zero category values which result from the first filter will be changed. In most cases this will NOT be the desired result. Hence -z should be used only with single step filters. The filter parameter defines the name of an existing, user-created UNIX ASCII file whose contents is a matrix defining the way in which the input file will be filtered. The format of this file is described below, under FILTERS. The repeat parameter defines the number of times the filter is to be applied to the input data.FILTERS¶
The filter file is a normal UNIX ASCII file designed by the user. It has the following format:TITLE TITLE
MATRIX n
.
n lines of n integers
.
DIVISOR d
TYPE S/P
- TITLE
-
- MATRIX
-
- DIVISOR
-
- TYPE
-
EXAMPLE FILTER FILE¶
TITLE 3x3 average, non-zero data only, followed by 5x5 average
MATRIX 3
1 1 1
1 1 1
1 1 1
DIVISOR 0
TYPE P
MATRIX 5
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
DIVISOR 25
TYPE P
HOW THE FILTER WORKS¶
The filter process produces a new category value for each cell in the input raster map layer by multiplying the category values of the cells in the n x n neighborhood around the center cell by the corresponding matrix value and adding them together. If a divisor is specified, the sum is divided by this divisor, rounding to the nearest integer. (If a zero divisor was specified, then the divisor is computed for each cell as the sum of the MATRIX values where the corresponding input cell is non-zero.) If more than one filter step is specified, either because the repeat value was greater than one or because the filter file contained more than one matrix, these steps are performed sequentially. This means that first one filter is applied to the entire input raster map layer to produce an intermediate result; then the next filter is applied to the intermediate result to produce another intermediate result; and so on, until the final filter is applied. Then the output cell is written.NOTES¶
For a floating point version of this command, see r.mfilter.fp. If the resolution of the geographic region does not agree with the resolution of the raster map layer, unintended resampling of the original data may occur. The user should be sure that the geographic region is set properly.SEE ALSO¶
g.region, r.clump, r.mfilter.fp, r.neighborsAUTHOR¶
Michael Shapiro, U.S.Army Construction Engineering Research Laboratory Last changed: $Date: 2011-11-08 12:29:50 +0100 (Tue, 08 Nov 2011) $ Full index © 2003-2014 GRASS Development TeamGRASS 6.4.4 |