On 20/10/15 09:44, Moritz Lennert wrote:
On 19/10/15 21:16, Glynn Clements wrote:

G. Allegri wrote:

Doing a logical operation with a DCELL raster within an if(x,a) statement
produces an error: "Incorrect argument types to function bitand()".

First, you're confusing bitwise operators and logical operators. & and
| are bitwise operators, while && and || (and &&& and |||) are logical
operators.

Second, both bitwise and logical operators only work on integer
values. If you want to use floating-point values as boolean values,
you need to explicitly convert them to integers (either via int(x) or
round(x), or x==0.0, or abs(x)<1e-30, or whatever).

???

On my grass71 and grass64release, these work (using NC demo data set):

r.mapcalc "test = if(elevation == 100.0, 1)"
r.mapcalc "test = if(elevation > 100.0, 1)"

where elevation is FCELL.

Sorry, forget that. I missed the "logical" part...

Moritz

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to