[GRASS-user] mapcalc/mapcalculator in python script

Rainer M Krug r.m.krug at gmail.com
Tue Feb 1 10:28:41 EST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/01/2011 03:28 PM, Johannes Radinger wrote:
> Hello,
> 
> I am running GRASS GIS 6.5 and want to run a python script
> including a mapcaluculator-expression of a simple formula:
> 
> A=if(B,C)
> 
> grass.mapcalc("$upstream_shreve = if(${upstream_part},${shreve})",
>                   upstream_shreve = options['upstream_shreve'],
>                   upstream_part = options['upstream_part'],
>                   shreve = options['shreve'])
> 
> but that isn't working... I don't know whats excaclty the problem....

I don't know anything about python, but I had a similar problem under R,
where the problem was escaping of the formula - the formula needed to be
enclosed in " in grass.
To diagnose: can you see the command executed under GRASS? Does it work
if you paste this into GRASS?

Cheers,

Rainer


> 
> hopefully you can help me
> 
> thanks
> Johannes


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer at krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1IJqkACgkQoYgNqgF2egqR5gCdGBIrDkBUot4R7qZcSrcSOf/Q
vQcAn0r8YNJeNKZlpYklE4GtM+KYDoyd
=QJkU
-----END PGP SIGNATURE-----


More information about the grass-user mailing list