[GRASS-user] python grass script error

Vinay Elothunkal vinay223333 at gmail.com
Thu Jun 30 21:15:25 PDT 2016


Hi all,

Can anyone please help me to solve the error with '@' mark which comes
along with mapset in python GRASS script.   I get the following error when
I run "mapcal.py"

*syntax error, unexpected '@', expecting '('*

# mapcal.py
import grass.script as g
lis=['a at mapset','b at mapset']
for i in lis:

     g.mapcalc("{tmp_NDVI}=float({NIR}-Red})/float({NIR}+{Red})".format(tmp_NDVI='NDVI'+str(i),
NIR='B5 at mapset',Red='B4 at mapset'),overwrite=True)


Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160701/052b4095/attachment.html>


More information about the grass-user mailing list