Open-EO / Open-EO/openeo-python-client
logic operator support in ProcessBuilder
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 217
- Forks
- 56
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
reported by @clausmichele :
I need to recreate this PG, basically doing equal twice and ten combining with OR:
...
I've tried ....reduce_dimension(dimension='bands',reducer=lambda x: x==2 or x==3)
but the result is not the same.
....
found the solution
....reduce_dimension(dimension="bands",reducer = lambda value: or_(eq(array_element(value,0),2),eq(array_element(value,0),3)))
my initial response:
the Python
oris not supported in this callback building feature. The==operator is supported
so this should work too:lambda x: or_(x==2, x==3)
In python it's not possible to overload the or and and "operators" ,
but it is possible to overload their bitwise variants | and & (as done in other libraries like numpy) if I'm not mistaken
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue concerns ProcessBuilder's callback-building feature; start by locating the ProcessBuilder entry point and tracing how the existing == expression is translated. Check whether the requested logical-operator behavior is defined for callbacks, then identify the relevant test area. Done means the supported operator behavior is specified and covered by tests, including the reported OR case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100