Rechercher une page de manuel

Chercher une autre page de manuel:


Langue: en

Autres versions - même langue

Version: 372840 (fedora - 01/12/10)

Section: 1 (Commandes utilisateur)


r.mask - Create a MASK for limiting raster operation


raster, mask


r.mask help
r.mask [-ior] input=string [maskcats=string] [--verbose] [--quiet]



Create inverse MASK from specified 'maskcats' list

Overwrite existing MASK

Remove existing MASK (overrides other options)

Verbose module output

Quiet module output



Raster map to use as MASK

Category values to use for MASK (format: 1 2 3 thru 7 *)
Default: *


r.mask - Facilitates creation of a raster "MASK" map to control raster operations.

The MASK is only applied when reading an existing GRASS raster map, for example when used in a module as an input map. The MASK will block out certain areas of a raster map from analysis and/or display, by dqhiding" them from sight of other GRASS modules. Data falling within the bounaries of the MASK can be modified and operated upon by other GRASS raster modules; data falling outside the MASK is treated as if it were NULL.

Because the MASK is actually only a reclass map named "MASK", it can be copied, renamed, removed, and used in analyses, just like other GRASS raster map layers. The user should be aware that a MASK remains in place until a user renames it to something other than "MASK", or removes it using "r.mask -r" or g.remove.

Grid cells in the MASK map containing 0 or NULL will replace data with NULL, while cells containing other values will allow data to pass through unaltered.

To restore raster operations to normal (i.e., all cells of the current region), remove the MASK file by setting the -r remove MASK flag. In this case, a dummy value must also be given for the input parameter. A MASK also can be removed by using g.remove or by renaming it to any other name with g.rename.


The above method for specifying a "mask" may seem counterintuitive. Areas inside the MASK are not hidden; areas outside the MASK will be ignored until the MASK file is removed.

The mask is read as an integer map. If MASK is actually a floating-point map, the values will be converted to integers using the map's quantisation rules (this defaults to round-to-nearest, but can be changed with r.quant).

r.mask uses r.reclass to create a reclassification of an existing raster map and name it MASK. A reclass map takes up less space, but is affected by any changes to the underlying map from which it was created. The user can select category values from the input raster to use in the MASK with the maskcats parameter; if r.mask is run from the command line, the category values listed in maskcats must be quoted (see example below).

Somewhat similar program functions to those performed by r.mask can be done using r.mapcalc, g.region, and other programs.

(GRASS Shell Script)


Creating a raster mask:
r.mask input=geology
MASK created. All subsequent raster operations
will be limited to MASK area
Removing or renaming raster file named MASK will
restore raster operations to normal
[Raster MASK present]
Removing a raster mask with the -r flag:
r.mask -r input=anything_you_wish
Removing raster <MASK>
Raster MASK removed
Creating a mask from categories 3 through 6 in the spearfish 'geology' raster map:
r.mask input=geology maskcats="3 thru 6"
MASK created. All subsequent raster operations
will be limited to MASK area
Removing or renaming raster file named MASK will
restore raster operations to normal
[Raster MASK present]




Michael Barton, Arizona State University

Last changed: $Date: 2008-02-06 19:07:37 +0100 (Wed, 06 Feb 2008) $

Full index

© 2003-2008 GRASS Development Team

Ma querelle t'amuse car tonnera l'avide,
Maquerelle, ta muse cartonnera là, vide.
Telle, cruelle, la mante religieuse ment,
Tel le crû, elle, l'amante, religieusement,
Qu'elle amena, la carte la suce souvent.
Quelle âme n'a là. Car tel a su ce sou, vent,
Sondé, cornu, l'abri de fil, travers, la ride,
Son décor nu, la bride filtra vers l'aride.
Nonce, ta peur parle de nier la joute à mer,
Non, ce tapeur par le denier l'ajoute, amer.
La vedette guidera, ton macaque l'aide,
Lave dette, guide, raton, ma caque laide.
La veule Corse racontera lied en fer
L'aveu le corsera, contera lie d'enfer.
-- Roche, Jean