[GRASS-user] usage of r.mapcalc in python script

Margherita Di Leo diregola at gmail.com
Tue Dec 21 06:07:41 EST 2010

Hi All,

please any python programmer could explain me the correct use of r.mapcalc
in this case.
In my python script I have a formula like this:

n = 0.016 * (resolution ** 0.46)

(resolution is the cellsize of the input map).
and I have to calculate a map with:

grass.mapcalc("mti = log((exp($rast1 , n)) / $rast2)", rast1 =
'r_accumulation', rast2 = 'r_slope')

but since n is not a map, i get the error:

Invalid map <n>
Parse error
ERROR: An error occurred while running r.mapcalc

How can I use the 'n' in r.mapcalc?

Thank you in advance,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20101221/2187e7b5/attachment.html

More information about the grass-user mailing list