[GRASSLIST:4435] Re: r.mapcalc and variables solution

Leonardo Lami lami at faunalia.it
Thu Sep 30 07:18:11 EDT 2004


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

Hi,
I find the solution using another way to express the variables in r.mapcalc:

r.mapcalc<<EOF
cost_${a}_ok=if((sir_clump!=0 && sir_${b}!=1),0,if(sir_clump!=0 && 
sir_${a}==1,cost_${a},cost_${a}))
EOF

Thanks

Alle 12:20, giovedì 30 settembre 2004, hai scritto:
> Hi,
>
> I'm using the r.mapcalc module inside of a script.
> I'm using unix shell commands with constructs for iterative execution (for
> a in - do) and so I have a variable ($a) that I use in the input, output
> and options setting of the GRASS commands.
> I have no problem usually but if I use r.mapcalc like in the example I have
> this error message:
>
> GRASS 5.7.cvs:~ > r.mapcalc<<EOF
>
> > 'cost_'$a'_ok'=if(sir_clump!=0,0,'cost_'$a'')
> > EOF
>
> parse error, expecting `'=''
> Parse error
>
> Someone can explain me how to use variable in r.mapcalc?
>
> Thanks of all

- -- 
Leonardo Lami
lami at faunalia.it            www.faunalia.it
Via Colombo 3 - 51010 Massa e Cozzile (PT), Italy   Tel: (+39)349-1310164
GPG key @: hkp://wwwkeys.pgp.net http://www.pgp.net/wwwkeys.html
https://www.biglumber.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBW+t092hCyP73w7ARAnKiAKCDzEAGCZMNsITwa0t+H6jAPAgIKwCfYwPw
bxAbuUz9/j83BV/mR6Zcwa4=
=CbUq
-----END PGP SIGNATURE-----




More information about the grass-user mailing list