[GRASS-user] r.mask vs g.region

Moritz Lennert mlennert at club.worldonline.be
Wed Jul 11 06:19:12 PDT 2018


On 11/07/18 05:46, Huidae Cho wrote:
> Hello Rich,
> 
> g.region creates a rectangular computational region while r.mask can 
> create an irregular mask. If you use r.mask, any cells outside the mask 
> will be ignored, so you have to make sure that your mask is big enough 
> to cover your basin. In terms of computational time, r.mask can be 
> faster depending on what modules you need. For example, when you run 
> flow accumulation, you may save some time using r.mask because you don't 
> have to calculate flow accumulation outside your area of interest. If 
> you use g.region that covers your basin, you calculate flow accumulation 
> outside the basin within the rectangular region. So in general, I would 
> say r.mask is preferred if and only if the mask is correct.


See also the general raster info: 
https://grass.osgeo.org/grass74/manuals/rasterintro.html which explains 
that:


1.    Raster output maps have their bounds and resolution equal to those 
of the current computational region.
2.    Raster input maps are automatically cropped/padded and rescaled 
(using nearest-neighbour resampling) to match the current region.
3.    Raster input maps are automatically masked if a raster map named 
MASK exists. The MASK is only applied when reading maps from the disk.

In other words: the MASK only applies for reading. For a given region 
and MASK, interpolation will happen for the entire region, but only 
using raster input data which falls within the MASK (vector input data 
is read from the entire region generally). If you erase the MASK, you 
will see that the result of interpolation (and other raster commands) 
covers the entire region.

Moritz


More information about the grass-user mailing list