[GRASS-user] Why my python script of r.watershed has no output?

Heinz Chen liebenhans at gmail.com
Mon Mar 31 09:56:05 PDT 2014


As title, I want to use r.watershed module, and here's my python script in
pyscripter,

import osimport sys
#set up GRASS environment variables
sys.path.append(os.path.join(os.environ['GISBASE'], 'etc',
'python'))import grass.script as gimport grass.script.setup as gsetup
gisbase = os.environ['GISBASE']
gisdb = 'C:\Users\Heinz\Documents\grassdata'
location = 'newLocation'
mapset = 'TC'
gsetup.init(gisbase, gisdb, location, mapset)
#run r.watershed module#set thresh = 5000
g.run_command('r.watershed', elevation = 'hc', threshold = 5000,
accumulation = 'acc1', drainge = 'dra1', basin = 'bas1', stream =
'str1', half = 'hbas1', visual = 'vis1')print g.read_command('g.list',
_type = 'rast')

the output has generate no new raster data, and if I change the input
parameter 'half', an error will occur.
Can't GRASS just take the position of parameters, no matter what their name
is, to execute the module?

For more detail, please visit Why my python script of r.watershed has no
output?<http://gis.stackexchange.com/questions/90784/why-my-python-script-of-r-watershed-has-no-output>,
thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20140401/59c7caa1/attachment-0001.html>


More information about the grass-user mailing list