1r.mfilter(1)                  Grass User's Manual                 r.mfilter(1)
2
3
4

NAME

6       r.mfilter  - Performs raster map matrix filter.
7

KEYWORDS

9       raster, algebra, statistics, filter
10

SYNOPSIS

12       r.mfilter
13       r.mfilter --help
14       r.mfilter  [-z]  input=name  output=name  filter=name  [repeat=integer]
15       [title=string]    [--overwrite]    [--help]    [--verbose]    [--quiet]
16       [--ui]
17
18   Flags:
19       -z
20           Apply filter only to null data values
21
22       --overwrite
23           Allow output files to overwrite existing files
24
25       --help
26           Print usage summary
27
28       --verbose
29           Verbose module output
30
31       --quiet
32           Quiet module output
33
34       --ui
35           Force launching GUI dialog
36
37   Parameters:
38       input=name [required]
39           Name of input raster map
40
41       output=name [required]
42           Name for output raster map
43
44       filter=name [required]
45           Path to filter file
46
47       repeat=integer
48           Number of times to repeat the filter
49           Default: 1
50
51       title=string
52           Output raster map title
53

DESCRIPTION

55       r.mfilter filters the raster input to produce the raster output accord‐
56       ing to the matrix filter designed by the user (see FILTERS below).  The
57       filter is applied repeat times (default value is 1).  The output raster
58       map layer can be given a TITLE if desired.  (This TITLE should  be  put
59       in  quotes if it contains more than one word.)  With -z flag the filter
60       is applied only to null values in the  input  raster  map  layer.   The
61       non-null  category  values are not changed.  Note that if there is more
62       than one filter step, this rule is applied to the  intermediate  raster
63       map layer -- only null category values which result from the first fil‐
64       ter will be changed.  In most  cases  this  will  NOT  be  the  desired
65       result. Hence -z should be used only with single step filters.
66
67       The filter parameter defines the name of an existing, user-created UNIX
68       ASCII file whose contents is a matrix defining the  way  in  which  the
69       input  file  will  be  filtered.  The  format of this file is described
70       below, under FILTERS.
71
72       The repeat parameter defines the number of times the filter  is  to  be
73       applied to the input data.
74

FILTERS

76       The  filter  file is a normal UNIX ASCII file designed by the user.  It
77       has the following format:
78            TITLE      TITLE
79            MATRIX     n
80                         .
81            n lines of n values
82                         .
83            DIVISOR    d
84            TYPE        S/P
85
86       TITLE
87           A one-line TITLE for the filter.  If a TITLE was not  specified  on
88           the  command  line,  it can be specified here.  This TITLE would be
89           used to construct a TITLE for the resulting raster map  layer.   It
90           should be a one-line description of the filter.
91
92       MATRIX
93           The  matrix  (n x n) follows on the next n lines.  n must be an odd
94           integer greater than or equal to 3.  The matrix itself consists  of
95           n  rows  of n values.  The values must be separated from each other
96           by at least 1 blank.
97
98       DIVISOR
99           The filter divisor is d.  If not specified, the default is  1.   If
100           the divisor is zero (0), then the divisor is dependent on the cate‐
101           gory values in the neighborhood (see HOW THE FILTER WORKS below).
102
103       TYPE
104           The filter type.  S means sequential, while P  mean  parallel.   If
105           not specified, the default is S.
106
107       Sequential filtering happens in place.  As the filter is applied to the
108       raster map layer, the category values that were changed in  neighboring
109       cells  affect  the  resulting  category value of the current cell being
110       filtered.
111
112       Parallel filtering happens in such a way that the original  raster  map
113       layer category values are used to produce the new category value.
114
115       More  than  one  filter may be specified in the filter file.  The addi‐
116       tional filter(s) are described just like the first.  For  example,  the
117       following describes two filters:
118

EXAMPLE FILTER FILE

120             TITLE     3x3 average, non-null data only, followed by 5x5 average
121            MATRIX    3
122            1 1 1
123            1 1 1
124            1 1 1
125            DIVISOR   0
126            TYPE      P
127            MATRIX    5
128            1 1 1 1 1
129            1 1 1 1 1
130            1 1 1 1 1
131            1 1 1 1 1
132            1 1 1 1 1
133            DIVISOR   25
134            TYPE      P
135

HOW THE FILTER WORKS

137       The  filter  process produces a new category value for each cell in the
138       input raster map layer by multiplying the category values of the  cells
139       in  the  n x n neighborhood around the center cell by the corresponding
140       matrix value and adding them together.  If a divisor is specified,  the
141       sum is divided by this divisor.  (If a zero divisor was specified, then
142       the divisor is computed for each cell as the sum of the  MATRIX  values
143       where the corresponding input cell is non-null.)
144
145       If  more  than  one filter step is specified, either because the repeat
146       value was greater than one or because the filter  file  contained  more
147       than  one  matrix,  these  steps are performed sequentially. This means
148       that first one filter is applied to the entire input raster  map  layer
149       to  produce  an intermediate result; then the next filter is applied to
150       the intermediate result to produce another intermediate result;  and so
151       on,  until  the final filter is applied.  Then the output cell is writ‐
152       ten.
153

NOTES

155       If the resolution of the geographic region does not agree with the res‐
156       olution  of the raster map layer, unintended resampling of the original
157       data may occur.  The user should be sure that the geographic region  is
158       set properly.
159

SEE ALSO

161        g.region, r.clump, r.neighbors, r.resamp.filter
162

AUTHOR

164       Glynn  Clements.   Based  upon  r.mfilter, by Michael Shapiro, U.S.Army
165       Construction Engineering Research Laboratory
166
167       Last changed: $Date: 2016-09-19 12:29:41 +0200 (Mon, 19 Sep 2016) $
168

SOURCE CODE

170       Available at: r.mfilter source code (history)
171
172       Main index | Raster index | Topics index | Keywords index  |  Graphical
173       index | Full index
174
175       © 2003-2019 GRASS Development Team, GRASS GIS 7.6.0 Reference Manual
176
177
178
179GRASS 7.6.0                                                       r.mfilter(1)
Impressum