[GRASS-user] r.mapcalc and nested if

thedok78 thedoktor78 at gmail.com
Wed Apr 14 10:26:00 EDT 2010


Hello everybody,
I need to run a complex r.mapcalc expression, but I can't understand how to
use nested if.
This is the expression:
r.mapcalc
'map2=if(mode(map[-1,-1],map[-1,0],map[-1,1],map[0,1],map[1,1],map[1,0],map[1,-1],map[0,-1])==1,0,mode(map[-1,-1],map[-1,0],map[-1,1],map[0,1],map[1,1],map[1,0],map[1,-1],map[0,-1]))'

The idea is this:
if the cell value is 1, do the mode else skip that cell; 
if the mode is equal to 1 assign 0 to that cell else assign the mode value.

The r.mapcalc expression I just posted produce wrong result..
Any idea?

Thanks
Luca
-- 
View this message in context: http://n2.nabble.com/r-mapcalc-and-nested-if-tp4901916p4901916.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list