[GRASS5] r.mapcalc question

David Piasecki piasecda at nv.doe.gov
Wed Feb 2 14:14:35 EST 2005


Since I'm relatively new to GRASS, I just ran across the r.mapcalc  
command, and I started playing with it for merging image data. I've  
tried the following, some which works (but it's annoying) and some  
which doesn't work but I'd like to know why. For both, assume the  
region is set correctly.

First of all, what works:
r.mapcalc  
'calc.red=if(isnull(image0.red),image1.red,if(isnull(image1.red),image0. 
red))'

That's great; however, I have 42 images. So I tried some logic...
r.mapcalc 'calc.red=( image0.red || image1.red )'
r.mapcalc 'calc.red=( image0.red + image1.red )'

I think these aren't working because GRASS has a problem evaluating  
these expressions since image0.red is null wherever image1.red is not  
null. However, no error messages are given. Is there an easier way to  
do this than the first command given above?

Thanks,
David






More information about the grass-dev mailing list