GRASS mapcalc in Python Shell

المشرف العام

Administrator
طاقم الإدارة
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 1 or 0. In GRASS I used the command r.mapcalc

r.mapcalc test.new.01="test.01/test.01"r.mapcalc test.new.01="int(test.new.01)"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 grassimport grass.script.setup as gsetupfor rast in grass.list_strings(type = 'rast'): print rast......test.01@mapsetNow I tried to use the Python function grass.raster.mapcalc() but without success, it kills my GRASS GIS process.

expr = "test.01@mapset/test.01@mapset"output = grass.raster.mapcalc(expr)The question is also how to write the result into a new raster dataset.



أكثر...
 
أعلى