[GRASS-user] python grass script error

Paulo van Breugel p.vanbreugel at gmail.com
Thu Jun 30 23:22:04 PDT 2016


Shouldn't there be spaces around the first equal sign:

"{tmp_NDVI} = float ....


On Fri, Jul 1, 2016 at 7:36 AM Vinay Elothunkal <vinay223333 at gmail.com>
wrote:

> Hai Maxi,
>
> Sorry, I missed { when I write the mail, but while running I have used it
> correctly, still same error!
>
> regards,
> Vinay
>
> On Fri, Jul 1, 2016 at 1:51 PM, Massimiliano Cannata <
> massimiliano.cannata at supsi.ch> wrote:
>
>> Looks like you missed one { before of Red. Don't know...maybe isn't it
>> bur give a try.
>>
>> Maxi
>> Il 01/Lug/2016 06:15, "Vinay Elothunkal" <vinay223333 at gmail.com> ha
>> scritto:
>>
>>> 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,
>>>
>>> _______________________________________________
>>> grass-user mailing list
>>> grass-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>>
>>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160701/a54ee18a/attachment.html>


More information about the grass-user mailing list