#2032 closed defect (invalid)
r.mapcalc does not always respect MASK
Reported by: | pvanbosgeo | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.0.0 |
Component: | Raster | Version: | unspecified |
Keywords: | r.mapcalc | Cc: | |
CPU: | Unspecified | Platform: | Linux |
Description
If I run:
r.mask raster=mymask r.mapcalc "test1 = 1" r.mapcalc "test2 = test1" r.mask -r
The layer test1 has value 1 for all raster cells within the current region. In layer test2 only cells within the masked area have the value 1, cells outside the mask have nodata, as I would expect.
Running GRASS 7.0 rv 57144 on Ubuntu 13.04
Change History (3)
comment:1 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
follow-up: 3 comment:2 by , 11 years ago
OK, thanks, I didn't know that / hadn't read that part of the manual carefully enough. Perhaps not something that the user will encounter often, but nonetheless, it is something I can see others might overlook as well when using r.mapcalc. Perhaps a short note of this can be added to the r.mapcalc help file (which is where I looked to see where my expectations of the behavior of r.mapcalc were wrong)?
comment:3 by , 11 years ago
Replying to pvanbosgeo:
OK, thanks, I didn't know that / hadn't read that part of the manual carefully enough. Perhaps not something that the user will encounter often, but nonetheless, it is something I can see others might overlook as well when using r.mapcalc. Perhaps a short note of this can be added to the r.mapcalc help file (which is where I looked to see where my expectations of the behavior of r.mapcalc were wrong)?
The behaviour isn't specific to r.mapcalc. Except for a few special cases, the MASK behaviour isn't implemented by the individual modules, but by the raster I/O library. You can observe the same behaviour with e.g. r.neighbors.
The correct place to document this behaviour is wherever the MASK behaviour is described, e.g. the rasterintro manual page and the r.mask manual page. FWIW, the first sentence of the DESCRIPTION section of the r.mask manual page (after the summary) is:
The MASK is only applied when reading an existing GRASS raster map, for example when used in a module as an input map.
Replying to pvanbosgeo:
From the raster intro [0]: "Raster input maps are automatically masked if a raster map named MASK exists. The MASK is only applied when reading maps from the disk."
A MASK is not applied when writing out files. If you set the output cell value to constant 1, all output cells will have the value 1, even if a MASK was set while writing the output raster.
[0] http://grass.osgeo.org/grass70/manuals/rasterintro.html