I was wondering is it not possible to specify a variable in the
neighbourhood modifier in r.mapcalc. E.g. I can write map[2,-1] but if
I write something like map[offsetrow,offsetcolumn] I get:
parse error, unexpected `VARNAME', expecting `INTEGER' or `'-''
Parse error
Is there a good reason for this / would it be possible to change it, or
does anybody know a workaround for specifying the contents of any
arbitrary cell using variables?
Thanks in advance for any ideas
Paul
Paul Kelly wrote:
I was wondering is it not possible to specify a variable in the
neighbourhood modifier in r.mapcalc. E.g. I can write map[2,-1] but if
I write something like map[offsetrow,offsetcolumn] I get:
parse error, unexpected `VARNAME', expecting `INTEGER' or `'-''
Parse error
Is there a good reason for this / would it be possible to change it, or
does anybody know a workaround for specifying the contents of any
arbitrary cell using variables?
What sort of variable?
Bear in mind that r.mapcalc's "variables" are effectively entire maps;
the value may change from cell to cell.
If you are thinking in terms of scripting, you can just use the
shell's variables e.g.
offsetrow=2
offsetcolumn=-1
r.mapcalc "out = map[$offsetrow,$offsetcolumn]"
OTOH, if you want something that will vary over the course of the
evaluation, then it isn't possible, and it isn't really feasible to
change r.mapcalc to make it possible.
--
Glynn Clements <glynn.clements@virgin.net>