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

Helmut Kudrnovsky hellik at web.de
Sun Feb 18 14:27:37 PST 2018


>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 at PERMANENT output=bstreams500 distances=500
r.null map=bstreams500 at yann null=0
r.buffer input=roads at PERMANENT output=broads500 distances=500
r.null map=broads500 at yann null=0

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

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

r.mapcalc expression="s_sl = if( rbstreams500 at 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 at yann                                                            

+----------------------------------------------------------------------------+
 | Map:      s_sl at 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:    4928000    S:    4914020   Res:    30                    
|
 |            E:     609000    W:     590010   Res:    30                    
|
 |   Range of data:    min = 0  max = 5                                      
|
 |                                                                           
|
 |   Data Description:                                                       
|
 |    generated by r.mapcalc                                                 
|
 |                                                                           
|
 |   Comments:                                                               
|
 |    if(rbstreams500 at yann == 1, if(slope <= 5, 2, 5), 0)                    
|
 |                                                                           
|

+----------------------------------------------------------------------------+

 r.stats -c -n input=s_sl at 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


More information about the grass-dev mailing list