[GRASS-dev] r.mapcal and python

Glynn Clements glynn at gclements.plus.com
Tue Nov 11 02:26:48 EST 2008


Roberto Antolí­n wrote:

> > Ciao Roberto,
> > try with this solution:
> > 
> > output='yourmap'
> > map1='yourmap1'
> > map2='yourmap2'
> > cmdargs2=["%s=if(%s>%s,10000,0)"%(output,map1,map2)]
> > os.spawnvp(os.P_WAIT,"r.mapcalc", ["r.mapcalc"] + cmdargs2)
> 
> Thank you, Maxi! It works perfectly well. I think I'll use this solution 
> rather than the grass.py library for 'r.mapcalc'.

Don't use the os.spawn* functions; they have been superseded by
subprocess.Popen() and subprocess.call().

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list