Skip to content

Commit

Permalink
r.mapcalc: Use mask and not MASK in the doc (#4999)
Browse files Browse the repository at this point in the history
Uses mask or raster mask instead of MASK in the documentation. Where the raster called MASK needs to be accessed directly in an example, MASK is used as the assumed name mentioning that explicitly.

Updates r3.mapcalc in the same way which should be harmless since the wording does not explicitly mention the possibility of a different name. The text looks like a direct copy-paste from r.mapcalc, so that is preserved. The only improvement is that r3.mask is now linked instead of r.mask (in the 3D doc).
  • Loading branch information
wenzeslaus authored Jan 29, 2025
1 parent 5626d0f commit 3650646
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
24 changes: 13 additions & 11 deletions raster/r.mapcalc/r.mapcalc.html
Original file line number Diff line number Diff line change
Expand Up @@ -619,15 +619,15 @@ <h3>Interactive input in command line</h3>
the map title will contain only some of it, but most (if not all) of
the formula will be placed into the history file for the <em>result</em> map.

<h3>Raster MASK handling</h3>
<h3>Raster mask handling</h3>
<p>
<em>r.mapcalc</em> follows the common GRASS behavior of raster MASK handling,
so the MASK is only applied when reading an existing GRASS raster map.
<em>r.mapcalc</em> follows the common GRASS behavior of raster mask handling,
so the mask is only applied when reading an existing GRASS raster map.
This implies that, for example, the command:
<div class="code"><pre>
r.mapcalc "elevation_exaggerated = elevation * 3"
</pre></div>
create a map respecting the masked pixels if MASK is active.
create a map with NULL cells for the masked-out cells if raster mask is active.

<p>
However, when creating a map which is not based on any map,
Expand All @@ -636,17 +636,19 @@ <h3>Raster MASK handling</h3>
r.mapcalc "base_height = 200.0"
</pre></div>
the created raster map is limited only by a computation region
but it is not affected by an active MASK.
This is expected because, as mentioned above, MASK is only applied when reading,
not when writing a raster map.
<p>
If also in this case the MASK should be applied, an if() statement including the
MASK should be used, e.g.:
but it is not affected by an active raster mask.
This is expected because, as mentioned above, the mask is only applied
when reading, not when writing a raster map.
If the raster mask should be applied in this case, an <code>if()</code>
function including the mask raster should be used, e.g.
(assuming the mask is called <code>MASK</code>):
<div class="code"><pre>
r.mapcalc "base_height = if(MASK, 200.0, null())"
</pre></div>

When testing MASK related expressions keep in mind that when MASK is active
<p>
When testing expressions related to mask handling keep in mind that
when the raster mask is active,
you don't see data in masked areas even if they are not NULL.
See <em><a href="r.mask.html">r.mask</a></em> for details.

Expand Down
26 changes: 14 additions & 12 deletions raster/r.mapcalc/r3.mapcalc.html
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,15 @@ <h3>Interactive input in command line</h3>
existing map layers. Users should therefore take care to assign program
outputs raster map names that do not yet exist in their current mapsets.

<h3>3D GRID MASK handling</h3>
<h3>3D GRID mask handling</h3>
<p>
<em>r3.mapcalc</em> follows the common GRASS behavior of raster MASK handling,
so the MASK is only applied when reading an existing GRASS raster map.
<em>r3.mapcalc</em> follows the common GRASS behavior of raster mask handling,
so the mask is only applied when reading an existing GRASS raster map.
This implies that, for example, the command:
<div class="code"><pre>
r3.mapcalc "volume_amplified = volume * 3"
</pre></div>
create a map respecting the masked pixels if MASK is active.
create a map with NULL cells for the masked-out cells if raster mask is active.

<p>
However, when creating a map which is not based on any map,
Expand All @@ -466,19 +466,21 @@ <h3>3D GRID MASK handling</h3>
r3.mapcalc "volume_const = 200.0"
</pre></div>
the created raster map is limited only by a computation region
but it is not affected by an active MASK.
This is expected because, as mentioned above, MASK is only applied when reading,
not when writing a raster map.
<p>
If also in this case the MASK should be applied, an if() statement including the
MASK should be used, e.g.:
but it is not affected by an active raster mask.
This is expected because, as mentioned above, the mask is only applied
when reading, not when writing a raster map.
If the raster mask should be applied in this case, an <code>if()</code>
function including the mask raster should be used, e.g.
(assuming the mask is called <code>MASK</code>):
<div class="code"><pre>
r3.mapcalc "volume_const = if(MASK, 200.0, null())"
</pre></div>

When testing MASK related expressions keep in mind that when MASK is active
<p>
When testing expressions related to mask handling keep in mind that
when the raster mask is active,
you don't see data in masked areas even if they are not NULL.
See <em><a href="r.mask.html">r.mask</a></em> for details.
See <em><a href="r3.mask.html">r3.mask</a></em> for details.

<h3>Random number generator initialization</h3>
<p>The pseudo-random number generator used by the rand() function can
Expand Down

0 comments on commit 3650646

Please sign in to comment.