I can see that the maximum values are different. Have a look at the
Range values.

What are you trying to do? Maybe there's a simpler approach...

On Sun, Jan 24, 2021 at 11:49 AM ming han <[email protected]> wrote:
>
> Hi Micha
>
>      Many thanks for your reply.
>      Here is the command I am using:
>
>      if(float(cat1_acc_riv) == float(cat1_minacc), str_r, null())
>
>       The str_r is a CELL raster. the result is different when I change it to:
>        if(int(cat1_acc_riv) == int(cat1_minacc), str_r, null())
>
>     Here is output of r.info for first DCELL raster
>
> +----------------------------------------------------------------------------+
>  | Map:      cat1_acc_riv@PERMANENT         Date: Sat Jan 23 22:58:42 2021    
> |
>  | Mapset:   PERMANENT                      Login of Creator: m43han          
> |
>  | Location: main_working_location                                            
> |
>  | DataBase: C:\Users\m43han\Documents\Routing_Prod\Prod000001\grassdb        
> |
>  | Title:    cat1_acc_riv                                                     
> |
>  | Timestamp: none                                                            
> |
>  
> |----------------------------------------------------------------------------|
>  |                                                                            
> |
>  |   Type of Map:  raster               Number of Categories: 19432056        
> |
>  |   Data Type:    DCELL                                                      
> |
>  |   Rows:         4239                                                       
> |
>  |   Columns:      9254                                                       
> |
>  |   Total Cells:  39227706                                                   
> |
>  |        Projection: Latitude-Longitude                                      
> |
>  |            N:  50:52:39N    S:  40:16:48N   Res: 0:00:09                   
> |
>  |            E:  70:10:39W    W:  93:18:45W   Res: 0:00:09                   
> |
>  |   Range of data:    min = 250752  max = 19432056                           
> |
>  |                                                                            
> |
>  |   Data Description:                                                        
> |
>  |    generated by r.mapcalc                                                  
> |
>  |                                                                            
> |
>  |   Comments:                                                                
> |
>  |    if(isnull(str_r), null(), acc)                                          
> |
>  |                                                                            
> |
>  
> +----------------------------------------------------------------------------+
> (Sun Jan 24 04:45:38 2021) Command finished (0 sec)
>
>
> Here is r.info output for second raster
>  
> +----------------------------------------------------------------------------+
>  | Map:      cat1_minacc@PERMANENT          Date: Sat Jan 23 22:58:48 2021    
> |
>  | Mapset:   PERMANENT                      Login of Creator: m43han          
> |
>  | Location: main_working_location                                            
> |
>  | DataBase: C:\Users\m43han\Documents\Routing_Prod\Prod000001\grassdb        
> |
>  | Title:    cat1_minacc                                                      
> |
>  | Timestamp: none                                                            
> |
>  
> |----------------------------------------------------------------------------|
>  |                                                                            
> |
>  |   Type of Map:  raster               Number of Categories: 0               
> |
>  |   Data Type:    FCELL                                                      
> |
>  |   Rows:         4239                                                       
> |
>  |   Columns:      9254                                                       
> |
>  |   Total Cells:  39227706                                                   
> |
>  |        Projection: Latitude-Longitude                                      
> |
>  |            N:  50:52:39N    S:  40:16:48N   Res: 0:00:09                   
> |
>  |            E:  70:10:39W    W:  93:18:45W   Res: 0:00:09                   
> |
>  |   Range of data:    min = 250752  max = 1.817303e+007                      
> |
>  |                                                                            
> |
>  |   Data Description:                                                        
> |
>  |    generated by r.stats.zonal                                              
> |
>  |                                                                            
> |
>  |   Comments:                                                                
> |
>  |    r.stats.zonal --overwrite base="str_r" cover="cat1_acc_riv" method="\   
> |
>  |    min" output="cat1_minacc"                                               
> |
>  |                                                                            
> |
>  
> +----------------------------------------------------------------------------+
> (Sun Jan 24 04:46:50 2021) Command finished (0 sec)
>
> Thanks
> Ming
>
>
> Micha Silver <[email protected]> 于2021年1月24日周日 上午3:29写道:
>>
>> Is there some reason that you expect the rasters to be the same? Maybe
>> begin by posting the outputs of `r.info` for both rasters, and what
>> command you used to compare them?
>>
>> On Sun, Jan 24, 2021 at 6:13 AM ming han <[email protected]> wrote:
>> >
>> > Hi Everyone
>> >
>> >     I tried to compare if grids in two rasters are the same, one raster is 
>> > FCELL and another raster is DCELL. I got different result  when I int both 
>> > raster first before comparing them; and when I float() both raster first 
>> > before I comparing them
>> >
>> > Is there any reason for this?
>> >
>> > Thanks
>> > Ming
>> > _______________________________________________
>> > grass-user mailing list
>> > [email protected]
>> > https://lists.osgeo.org/mailman/listinfo/grass-user
>>
>>
>>
>> --
>> Micha Silver
>> Ben Gurion Univ
>> Sde-Boker Remote Sensing Lab
>> cell: +972 (52) 3665918



-- 
Micha Silver
Ben Gurion Univ
Sde-Boker Remote Sensing Lab
cell: +972 (52) 3665918
_______________________________________________
grass-user mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to