<div dir="ltr"><div>It succeed with no error. I add a little syntax :</div><div><br></div><div>r.mapcalc --overwrite expression=awan = if( "rgb.1@PERMANENT" > 1810.877778 && "rgb.1@PERMANENT" < 23442.122222 && "rgb.3@PERMANENT" > 673.148594 && "rgb.3@PERMANENT" < 22729.389558 , 0, if("rgb.1@PERMANENT" == 0, 255, 100))</div><div><br></div><div>Thank you<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 1, 2021 at 9:32 PM Micha Silver <<a href="mailto:tsvibar@gmail.com">tsvibar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="direction:ltr">
<p><br>
</p>
<div>On 1/1/21 3:25 PM, mega saputra wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hello guys,</div>
<div><br>
</div>
<div>I try to create conditional statement. When I running the
formula in GRASS, there is error. Can someone help me to
convert in GRASS formula format. The formula is something like
:</div>
<div><br>
</div>
<div>if ( rgb.1 > 1810.877778) and ( rgb.1 < 23442.122222
) and (rgb.2 > 673.148594) and (rgb.2 < 22729.389558)
then 0 else if rgb.1 = 0 then 255 else 100</div>
<div><br>
</div>
<div>I have try, but with error. My false formula :</div>
r.mapcalc --overwrite expression=awan = if ( rgb.1 >
1810.877778 & rgb.1 < 23442.122222 & rgb.2 >
673.148594 & rgb.2 < 22729.389558 , 0) else if ( rgb.1
= 0, 255, 100)<br>
</div>
</blockquote>
<p><br>
</p>
<p>There is no "else" in mapcalc. You put the else expression after
the second comma.<br>
</p>
<p>Should be:</p>
<p>r.mapcalc --o "awan = if(rgb.1 > 1810.877778 &&
rgb.1 < 23442.122222 && rgb.2 > 673.148594 &
rgb.2 < 22729.389558 , 0, if(rgb.1 = 0, 255, 100))</p>
<p><br>
</p>
<blockquote type="cite">
<div dir="ltr">syntax error, unexpected NAME, expecting $end<br>
Parse error<br>
<div>ERROR: parse error</div>
<div><br>
</div>
<div>Any suggestion?</div>
<div><br>
</div>
<div>Regards,</div>
<div>mega<br>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
grass-user mailing list
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a>
</pre>
</blockquote>
<pre cols="72">--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
</div>
</blockquote></div>