[GRASS-dev] r.mapcal and python
Roberto Antolín
rantolin.geo at gmail.com
Mon Nov 10 10:55:41 EST 2008
Hi all, Moritz,
Moritz Lennert escribió:
>> grass.run_command('r.mapcalc', expression = "%s=%s-%s" % (out, dsm, dtm))
>
> The expression= parameter only exists in GRASS7, but not in grass6.x.
>
> So, r.mapcalc expression=k=1
>
> will give you
>
> in GRASS6.x: a map called 'expression' with the value 1
That was exactly what I obtained: a map called 'expression' with the
difference between dtm and dsm.
>> grass.run_command('r.mapcalc', %s = "%s-%s" % (out, dsm, dtm))
>
> No expert, but shouldn't this be:
>
> grass.run_command('r.mapcalc', "%s = %s-%s" % (out, dsm, dtm))
In fact that was the first thing I tried, but I got this error:
syntax error, unexpected '-', expecting NAME or STRING
Parse error
Regards,
Roberto.
More information about the grass-dev
mailing list