Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quantiles to be compliant with 2.0.0 and accept list inputs #204

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions openeo_processes_dask/process_implementations/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,17 @@
"The process `quantiles` only allows that either the `probabilities` or the `q` parameter is set."
)

# Since processes 2.0.0 q was deprecated in favor of a combined probabilities parameter, cater for this
if isinstance(probabilities, int):
q = probabilities
probabilities = None

Check warning on line 286 in openeo_processes_dask/process_implementations/math.py

View check run for this annotation

Codecov / codecov/patch

openeo_processes_dask/process_implementations/math.py#L285-L286

Added lines #L285 - L286 were not covered by tests

if isinstance(probabilities, list):
probabilities = np.array(probabilities)

if isinstance(data, list):
data = np.array(data)

Check warning on line 292 in openeo_processes_dask/process_implementations/math.py

View check run for this annotation

Codecov / codecov/patch

openeo_processes_dask/process_implementations/math.py#L292

Added line #L292 was not covered by tests

if q is not None:
probabilities = np.arange(1.0 / q, 1, 1.0 / q)

Expand Down