[GRASS-dev] r.mapcalc in Python script (parse error)

Margherita Di Leo dileomargherita at gmail.com
Tue Oct 25 15:58:31 EDT 2011


Hi all,

I need a little help with r.mapcalc syntax in Python script. I want to
convert the following formula:

grass.run_command('r.mapcalculator', amap = r_stream+'_nothin' , formula =
'%s*%s' % (r_stream+'_nothin', r_mask) , outfile = r_stream+'_nothin',
overwrite = True)

I want to use r.mapcalc instead of r.mapcalculator. So I write:

grass.mapcalc("$r_stream_nothin = $r_stream_nothin * $r_mask",
                      r_mask = r_mask,
                      r_stream_nothin = r_stream+'_nothin')

but I get parse error. What's the correct way to do this? The aim is to add
the suffix '_nothin' to the existing variable name r_stream.
Thank you in advance.

Regards,
madi

-- 
Eng. Margherita Di Leo
Ph.D. Candidate
Methods and Technologies for Environmental Monitoring
Department of Environmental Engineering and Physics (DIFA)

University of Basilicata
Campus Macchia Romana
85100 - Potenza
Italy

Office: +39-0971205360
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20111025/d6b3da00/attachment.html


More information about the grass-dev mailing list