[GRASS-dev] GRASS Scripts access to channel headers info

Markus Neteler neteler at osgeo.org
Wed Feb 10 16:52:54 EST 2010


2010/2/10 António Rocha <antonio.rocha at deimos.com.pt>:
> Hey All
>
> Both suggestions worked. Thanks
> By the way, I'm having some difficulties in using mapcalc in a python
> scripts.
> I'm doing this
> grass.mapcalc(options['output']=options['raster1']+options['raster2'])
>
> And I get:
>  File "/usr/local/grass-6.4.0svn/scripts/python.teste",
> line 61
>   grass.mapcalc(options['output']=options['raster1']+options['raster2'])
> SyntaxError: keyword can't be an expression
>
> How can I use an option as an input in mapcalc funtion, called from a Python
> script?

In grass7/scripts/r.plane/r.plane.py I see

    grass.mapcalc("$name = $type($round(x() * $kx + y() * $ky + $kz))",
                  name = name, type = type, round = round, kx = kx, ky
= ky, kz = kz)

Perhaps a way how to do it.

Markus


More information about the grass-dev mailing list