Skip to content

Commit

Permalink
Clip correctly in linear_scale_range when inputMax < inputMin
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Dec 14, 2023
1 parent 8d9e3fb commit 43d6c50
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openeo_processes_dask/process_implementations/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,10 @@ def arctan2(y, x):


def linear_scale_range(x, inputMin, inputMax, outputMin=0.0, outputMax=1.0):
x = clip(x, inputMin, inputMax)
if inputMax < inputMin:
x = clip(x, inputMax, inputMin)

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

View check run for this annotation

Codecov / codecov/patch

openeo_processes_dask/process_implementations/math.py#L231-L232

Added lines #L231 - L232 were not covered by tests
else:
x = clip(x, inputMin, inputMax)

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

View check run for this annotation

Codecov / codecov/patch

openeo_processes_dask/process_implementations/math.py#L234

Added line #L234 was not covered by tests
lsr = ((x - inputMin) / (inputMax - inputMin)) * (outputMax - outputMin) + outputMin
return lsr

Expand Down

0 comments on commit 43d6c50

Please sign in to comment.