Open-EO / openeo-processes-python

A Python representation of (most) openEO processes
Apache License 2.0
11 stars 4 forks source link

Implement bitwise operators #195

Open danielFlemstrom opened 2 years ago

danielFlemstrom commented 2 years ago

Working with packed bitmasks requires bitwise operators is not possible today.

EXAMPLE:

WATERFLAG = 2
water_mask = wqmask & WATERFLAG == WATERFLAG

and so on.....

There is a slight difference between python & and python and : Given A and B is true and is not boolean,

A and B => B
B and A => A

A & B == B & A 

Currently, python-client outputs logical and for & operator (which needs to be addressed in that repo). and is simply ignored.

I have made an implementation of bitwise_and, or and xor processes. I assume that if we always use bitwise operators, we should stay out of trouble famous last words....). I will post a PR later.