diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index d748201b026..aef28caf15b 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -6694,11 +6694,13 @@ def interp_calendar( """ return interp_calendar(self, target, dim=dim) + @_deprecate_positional_args("v2024.07.0") def groupby( self, group: ( Hashable | DataArray | IndexVariable | Mapping[Any, Grouper] | None ) = None, + *, squeeze: bool | None = None, restore_coord_dims: bool = False, **groupers: Grouper, @@ -6815,6 +6817,7 @@ def groupby( restore_coord_dims=restore_coord_dims, ) + @_deprecate_positional_args("v2024.07.0") def groupby_bins( self, group: Hashable | DataArray | IndexVariable, @@ -7239,9 +7242,11 @@ def coarsen( coord_func=coord_func, ) + @_deprecate_positional_args("v2024.07.0") def resample( self, indexer: Mapping[Hashable, str | Resampler] | None = None, + *, skipna: bool | None = None, closed: SideOptions | None = None, label: SideOptions | None = None, diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index f3ebee83468..3d3a051c070 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -10268,11 +10268,13 @@ def interp_calendar( """ return interp_calendar(self, target, dim=dim) + @_deprecate_positional_args("v2024.07.0") def groupby( self, group: ( Hashable | DataArray | IndexVariable | Mapping[Any, Grouper] | None ) = None, + *, squeeze: bool | None = None, restore_coord_dims: bool = False, **groupers: Grouper, @@ -10356,6 +10358,7 @@ def groupby( restore_coord_dims=restore_coord_dims, ) + @_deprecate_positional_args("v2024.07.0") def groupby_bins( self, group: Hashable | DataArray | IndexVariable, @@ -10625,9 +10628,11 @@ def coarsen( coord_func=coord_func, ) + @_deprecate_positional_args("v2024.07.0") def resample( self, indexer: Mapping[Any, str | Resampler] | None = None, + *, skipna: bool | None = None, closed: SideOptions | None = None, label: SideOptions | None = None, diff --git a/xarray/tests/test_groupby.py b/xarray/tests/test_groupby.py index c44848e24d6..2f169079ca0 100644 --- a/xarray/tests/test_groupby.py +++ b/xarray/tests/test_groupby.py @@ -721,7 +721,7 @@ def test_groupby_reduce_dimension_error(array) -> None: def test_groupby_multiple_string_args(array) -> None: with pytest.raises(TypeError): - array.groupby("x", "y") + array.groupby("x", squeeze="y") def test_groupby_bins_timeseries() -> None: