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

G. Allegri giohappy at gmail.com
Wed Oct 21 23:47:48 PDT 2015


Ah ok Glynn, I always meant logical operators. Probably I copied the error
from a different test.

If logical operator is applied to, sat, Byte data it gives true/false
results, e.g. if(A && B,1, 0) behaves correctly even with cell values
values greater then 1.
That's why I expected it to work with floats operands too.
>From a user perspective if it works for a cell with value 2 it should also
work for a cell with value 2.0.
That'all.

giovanni
Il 22/ott/2015 02:44, "Glynn Clements" <glynn at gclements.plus.com> ha
scritto:

>
> G. Allegri wrote:
>
> > > 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.
> >
> > 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.
>
> What would you expect the value of (x & y) to be if x and/or y were
> floating-point values?
>
> > Why do you that I'm confusing the operators? I've always talked about
> > logical operators...
>
> Because you quote an error message which specifically refers to a
> *bitwise* operator:
>
> > "Incorrect argument types to function bitand()".
>
> in a message which otherwise only mentions logical operators.
>
> "bitand()" is the name of the bitwise-and function, which corresponds to
> the infix "&" operator. I.e. (x & y) is exactly equivalent to bitand(x, y).
>
> This is the same as the "&" operator in C or C++: it evaluates to an
> integer where each bit in the result is set (one) if the corresponding
> bit is set in both operands, and unset (zero) otherwise. E.g. (23 & 34)
> is
>           00010111 (23)
>         & 00100010 (34)
>           --------
>         = 00000010 ( 2)
>
> Perhaps it would help if you posted the exact expression which is
> causing you problems.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20151022/bc91fc2e/attachment.html>


More information about the grass-user mailing list