present boolean in JSON), what is raster name used to represent
the mask (name string in JSON), and whether the raster is
reclassifed from another (is_reclass_of string or null in JSON).
YAML and shell script style outputs are following the JSON output if possible.
The plain text format outputs multi-line human-readable information in natural
language.
With the -t flag, no output is printed, instead a return code is used to indicate presence or absence. The convention is the same same the POSIX test utility, so r.mask.status returns 0 when the mask is present and 1 otherwise.
r.mask.status format=json
import grass.script as gs
gs.parse_command("r.mask.status", format="json")
present,
full_name, and is_reclass_of.
test -f gives return code 0 when the file exists.
r.mask.status can be used in the same with the -t flag:
r.mask.status -t
# Bash
if r.mask.status -t; then
echo "Masking is active"
else
echo "Masking is not active"
fi