<div dir="ltr"><div>Hi Yann,<br><br></div>great to hear that you had at least some success. Hopefully the following info will help you narrow down the issue.<br><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 18, 2018 at 2:45 PM, Yann Chemin <span dir="ltr"><<a href="mailto:dr.yann.chemin@gmail.com" target="_blank">dr.yann.chemin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I conducted a GRASS GIS course this week and we found some bugs on WinGRASS:<br>
<br>
r.mapcalc expression=if(case1,if(case2,<wbr>Val2True,Val2False),Val1False)<wbr>)<br></blockquote><div><br><br></div><div>The example lacks the name of the map. Is this intentional? See suggestions in the manual page, maybe it will explain some details (note the differences to G6):<br><br><a href="https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#program-use">https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#program-use</a><br><a href="https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#usage-from-command-line">https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#usage-from-command-line</a><br><a href="https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#backwards-compatibility">https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#backwards-compatibility</a><br></div><div><br></div><div>I don't know why the nested if statement/function would make any difference. What else you have tried?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
This expression will fail, note that the lack of quote is intentional, as it is a requirement to run simpler r.mapcalc statements in WinGRASS.<br></blockquote><div><br><br></div><div>I think quotes are basically required since spaces around equal sign are basically required. See the above links. Perhaps more explanation is needed in the manual. It explicitly talks about single quotes and unix, but not about Win or why (or why not double quotes). The things about equal sign and spaces were added by me to clarify the differences between G6 and G7 syntax, but I did not focus on the Win vs unix differences there.<br></div><div><br></div><div>When in doubts on Win, there is always the GUI Map Calculator which accepts the right-hand side of the expression.<br><br></div><div>On bug which is in GUI, which may or may not be reported, is that the history eats quotes from the command, so reusing the commands needs additional care.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Also, we found that the use of || and && within a simple conditional statement also did not process anything and failed.<br></blockquote><br><br></div><div class="gmail_quote">We had issues in the past in our courses with running r.mapcalc commands on Win because of these, but recently, we had no issues and we settled on the following syntax (examples from class):<br></div><br>r.mapcalc "elev_combined = if(y() < 224274. && x() > 637455., elevation, elev_srtm_30m)"<br><br>r.mapcalc "low_elev_developed = if((elevation < 100 && elevation > 60) && (landuse96_28m == 1 || landuse96_28m == 2),1,null())"<br><br>r.mapcalc "urban1_30m = if(landuse96_28m == 1,1,0) + if(landuse96_28m == 2,2,0)"<br><br></div><div class="gmail_extra">Best,<br></div><div class="gmail_extra">Vashek<br></div></div></div></div>