[GRASS-dev] MASK seems to be ignored

Glynn Clements glynn at gclements.plus.com
Wed Feb 6 11:53:27 EST 2008


Michael Barton wrote:

> > I'm having problems getting a MASK to actually mask anything.
> >
> > $ r.mask in=Diff_Nov2007_Oct2007_1m
> > 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]
> >
> > Yet all refreshes of the gis.m map display window do not clip the  
> > display extents
> > based on the new mask(see attached png). In the screenshot, the  
> > mask is the pink raster,
> > and underneath it is another raster in my mapset. Shouldn't the  
> > underlying raster's display
> > be clipped to that of the mask?
> >
> > Using r.mapcalc while the mask exists also doesn't seem to obey the  
> > extents of the mask, i.e.:
> >
> > r.mapcalc test = 'Diff_Oct2007_Mar2007_1m'
> >
> > This creates the raster 'test' with data extents that match  
> > Diff_Oct2007_Mar2007_1m, not the mask's
> > boundaries.
> >
> > I'm using svn-trunk compiled from today's source.
> >
> > ~ Eric.
> 
> 
> Eric,
> 
> The way I understand it is that a MASK will affect all subsequent  
> *read* operations for processing a raster map.

Correct.

> That is...
> 
> r.mapcalc 'newmap=oldmap'
> 
> ...will just produce an unaltered copy of oldmap without a MASK; with  
> a MASK it will produce a copy of oldmap only in the area of MASK.
> 
> MASK will not affect the display. It is for map processing.

As you've already noticed, MASK *will* affect the display. You can't
display a map without reading it, and MASK affects all raster read
operations unless they explicitly choose to avoid it by using the
G_get_*_row_nomask() functions.

FWIW, the following modules use the G_get_*_row_nomask() functions:

imagery/i.class
imagery/i.ortho.photo
imagery/i.points
imagery/i.rectify
imagery/i.vpoints
ps/ps.map
raster/r.basins.fill
raster/r.buffer
raster/r.cats
raster/r.compress
raster/r.describe
raster/r.le
raster/r.null
raster/r.random.cells
raster/r.random.surface
raster/r.recode
raster/r.rescale
raster/r.slope.aspect
raster/r.support.stats
raster/r.surf.contour
raster/r.surf.idw
raster/r.surf.idw2
raster/r.watershed

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list