Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Jul 18, 2024
1 parent a3686b9 commit a7d0f0a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
3 changes: 0 additions & 3 deletions xarray/core/groupers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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:
Expand Down
19 changes: 0 additions & 19 deletions xarray/tests/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a7d0f0a

Please sign in to comment.