[GRASS-user] Re: r.mapcalc and nested if

Jarek Jasiewicz jarekj at amu.edu.pl
Wed Apr 14 13:48:11 EDT 2010


thedok78 pisze:
> Sorry, this is the expression:
> r.mapcalc 'map2=if(map ==1
> ,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]),map))'
>
> Thanks
> Luca
>   
seem that much easier will be:

r.neighbors input=your_map method=mode size=3 output=mode_output
r.mapcalc 'first_map=if(your_map==1,output_mode,your_map)'
r.mapclac 'final=if(first_map=1,0,first_map'



More information about the grass-user mailing list