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

NAME

6       r.mfilter.fp  - Raster map matrix filter.
7

KEYWORDS

9       raster, map algebra
10

SYNOPSIS

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

DESCRIPTION

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

FILTERS

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

EXAMPLE FILTER FILE

118
119             TITLE      3x3 average, non-null data only, followed by 5x5 aver‐
120       age
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
136

HOW THE FILTER WORKS

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

NOTES

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

SEE ALSO

162       g.region, r.clump, r.neighbors r.mfilter
163

AUTHOR

165       Glynn Clements.  Based upon r.mfilter,  by  Michael  Shapiro,  U.S.Army
166       Construction Engineering Research Laboratory
167
168       Last changed: $Date: 2007-08-03 12:16:08 +0200 (Fri, 03 Aug 2007) $
169
170       Full index
171
172       © 2003-2008 GRASS Development Team
173
174
175
176GRASS 6.3.0                                                    r.mfilter.fp(1)
Impressum