Dears,

before submitting another ticket, can anyone test if, under Windows,
`r.mapcalc` does overwrite the 'MASK' raster map?

Speaking in Python,

```
EQUATION = "{result} = {expression}"

masking = "if( {spectrum} == {highest_quality_category} && "
masking += "{aggregation} == {category}, "
masking += "1, null() )"

# following:
#   'recreation_spectrum' is a raster map
#   'HIGHEST_RECREATION_CATEGORY' is an integer number
#   'aggregation' is another raster map
#   'category' is another integer number
masking = masking.format(
       spectrum=recreation_spectrum,
       highest_quality_category=HIGHEST_RECREATION_CATEGORY,
       aggregation=aggregation,
       category=category,
       )

masking_equation = EQUATION.format(result="MASK", expression=masking)
grass.mapcalc(masking_equation, overwrite=True)
```

won't do under Windows. I yet have to verify this.

A workaround, currently:
```
g.remove( type="raster", name="MASK", flags='f')
grass.mapcalc(masking_equation, overwrite=True)
```

See also:
https://gitlab.com/natcapes/r.estimap.recreation/commit/470be9d0f3a69f43a9b559c27c8864a324e49a68.

Nikos
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to