[GRASS-user] scripting mapcalc
nikos.alexandris at felis.uni-freiburg.de
Fri Mar 6 06:46:08 EST 2009
> > Try this:
> > r.mapcalc river="if(river==$old, $new, null())"
> Note that this won't work in 7.0, where r.mapcalc uses the parser. It
> will complain that r.mapcalc doesn't have a river=... option.
> For portability, always:
> 1. quote the entire expression, and
> 2. insert a space before the first = sign, e.g.:
> r.mapcalc "river = if(river==$old, $new, null())"
> This will work with all versions of r.mapcalc.
I assume the above tips are valid for "normal" r.mapcalc use, that is
not within from a script. Having a space before the 1st = sign is in
addition more clear/easy to read when it comes to lots and long
r.mapcalc one-liners, one after another.
Kind regards, Nikos
More information about the grass-user