Re: [GRASS-dev] Issue with double conditional in r.mapcalc (WinGRASS) and real life test of the aconda 7.5dev on Mac

2018-02-20 Thread Vaclav Petras
On Tue, Feb 20, 2018 at 6:16 AM, Yann Chemin 
wrote:

>
> We tried to use the command prompt to enter the scripts, but it made
> trouble so we tried on the wxGUI Console, and we found it worked mostly,
> until we started entering more complex if statements. But that was after we
> had to remove quotes to enter the r.mapcalc script successfully anyway.
>


If I may, here is what I think happened (based on our continuous experience
and Helmut having hard time reproducing it). You had troubles, you removed
quotes, perhaps also fixed the issue without knowing it. All was fine. Then
started to use expressions with && and || which were failing without
quotes. More complicated expressions like those with nested ifs were
failing too. Those were failing perhaps because there was forgotten space
here and there which can happen because they are long/complex and the
console in GUI is not in monospaced font* so spaces are quite narrow and
can blur with the surrounding characters.

* Which is probably a bug.

I'm sorry for the monospace and quotes bugs which were certainly not
helping you, but my current assessment is that these are only the two bugs
involved here. But of course we want r.mapcalc to be rock solid, so please
test & report more if you think it's needed.


>
> Would that be related to the issues with internationalisation (
> https://trac.osgeo.org/grass/ticket/3500)?
>

Anything is possible and our continuous successful use is with English
locale, but my guess is that that's not the case.

Vaclav
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Issue with double conditional in r.mapcalc (WinGRASS) and real life test of the aconda 7.5dev on Mac

2018-02-20 Thread Vaclav Petras
On Tue, Feb 20, 2018 at 7:44 AM, Helmut Kudrnovsky  wrote:

> >*wxGUI console:
> >r.mapcalc expression=s_sl = if( rbstreams500@yann == 1, if(
> slope@PERMANENT
> ><= 5,  2, 5 ), 0 )
> >(Tue Feb 20 13:30:06 2018) Command finished (0 sec)
>
> I put quoted r.mapcalc term into the wxGUI; but it seems the quotes are
> stripped in the wxGUI output window. mmm
>

Right, I probably was not clear on what I said earlier. This is a known
bug, but maybe unreported.

Reusing commands needs additional care, but execution happens with quotes.
I think it's the history mechanism in GUI which is messing it up.
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Issue with double conditional in r.mapcalc (WinGRASS) and real life test of the aconda 7.5dev on Mac

2018-02-20 Thread Helmut Kudrnovsky
>*wxGUI console:
>r.mapcalc expression=s_sl = if( rbstreams500@yann == 1, if( slope@PERMANENT
><= 5,  2, 5 ), 0 )
>(Tue Feb 20 13:30:06 2018) Command finished (0 sec) 

I put quoted r.mapcalc term into the wxGUI; but it seems the quotes are
stripped in the wxGUI output window. mmm



-
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Issue with double conditional in r.mapcalc (WinGRASS) and real life test of the aconda 7.5dev on Mac

2018-02-20 Thread Helmut Kudrnovsky
>We had a mix of installations on Windows:
>1 - QGIS standalone with GRASS7.2.2. (GRASS could also be run standalone it
seems)
>2 - WinGRASS 7.4.0. mostly direct install, but maybe some from OSGEO4W too.
>3 - WinGRASS7.5svn nightly

there shouldn't be much difference in behaviour

>We tried to use the command prompt to enter the scripts, but it made
trouble so we tried on the wxGUI >Console, and we found it worked mostly,
until we started entering more complex if statements. But that >was after we
had to remove quotes to enter the r.mapcalc script successfully anyway.

tested here now with

GRASS version: 7.4.0
GRASS SVN revision: r72154  
Build date: 2018-01-27  
Build platform: x86_64-w64-mingw32 

and GRASS 7.5.svn dailys

r.mapcalc expression="s_sl = if( rbstreams500@yann == 1, if( slope@PERMANENT
<= 5,  2, 5 ), 0 )"

