Skip to content
This repository was archived by the owner on Mar 6, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
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
5 changes: 1 addition & 4 deletions src/openeo_processes/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -3323,10 +3323,7 @@ def exec_xar(x, min, max):
The value clipped to the specified range.
"""

clip = x.where(x > min, min)
clip = clip.where(x < max, max)

return clip
return x.clip(min = min, max = max)

@staticmethod
def exec_da():
Expand Down
3 changes: 3 additions & 0 deletions tests/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ def test_clip(self):
xr.testing.assert_equal(
oeop.clip(self.test_data.xr_data_factor(1, 9), min=1, max=8),
self.test_data.xr_data_factor(1, 8))
xr.testing.assert_equal(
oeop.clip(self.test_data.xr_data_factor(np.nan, 9), min=1, max=8),
self.test_data.xr_data_factor(np.nan, 8))

def test_quantiles(self):
""" Tests `quantiles` function. """
Expand Down