1r.mask(1) Grass User's Manual r.mask(1)
2
3
4
6 r.mask - Create a MASK for limiting raster operation
7
9 raster, mask
10
12 r.mask
13 r.mask help
14 r.mask [-ior] input=string [maskcats=string] [--verbose] [--quiet]
15
16 Flags:
17 -i
18 Create inverse MASK from specified 'maskcats' list
19
20 -o
21 Overwrite existing MASK
22
23 -r
24 Remove existing MASK (overrides other options)
25
26 --verbose
27 Verbose module output
28
29 --quiet
30 Quiet module output
31
32 Parameters:
33 input=string
34 Raster map to use as MASK
35
36 maskcats=string
37 Category values to use for MASK (format: 1 2 3 thru 7 *)
38 Default: *
39
41 r.mask - Facilitates creation of a raster "MASK" map to control raster
42 operations.
43
44 The MASK is only applied when reading an existing GRASS raster map, for
45 example when used in a module as an input map. The MASK will block out
46 certain areas of a raster map from analysis and/or display, by "hiding"
47 them from sight of other GRASS modules. Data falling within the bounar‐
48 ies of the MASK can be modified and operated upon by other GRASS raster
49 modules; data falling outside the MASK is treated as if it were NULL.
50
51 Because the MASK is actually only a reclass map named "MASK", it can be
52 copied, renamed, removed, and used in analyses, just like other GRASS
53 raster map layers. The user should be aware that a MASK remains in
54 place until a user renames it to something other than "MASK", or
55 removes it using "r.mask -r" or g.remove.
56
57 Grid cells in the MASK map containing 0 or NULL will replace data with
58 NULL, while cells containing other values will allow data to pass
59 through unaltered.
60
61 To restore raster operations to normal (i.e., all cells of the current
62 region), remove the MASK file by setting the -r remove MASK flag. In
63 this case, a dummy value must also be given for the input parameter. A
64 MASK also can be removed by using g.remove or by renaming it to any
65 other name with g.rename.
66
68 The above method for specifying a "mask" may seem counterintuitive.
69 Areas inside the MASK are not hidden; areas outside the MASK will be
70 ignored until the MASK file is removed.
71
72 The mask is read as an integer map. If MASK is actually a floating-
73 point map, the values will be converted to integers using the map's
74 quantisation rules (this defaults to round-to-nearest, but can be
75 changed with r.quant).
76
77 r.mask uses r.reclass to create a reclassification of an existing
78 raster map and name it MASK. A reclass map takes up less space, but is
79 affected by any changes to the underlying map from which it was cre‐
80 ated. The user can select category values from the input raster to use
81 in the MASK with the maskcats parameter; if r.mask is run from the com‐
82 mand line, the category values listed in maskcats must be quoted (see
83 example below).
84
85 Somewhat similar program functions to those performed by r.mask can be
86 done using r.mapcalc, g.region, and other programs.
87
88 (GRASS Shell Script)
89
91 Creating a raster mask:
92 r.mask input=geology
93 MASK created. All subsequent raster operations
94 will be limited to MASK area
95 Removing or renaming raster file named MASK will
96 restore raster operations to normal
97 [Raster MASK present]
98 Removing a raster mask with the -r flag:
99 r.mask -r input=anything_you_wish
100 Removing raster <MASK>
101 Raster MASK removed
102 Creating a mask from categories 3 through 6 in the spearfish 'geology'
103 raster map:
104 r.mask input=geology maskcats="3 thru 6"
105 MASK created. All subsequent raster operations
106 will be limited to MASK area
107 Removing or renaming raster file named MASK will
108 restore raster operations to normal
109 [Raster MASK present]
110
112
113 g.region,
114 r.mapcalc,
115 r.reclass
116 g.remove
117 g.rename
118
119
121 Michael Barton, Arizona State University
122
123 Last changed: $Date: 2008-02-06 19:07:37 +0100 (Wed, 06 Feb 2008) $
124
125 Full index
126
127 © 2003-2008 GRASS Development Team
128
129
130
131GRASS 6.3.0 r.mask(1)