From 0666878d26e9717d8c3ce2158a37c855608735c7 Mon Sep 17 00:00:00 2001 From: SarahAlidoost Date: Fri, 12 Apr 2024 13:18:13 +0200 Subject: [PATCH] remove util function for checking unique values --- stmtools/utils.py | 19 ------------------- tests/test_util.py | 19 ------------------- 2 files changed, 38 deletions(-) diff --git a/stmtools/utils.py b/stmtools/utils.py index 186cb6a..58d30e8 100644 --- a/stmtools/utils.py +++ b/stmtools/utils.py @@ -97,22 +97,3 @@ def monotonic_coords(ds, dim: str): ds[dim].to_index().is_monotonic_increasing or ds[dim].to_index().is_monotonic_decreasing ) - - -def unique_coords(ds, dim: str ): - """Check if the dataset has unique coordinates in the given dimension. - - Parameters - ---------- - ds : xarray.Dataset - Dataset to check. - dim : str - Dimension to check. - - Returns - ------- - bool - True if the dataset has unique coordinates, False otherwise. - - """ - return bool(ds[dim].to_index().is_unique) \ No newline at end of file diff --git a/tests/test_util.py b/tests/test_util.py index b76f82b..1464252 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -157,22 +157,3 @@ def test_non_monotonic_coords_time(self, stmat): stmat["time"].values[0] = '2022-01-02T00:00:00.000000000' stmat["time"].values[1] = '2022-01-01T00:00:00.000000000' assert not utils.monotonic_coords(stmat, "time") - - -class TestUniqueCoords: - def test_unique_coords(self, stmat): - assert utils.unique_coords(stmat, "lon") - assert utils.unique_coords(stmat, "lat") - assert utils.unique_coords(stmat, "time") - - def test_non_unique_coords_lon(self, stmat): - stmat["lon"][0] = 1 - assert not utils.unique_coords(stmat, "lon") - - def test_non_unique_coords_lat(self, stmat): - stmat["lat"][0] = 1 - assert not utils.unique_coords(stmat, "lat") - - def test_non_unique_coords_time(self, stmat): - stmat["time"].values[0] = '2021-01-03T00:00:00.000000000' - assert not utils.unique_coords(stmat, "time")