<html style="direction: ltr;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style id="bidiui-paragraph-margins" type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body bidimailui-charset-is-forced="true" style="direction: ltr;">
<p><br>
</p>
<div class="moz-cite-prefix">On 1/1/21 3:25 PM, mega saputra wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAPCs1vfvYLvgP-WZBa5-on7QQ7AKsDgW-DW2j1duXir7HFX2UA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<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"
cite="mid:CAPCs1vfvYLvgP-WZBa5-on7QQ7AKsDgW-DW2j1duXir7HFX2UA@mail.gmail.com">
<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 class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/grass-user">https://lists.osgeo.org/mailman/listinfo/grass-user</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
</body>
</html>