<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Sep 6, 2018 at 7:55 AM Micha Silver <<a href="mailto:tsvibar@gmail.com">tsvibar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
    
  
  <div style="direction:ltr" text="#000000" bgcolor="#FFFFFF">
    You need quotes around the expression:<br>
    <br>
    <div class="m_9095897060266807853moz-cite-prefix">On 06/09/2018 13:47, Vidura
      Dantanarayana wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div>Hi all,</div>
            <div>I need to create a raster file with the  <span style="color:rgb(255,0,0)">if(fuel_class==4,3,if(fuel_class==8,15))</span>
              expression. I used the following command but it result a
              parse error. <br>
            </div>
            <div><br>
            </div>
            <div>r.mapcalc --overwrite expression=1hr_moisture =
              if(fuel_class==4,3,if(fuel_class==8,15))</div>
          </div>
        </div>
      </div>
    </blockquote>
    r.mapcalc --overwrite expression="1hr_moisture =
    if(fuel_class==4,3,if(fuel_class==8,15))"<br>
    <br>
    Also, what happens if feul_class is not 4 and not 8??<br></div></blockquote><div><br></div><div><br></div><div>Good point.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="direction:ltr" text="#000000" bgcolor="#FFFFFF">
    <blockquote type="cite">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div><br>
            </div>
            <div>What could be the reason for the error?</div></div></div></div></blockquote></div></blockquote><div><br></div><div>Not sure, perhaps more info would be in the whole error message, but here are some tips:</div><div><br></div><div>1. Check if the input raster map exists.</div><div>2. Do not start the raster map name with a number.<br></div><div>3. Use space after comma and around operators (best practice).<br></div><div><br></div><div>Here is the same expression but with the suggestions and null() for the case Mica mentioned (note that I didn't actually tested that):<br></div><div><br></div><div>
    r.mapcalc --overwrite expression="moisture_1hr =
    if(fuel_class == 4, 3, if(fuel_class == 8, 15, null()))"</div><div> </div><div>Vaclav<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="direction:ltr" text="#000000" bgcolor="#FFFFFF"><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div dir="ltr">
            <div><br>
            </div>
            <div>BR,</div>
            <div>Vidura Dantanarayana. <br>
            </div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="m_9095897060266807853mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
grass-user mailing list
<a class="m_9095897060266807853moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a>
<a class="m_9095897060266807853moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a></pre>
    </blockquote>
    <br>
    <pre class="m_9095897060266807853moz-signature" cols="72">-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
+972-523-665918</pre>
  </div>

_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a></blockquote></div></div>