<html><head></head><body><div class="gmail_quote">Dave Roberts <dvrbts@ecology.msu.montana.edu> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">Colleagues,<br /><br />I know this must be easy, but I haven't found it.<br /><br />Suppose I have three grids (a, b, and c) where each grid is 0 or 1, <br />and the 1s are mutually exclusive. I want a new grid where if grid<br />a=1 then newgrid = 1; if grid b=1 then new grid = 2; if grid c=1 then <br />newgrid = 3.<br /><br />Something like r.mapcalc "new=if(a,1) || if(b,2) || if(c,3)"<br /><br />seems like it ought to work but I can't seem to use multiple input file <br />that way.<br /><br />Thanks in advance for any help, Dave</pre></blockquote></div><br clear="all">What about<br>
<br>
r.mapcalc new=a + b*2 + c*3<br>
<br>
If the maps are mutually exclusive, only one of the three will be non-zero for each cell.<br>
<br>
Tyler</body></html>