16
16
from xarray .core .utils import (
17
17
Frozen ,
18
18
either_dict_or_kwargs ,
19
- emit_user_level_warning ,
20
19
is_scalar ,
21
20
)
22
21
from xarray .namedarray .core import _raise_if_any_duplicate_dimensions
@@ -1050,8 +1049,7 @@ def _resample(
1050
1049
# TODO support non-string indexer after removing the old API.
1051
1050
1052
1051
from xarray .core .dataarray import DataArray
1053
- from xarray .core .groupby import ResolvedTimeResampleGrouper , TimeResampleGrouper
1054
- from xarray .core .pdcompat import _convert_base_to_offset
1052
+ from xarray .core .groupby import ResolvedGrouper , TimeResampler
1055
1053
from xarray .core .resample import RESAMPLE_DIM
1056
1054
1057
1055
# note: the second argument (now 'skipna') use to be 'dim'
@@ -1074,44 +1072,24 @@ def _resample(
1074
1072
dim_name : Hashable = dim
1075
1073
dim_coord = self [dim ]
1076
1074
1077
- if loffset is not None :
1078
- emit_user_level_warning (
1079
- "Following pandas, the `loffset` parameter to resample is deprecated. "
1080
- "Switch to updating the resampled dataset time coordinate using "
1081
- "time offset arithmetic. For example:\n "
1082
- " >>> offset = pd.tseries.frequencies.to_offset(freq) / 2\n "
1083
- ' >>> resampled_ds["time"] = resampled_ds.get_index("time") + offset' ,
1084
- FutureWarning ,
1085
- )
1086
-
1087
- if base is not None :
1088
- emit_user_level_warning (
1089
- "Following pandas, the `base` parameter to resample will be deprecated in "
1090
- "a future version of xarray. Switch to using `origin` or `offset` instead." ,
1091
- FutureWarning ,
1092
- )
1093
-
1094
- if base is not None and offset is not None :
1095
- raise ValueError ("base and offset cannot be present at the same time" )
1096
-
1097
- if base is not None :
1098
- index = self ._indexes [dim_name ].to_pandas_index ()
1099
- offset = _convert_base_to_offset (base , freq , index )
1075
+ group = DataArray (
1076
+ dim_coord ,
1077
+ coords = dim_coord .coords ,
1078
+ dims = dim_coord .dims ,
1079
+ name = RESAMPLE_DIM ,
1080
+ )
1100
1081
1101
- grouper = TimeResampleGrouper (
1082
+ grouper = TimeResampler (
1102
1083
freq = freq ,
1103
1084
closed = closed ,
1104
1085
label = label ,
1105
1086
origin = origin ,
1106
1087
offset = offset ,
1107
1088
loffset = loffset ,
1089
+ base = base ,
1108
1090
)
1109
1091
1110
- group = DataArray (
1111
- dim_coord , coords = dim_coord .coords , dims = dim_coord .dims , name = RESAMPLE_DIM
1112
- )
1113
-
1114
- rgrouper = ResolvedTimeResampleGrouper (grouper , group , self )
1092
+ rgrouper = ResolvedGrouper (grouper , group , self )
1115
1093
1116
1094
return resample_cls (
1117
1095
self ,
0 commit comments