I'm trying to convert my GRASS/Bash script into the Phython Shell. Now I have a raster dataset (test.01) which I want to convert in
0. In GRASS I used the command
Now in the Python Shell I figured just the first steps, but I don't get the concept how to return the calculation into a new raster dataset.
import grass.script as grass import grass.script.setup as gsetup for rast in grass.list_strings(type = 'rast'): print rast ... ... test.01@mapset
Now I tried to use the Python function
grass.raster.mapcalc() but without success, it kills my GRASS GIS process.
expr = "if(test.01@mapset/test.01@mapset==1,1,0)" output = grass.raster.mapcalc(expr)
The question is also how to write the result into a new raster dataset.