[GRASS-user] Re: Strange r.mapcalc results

Hermann Peifer peifer at gmx.eu
Thu Sep 24 02:35:12 EDT 2009


 > r.univar based comparison:

What if there was a small geometric shift between the 2 maps. Would I 
notice if both maps have enough NULLs around the edges?


 > r.mapcalc "diffmap = map1 - map2"

How would I separate NULL,NULL cases from cases where one map has a 
value, but the other has NULL?


And after thinking twice about my earlier posted test results, I still 
do not understand the logic of the isnull() results:

isnull(mapA) && isnull(mapT) gives NULL (Test1)
isnull(mapA) && isnull(mapT) gives 1    (Test3)

This doesn't make sense to me, which might be my fault, though.

Test1

$ r.mapcalc 'result = isnull(mapA) && isnull(mapT) || mapA == mapT ? 1 : 2'

$ r.stats -c result
1 799796
* 3200204

Test3

$ r.mapcalc 'result = isnull(mapA) && isnull(mapT) ? 1 : mapA == mapT ? 
2 : 3'

$ r.stats -c result
1 3200204
2 799796

Hermann



Hamish wrote:
> Hermann wrote:
>> I am trying to find out if 2 raster layers are exactly
>> identical.
> 
> I usually do
> 
> g.region rast=map1,map2
> 
> r.univar map1
> r.univar map2
> 
> and make sure the output is the same.
> 
> 
> another way is
> r.mapcalc "diffmap = map1 - map2"
> r.univar diffmap
> 
> 
> see also wish #618
>  https://trac.osgeo.org/grass/ticket/618
> 
> 
> Hamish
> 
> 
> 
>       
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 



More information about the grass-user mailing list