*winGRASS windows console
C:\>r.mapcalc expression="s_sl = if( rbstreams500@yann == 1, if(
slope@PERMANENT <= 5,  2, 5 ), 0 )"
 100%
 
*wxGUI console:
r.mapcalc expression=s_sl = if( rbstreams500@yann == 1, if( slope@PERMANENT
<= 5,  2, 5 ), 0 )
(Tue Feb 20 13:30:06 2018) Command finished (0 sec) 

both in winGRASS windows console and wxGUI console, the r.mapcalc with
double conditional works here.







-
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Issue with double conditional in r.mapcalc (WinGRASS) and real life test of the aconda 7.5dev on Mac

2018-02-20 Thread Yann Chemin
We had a mix of installations on Windows:
1 - QGIS standalone with GRASS7.2.2. (GRASS could also be run standalone it 
seems)
2 - WinGRASS 7.4.0. mostly direct install, but maybe some from OSGEO4W too.
3 - WinGRASS7.5svn nightly

Windows machines were many times not up to date, we even had some Windows7, but 
mostly Windows 8 and W10.

We tried to use the command prompt to enter the scripts, but it made trouble so 
we tried on the wxGUI Console, and we found it worked mostly, until we started 
entering more complex if statements. But that was after we had to remove quotes 
to enter the r.mapcalc script successfully anyway.

Would that be related to the issues with internationalisation 
(https://trac.osgeo.org/grass/ticket/3500 
)?

> On 18 Feb 2018, at 23:32, Helmut Kudrnovsky  wrote:
> 
>> I conducted a GRASS GIS course this week and we found some bugs on WinGRASS: 
> 
> the subject of this report is _(WinGRASS)_ and _aconda 7.5dev on Mac_ 
> 
> which winGRASS version have you used? 7.4.0? 7.5dev? another version?
> 
> 
> 
> -
> best regards
> Helmut
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html
> ___
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Issue with double conditional in r.mapcalc (WinGRASS) and real life test of the aconda 7.5dev on Mac

2018-02-18 Thread Vaclav Petras
Hi Yann,

great to hear that you had at least some success. Hopefully the following
info will help you narrow down the issue.

On Sun, Feb 18, 2018 at 2:45 PM, Yann Chemin 
wrote:

> I conducted a GRASS GIS course this week and we found some bugs on
> WinGRASS:
>
> r.mapcalc expression=if(case1,if(case2,Val2True,Val2False),Val1False))
>


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):

https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#program-use
https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#usage-from-command-line
https://grass.osgeo.org/grass74/manuals/r.mapcalc.html#backwards-compatibility

I don't know why the nested if statement/function would make any
difference. What else you have tried?


>
> 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.
>


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.

When in doubts on Win, there is always the GUI Map Calculator which accepts
the right-hand side of the expression.

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.


>
> Also, we found that the use of || and && within a simple conditional
> statement also did not process anything and failed.
>


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):

r.mapcalc "elev_combined = if(y() < 224274. && x() > 637455., elevation,
elev_srtm_30m)"

r.mapcalc "low_elev_developed = if((elevation < 100 && elevation > 60) &&
(landuse96_28m == 1 || landuse96_28m == 2),1,null())"

r.mapcalc "urban1_30m = if(landuse96_28m == 1,1,0) + if(landuse96_28m ==
2,2,0)"

Best,
Vashek
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Issue with double conditional in r.mapcalc (WinGRASS) and real life test of the aconda 7.5dev on Mac

2018-02-18 Thread Helmut Kudrnovsky
>I conducted a GRASS GIS course this week and we found some bugs on WinGRASS: 

the subject of this report is _(WinGRASS)_ and _aconda 7.5dev on Mac_ 

which winGRASS version have you used? 7.4.0? 7.5dev? another version?



