~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to raster/r.mfilter/r.mfilter.html

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<h2>DESCRIPTION</h2>
 
2
 
 
3
<em>r.mfilter</em> filters the raster <em>input</em> to produce the
 
4
raster <em>output</em> according to the matrix <em>filter</em> designed
 
5
by the user (see <em>FILTERS</em> below).
 
6
The filter is applied <em>repeat</em> times (default <em>value</em> is 1).
 
7
The <em>output</em> raster map layer can be given a <em>TITLE</em> if desired.
 
8
(This TITLE should be put in quotes if it contains more than one word.)
 
9
 
 
10
With <b>-z</b> flag the filter is applied only to null values in
 
11
the input raster map layer.  The non-null category values are not changed.
 
12
Note that if there is more than one filter step, this rule is applied to the
 
13
intermediate raster map layer -- only null category values which result from
 
14
the first filter will be changed.  In most cases this will NOT be the
 
15
desired result. Hence -z should be used only with single step filters.
 
16
<p>
 
17
The <b>filter</b> parameter defines the name of an existing, user-created
 
18
UNIX ASCII file whose contents is a matrix defining the way in which the
 
19
<em>input</em> file will be filtered. The format of this file is described
 
20
below, under FILTERS.
 
21
<p>
 
22
The <b>repeat</b> parameter defines the number of times the <em>filter</em>
 
23
is to be applied to the <em>input</em> data.
 
24
 
 
25
<h2>FILTERS</h2>
 
26
 
 
27
The <em>filter</em> file is a normal UNIX ASCII file designed by the user.
 
28
It has the following format:
 
29
<div class="code"><pre>
 
30
     TITLE      TITLE
 
31
     MATRIX     n
 
32
                  .
 
33
     n lines of n values
 
34
                  .
 
35
     DIVISOR    d
 
36
     TYPE        S/P
 
37
</pre></div>
 
38
 
 
39
<dl>
 
40
<dt>TITLE 
 
41
 
 
42
<dd>A one-line TITLE for the filter.
 
43
If a TITLE was not specified on the command line, it can be specified here.
 
44
This TITLE would be used to construct a TITLE for the resulting raster map
 
45
layer.  It should be a one-line description of the filter.
 
46
 
 
47
<dt>MATRIX 
 
48
 
 
49
<dd>The matrix (n x n) follows on the next n lines.  <em>n</em> must be
 
50
an odd integer greater than or equal to 3.
 
51
The matrix itself consists of n rows of n values.
 
52
The values must be separated from each other by at least 1 blank.
 
53
 
 
54
<dt>DIVISOR 
 
55
 
 
56
<dd>The filter divisor is <em>d</em>.  If not specified, the default is 1.
 
57
If the divisor is zero (0), then the divisor is dependent on the
 
58
category values in the neighborhood
 
59
(see HOW THE FILTER WORKS below).
 
60
 
 
61
<dt>TYPE 
 
62
 
 
63
<dd>The filter type.  <em>S</em> means sequential, while <em>P</em> mean parallel.
 
64
If not specified, the default is S.
 
65
 
 
66
 
 
67
<p>
 
68
Sequential filtering happens in place.  As the filter is applied to the
 
69
raster map layer, the category values that were changed in neighboring
 
70
cells affect the resulting category value of the current
 
71
cell being filtered.
 
72
 
 
73
 
 
74
<p>Parallel filtering happens in such a way that the original raster
 
75
map layer category values are used to produce the new category value.
 
76
 
 
77
 
 
78
<p>More than one filter may be specified in the filter file.
 
79
The additional filter(s) are described just like the first.
 
80
For example, the following describes two filters:
 
81
 
 
82
 
 
83
</dl>
 
84
 
 
85
 
 
86
<h2>EXAMPLE FILTER FILE</h2>
 
87
 
 
88
<div class="code"><pre>
 
89
      TITLE     3x3 average, non-null data only, followed by 5x5 average
 
90
     MATRIX    3
 
91
     1 1 1
 
92
     1 1 1
 
93
     1 1 1
 
94
     DIVISOR   0
 
95
     TYPE      P
 
96
 
 
97
     MATRIX    5
 
98
     1 1 1 1 1
 
99
     1 1 1 1 1
 
100
     1 1 1 1 1
 
101
     1 1 1 1 1
 
102
     1 1 1 1 1
 
103
     DIVISOR   25
 
104
     TYPE      P
 
105
</pre></div>
 
106
 
 
107
<h2>HOW THE FILTER WORKS</h2>
 
108
 
 
109
The filter process produces a new category value for each cell
 
110
in the input raster map layer by multiplying the category values of the
 
111
cells in the n x n neighborhood around the center cell
 
112
by the corresponding matrix value and adding them together.
 
113
If a divisor is specified, the sum is divided by this divisor.
 
114
(If a zero divisor was specified, then
 
115
the divisor is computed for each cell as the sum of the MATRIX
 
116
values where the corresponding input cell is non-null.)
 
117
 
 
118
 
 
119
<p>
 
120
If more than one filter step is specified, either because the
 
121
repeat value was greater than one or because the filter file
 
122
contained more than one matrix, these steps are performed
 
123
sequentially. This means that first one filter is applied to
 
124
the entire input raster map layer to produce an intermediate result;
 
125
then the next filter is applied to the intermediate result to
 
126
produce another intermediate result;  and so on, until the
 
127
final filter is applied.  Then the output cell is written.
 
128
 
 
129
<h2>NOTES</h2>
 
130
 
 
131
If the resolution of the geographic region does not agree with the
 
132
resolution of the raster map layer, unintended resampling of the original
 
133
data may occur.  The user should be sure that the geographic region
 
134
is set properly.
 
135
 
 
136
<h2>SEE ALSO</h2>
 
137
 
 
138
<em><a href="g.region.html">g.region</a></em>,
 
139
<em><a href="r.clump.html">r.clump</a></em>,
 
140
<em><a href="r.neighbors.html">r.neighbors</a></em>
 
141
<em><a href="r.mfilter.html">r.mfilter</a></em>
 
142
 
 
143
<h2>AUTHOR</h2>
 
144
 
 
145
Glynn Clements.
 
146
Based upon r.mfilter, by Michael Shapiro,
 
147
U.S.Army Construction Engineering Research Laboratory
 
148
 
 
149
<p><i>Last changed: $Date: 2014-12-12 00:16:30 +0100 (Fri, 12 Dec 2014) $</i>