1r.mask(1) Grass User's Manual r.mask(1)
2
3
4
6 r.mask - Creates a MASK for limiting raster operation.
7
9 raster, mask
10
12 r.mask
13 r.mask --help
14 r.mask [-ir] [raster=name] [maskcats=string] [vector=name]
15 [layer=string] [cats=range] [where=sql_query] [--overwrite]
16 [--help] [--verbose] [--quiet] [--ui]
17
18 Flags:
19 -i
20 Create inverse mask
21
22 -r
23 Remove existing mask (overrides other options)
24
25 --overwrite
26 Allow output files to overwrite existing files
27
28 --help
29 Print usage summary
30
31 --verbose
32 Verbose module output
33
34 --quiet
35 Quiet module output
36
37 --ui
38 Force launching GUI dialog
39
40 Parameters:
41 raster=name
42 Name of raster map to use as mask
43
44 maskcats=string
45 Raster values to use for mask
46 Format: 1 2 3 thru 7 *
47 Default: *
48
49 vector=name
50 Name of vector map to use as mask
51 Or data source for direct OGR access
52
53 layer=string
54 Layer number or name (vector)
55 Vector features can have category values in different layers. This
56 number determines which layer to use. When used with direct OGR
57 access this is the layer name.
58 Default: 1
59
60 cats=range
61 Category values (vector)
62 Example: 1,3,7-9,13
63
64 where=sql_query
65 WHERE conditions of SQL statement without ’where’ keyword (vector)
66 Example: income < 1000 and population >= 10000
67
69 r.mask - Facilitates creation of a raster "MASK" map to control raster
70 operations.
71
72 The MASK is only applied when reading an existing GRASS raster map, for
73 example when used in a module as an input map. The MASK will block out
74 certain areas of a raster map from analysis and/or display, by "hiding"
75 them from sight of other GRASS modules. Data falling within the bounar‐
76 ies of the MASK can be modified and operated upon by other GRASS raster
77 modules; data falling outside the MASK is treated as if it were NULL.
78
79 Because the MASK is actually only a reclass map named "MASK", it can be
80 copied, renamed, removed, and used in analyses, just like other GRASS
81 raster map layers. The user should be aware that a MASK remains in
82 place until a user renames it to something other than "MASK", or
83 removes it using "r.mask -r" or g.remove.
84
85 Grid cells in the MASK map containing 0 or NULL will replace data with
86 NULL, while cells containing other values will allow data to pass
87 through unaltered.
88
89 To restore raster operations to normal (i.e., all cells of the current
90 region), remove the MASK file by setting the -r remove MASK flag. In
91 this case, a dummy value must also be given for the input parameter. A
92 MASK also can be removed by using g.remove or by renaming it to any
93 other name with g.rename.
94
96 The above method for specifying a "mask" may seem counterintuitive.
97 Areas inside the MASK are not hidden; areas outside the MASK will be
98 ignored until the MASK file is removed.
99
100 The MASK is read as an integer map. If MASK is actually a float‐
101 ing-point map, the values will be converted to integers using the map’s
102 quantisation rules (this defaults to round-to-nearest, but can be
103 changed with r.quant).
104
105 r.mask uses r.reclass to create a reclassification of an existing
106 raster map and name it MASK. A reclass map takes up less space, but is
107 affected by any changes to the underlying map from which it was cre‐
108 ated. The user can select category values from the input raster to use
109 in the MASK with the maskcats parameter; if r.mask is run from the com‐
110 mand line, the category values listed in maskcats must be quoted (see
111 example below).
112
113 Somewhat similar program functions to those performed by r.mask can be
114 done using r.mapcalc, g.region, and other commands.
115
117 The examples are based on the North Carolina sample dataset.
118
119 Create a raster mask, for contraining the calculation of univariate
120 statistics of the elevation values for "lakes":
121 # set computation region to lakes raster map
122 g.region raster=lakes -p
123 # use lakes as MASK
124 r.mask raster=lakes
125 # get statistics for elevation pixels of lakes:
126 r.univar elevation
127 Remove the raster mask ("MASK" map) with the -r flag:
128 r.mask -r
129 Creating a mask from selected categories in the North Carolina ’geol‐
130 ogy_30m’ raster map:
131 g.region raster=geology_30m -p
132 r.category geology_30m
133 d.mon wx0
134 d.rast geology_30m
135 r.mask raster=geology_30m maskcats="217 thru 720"
136 d.mon wx0
137 d.rast geology_30m
138
140 g.region, r.mapcalc, r.reclass, g.remove, g.rename
141
143 Michael Barton, Arizona State University
144
145 Last changed: $Date: 2014-12-19 22:17:36 +0100 (Fri, 19 Dec 2014) $
146
148 Available at: r.mask source code (history)
149
150 Main index | Raster index | Topics index | Keywords index | Graphical
151 index | Full index
152
153 © 2003-2019 GRASS Development Team, GRASS GIS 7.6.0 Reference Manual
154
155
156
157GRASS 7.6.0 r.mask(1)