-
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Issue with double conditional in r.mapcalc (WinGRASS) and real life test of the aconda 7.5dev on Mac

2018-02-18 Thread Helmut Kudrnovsky
>We used the tutorial in grass=promo/tuorials/grassstarter, the script at the
end essentially, running on >Spearfish dataset. 

hopefully found the right cmds (easier would be posting directly the
commands here).

workflow here in winGRASS7.4.0:

r.buffer input=streams@PERMANENT output=bstreams500 distances=500
r.null map=bstreams500@yann null=0
r.buffer input=roads@PERMANENT output=broads500 distances=500
r.null map=broads500@yann null=0

r.mapcalc expression="rbstreams500 = if( bstreams500@yann == 2, 1, 0)"

r.info map=slope@PERMANENT 
[...]
|   Range of data:min = 0  max = 52.52016

r.mapcalc expression="s_sl = if( rbstreams500@yann == 1, if( slope <= 5, 2,
5), 0)"

>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. 

r.info map=s_sl@yann

++
 | Map:  s_sl@yann  Date: Sun Feb 18 23:14:50 2018   
|
 | Mapset:   yann   Login of Creator: hkmyr  
|
 | Location: spearfish_grass70data_0 
|
 | DataBase: D:\grassdata
|
 | Title:s_sl
|
 | Timestamp: none   
|

||
 |   
|
 |   Type of Map:  raster   Number of Categories: 0  
|
 |   Data Type:CELL  
|
 |   Rows: 466   
|
 |   Columns:  633   
|
 |   Total Cells:  294978
|
 |Projection: UTM (zone 13)  
|
 |N:4928000S:4914020   Res:30
|
 |E: 609000W: 590010   Res:30
|
 |   Range of data:min = 0  max = 5  
|
 |   
|
 |   Data Description:   
|
 |generated by r.mapcalc 
|
 |   
|
 |   Comments:   
|
 |if(rbstreams500@yann == 1, if(slope <= 5, 2, 5), 0)
|
 |   
|

++

 r.stats -c -n input=s_sl@yann  
 
0 109746
2 41812
5 140733

what should be the expected result of your calculations? are these different
to my calculations in winGRASS7.4.0.

a well described workflow and expected results would be helpfull for testing
if winGRASS 7.4.0 really fails here?





-
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Issue with double conditional in r.mapcalc (WinGRASS) and real life test of the aconda 7.5dev on Mac

2018-02-18 Thread Helmut Kudrnovsky
>r.mapcalc expression=if(case1,if(case2,Val2True,Val2False),Val1False))
>
>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. 

when, in winGRASS, I copy from r.mapcalc:

r.mapcalc expression="rbstreams500 = if( bstreams500@yann == 2, 1, 0)"

the term is quoted.

when I do in the wxGUI console

r.mapcalc expression=rbstreams500unquoted = if( bstreams500@yann == 2, 1, 0)

I get an "unable to parse..." error.

how do you conclude that "it is a requirement to run simpler r.mapcalc
statements in winGRASS"?





-
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] Issue with double conditional in r.mapcalc (WinGRASS) and real life test of the aconda 7.5dev on Mac

2018-02-18 Thread Yann Chemin
I conducted a GRASS GIS course this week and we found some bugs on WinGRASS:

r.mapcalc expression=if(case1,if(case2,Val2True,Val2False),Val1False))

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.

Also, we found that the use of || and && within a simple conditional statement 
also did not process anything and failed.

We had 25% Mac overall (group of 110 students), we installed the new aconda 
7.5dev and all the above processing worked perfectly. We also had an Ubuntu 
machine (not mine) with Artful default grass install (7.4?) which performed as 
well as the Mac, nothing much to say except from the render.py bug in d.rast 
inside a d.mon (submit ticket last week 
https://trac.osgeo.org/grass/ticket/3497).

We used the tutorial in grass=promo/tuorials/grassstarter, the script at the 
end essentially, running on Spearfish dataset.

Yann
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev