[GRASS-user] map algebra logical operators on DCELL rasters not admitted? maybe docs should outline it

G. Allegri giohappy at gmail.com
Mon Oct 19 12:49:39 PDT 2015


That's what disappointed my client (and me) Glynn: why integer yes and not
floats? Is it a technical limitation or there's a ratio behind it?
Anyway did I miss something from the docs? I couldn't find it.

Why do you that I'm confusing the operators? I've always talked about
logical operators...

giovanni

Il 19/ott/2015 21:19, "Glynn Clements" <glynn at gclements.plus.com> ha
scritto:
>
>
> 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).
>
> > This doesn't seem to be described inside the docs, is it?
> >
> > When the if() function is described it only states its behaviour in
case of
> > NULL, 0 or "otherwise" values.
>
> This isn't about the if() function. The bitand() function (to which
> the error message refers) corresponds to the bitwise-and operator "&".
>
> The if() function accepts either integer or floating-point values for
> its arguments.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20151019/7f668da8/attachment.html>


More information about the grass-user mailing list