[GRASS-user] Strange r.mapcalc results

Hermann Peifer peifer at gmx.eu
Wed Sep 23 12:17:42 EDT 2009


Hi,

I am trying to find out if 2 raster layers are exactly identical. I am 
not an experienced mapcalc user, so I am wondering, where the 3200204 
NULL values come from, in Test1. The result in Test2 is what I expected.

My obviously wrong understanding was that I wouldn't need the special 
operator ||| in Test1, as NULL values are already treated specially by 
isnull()

Any hint from the experts?

Hermann


Test1

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

$ r.stats -c result
1 799796
* 3200204

Test2

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

$ r.stats -c result
1 4000000

Test3

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

$ r.stats -c result
1 3200204
2 799796



More information about the grass-user mailing list