From a7d0f0ad8ddf5cee2ebab98798cadd86d29be0ee Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Thu, 18 Jul 2024 09:51:45 +0530 Subject: [PATCH] cleanups --- xarray/core/groupers.py | 3 --- xarray/tests/test_groupby.py | 19 ------------------- 2 files changed, 22 deletions(-) diff --git a/xarray/core/groupers.py b/xarray/core/groupers.py index 354623023f8..c1de4a6e029 100644 --- a/xarray/core/groupers.py +++ b/xarray/core/groupers.py @@ -360,7 +360,6 @@ def _get_index_and_items(self) -> tuple[pd.Index, pd.Series, np.ndarray]: def first_items(self) -> tuple[pd.Series, np.ndarray]: from xarray.coding.cftimeindex import CFTimeIndex - from xarray.core.resample_cftime import CFTimeGrouper if isinstance(self.group_as_index, CFTimeIndex): return self.index_grouper.first_items( @@ -375,8 +374,6 @@ def first_items(self) -> tuple[pd.Series, np.ndarray]: # So for _flox_reduce we avoid one reindex and copy by avoiding # _maybe_restore_empty_groups codes = np.repeat(np.arange(len(first_items)), counts) - if self.loffset is not None: - _apply_loffset(self.loffset, first_items) return first_items, codes def factorize(self, group: T_Group) -> EncodedGroups: diff --git a/xarray/tests/test_groupby.py b/xarray/tests/test_groupby.py index 460d7d795eb..c44848e24d6 100644 --- a/xarray/tests/test_groupby.py +++ b/xarray/tests/test_groupby.py @@ -2351,25 +2351,6 @@ def test_resample_drop_nondim_coords(self) -> None: actual = ds.resample(time="1h").interpolate("linear") assert "tc" not in actual.coords - def test_resample_old_api(self) -> None: - times = pd.date_range("2000-01-01", freq="6h", periods=10) - ds = Dataset( - { - "foo": (["time", "x", "y"], np.random.randn(10, 5, 3)), - "bar": ("time", np.random.randn(10), {"meta": "data"}), - "time": times, - } - ) - - with pytest.raises(TypeError, match=r"resample\(\) no longer supports"): - ds.resample("1D", "time") # type: ignore[arg-type] - - with pytest.raises(TypeError, match=r"resample\(\) no longer supports"): - ds.resample("1D", dim="time", how="mean") # type: ignore[arg-type] - - with pytest.raises(TypeError, match=r"resample\(\) no longer supports"): - ds.resample("1D", dim="time") # type: ignore[arg-type] - def test_resample_ds_da_are_the_same(self) -> None: time = pd.date_range("2000-01-01", freq="6h", periods=365 * 4) ds = xr.Dataset(