[GRASS-user] [d.rast] not working with standalone script

Ang Sherpa angsherpa232 at gmail.com
Mon Jan 2 02:10:21 PST 2017


I am stuck with d.rast command. Don't know what am I missing here?
The script is attached herewith this mail.

*Regards,*
*Ang Dawa Sherpa*
*GIS technician - Irrigation Master Plan*
*WRPPF - DOI, Nepal Government*
*Lalitpur*
*contact: 984 007 3861*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20170102/504bd109/attachment.html>
-------------- next part --------------
import os
import sys
gisdbase = os.path.join(os.path.expanduser("~"), "Documents\\grassdata")
location = "nc_spm_08_grass7"
mapset   = "user1"

gisbase  = os.environ['GISBASE'] = r'C:\Program Files\GRASS GIS 7.2.0'

sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "python"))

from grass import script as gscript
from grass.script import setup as gsetup
from grass.script import core as grass
rcfile = gsetup.init(gisbase,gisdbase, location, mapset)
 
# look what you have done so far
print "grass environment"
gscript.message('Current Grass GIS 7 enviornment:')
print gscript.gisenv()

#these were just for testing if the path and stuffs are OK
for rast in gscript.list_strings(type='raster'):
    print rast
print gscript.read_command('r.info',map='accum_5k')

#Trying to run d.mon command 
gscript.run_command('d.mon',start='wx1',resolution='1')
gscript.run_command('d.rast',map='accum_5k')



os.remove(rcfile)


More information about the grass-user mailing list