Skip to content

Commit

Permalink
Fix quantiles to be compliant with 2.0.0 and accept list inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Dec 14, 2023
1 parent 8d9e3fb commit 44dd404
Showing 1 changed file with 8 additions and 0 deletions.
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 @@ def quantiles(
"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

0 comments on commit 44dd404

Please sign in to comment.