Skip to content

Commit

Permalink
test of monotony (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
callumrollo authored Oct 31, 2024
1 parent b68aad2 commit c172163
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions glidertest/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,10 @@ def check_monotony(da):
"""
if not pd.Series(da).is_monotonic_increasing:
print(f'{da.name} is not always monotonically increasing')
return False
else:
print(f'{da.name} is always monotonically increasing')
return True


def plot_profIncrease(ds: xr.DataArray, ax: plt.Axes = None, **kw: dict, ) -> tuple({plt.Figure, plt.Axes}):
Expand Down
8 changes: 8 additions & 0 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ def test_profile_check():
ds = fetchers.load_sample_dataset()
tools.check_monotony(ds.PROFILE_NUMBER)
tools.plot_profIncrease(ds)

def test_check_monotony():
ds = fetchers.load_sample_dataset()
profile_number_monotony = tools.check_monotony(ds.PROFILE_NUMBER)
temperature_monotony = tools.check_monotony(ds.TEMP)
assert profile_number_monotony
assert not temperature_monotony

0 comments on commit c172163

Please sign in to comment.