Skip to content

Commit 81319e2

Browse files
committed
minimize diff
1 parent 3e9479d commit 81319e2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

xarray/core/common.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -996,14 +996,10 @@ def _resample(
996996
if base is not None and offset is not None:
997997
raise ValueError("base and offset cannot be present at the same time")
998998

999-
index = self._indexes[dim_name].to_pandas_index()
1000999
if base is not None:
1000+
index = self._indexes[dim_name].to_pandas_index()
10011001
offset = _convert_base_to_offset(base, freq, index)
10021002

1003-
name = RESAMPLE_DIM
1004-
group = DataArray(
1005-
dim_coord, coords=dim_coord.coords, dims=dim_coord.dims, name=name
1006-
)
10071003
grouper = TimeResampleGrouper(
10081004
freq=freq,
10091005
closed=closed,
@@ -1012,6 +1008,11 @@ def _resample(
10121008
offset=offset,
10131009
loffset=loffset,
10141010
)
1011+
1012+
group = DataArray(
1013+
dim_coord, coords=dim_coord.coords, dims=dim_coord.dims, name=RESAMPLE_DIM
1014+
)
1015+
10151016
rgrouper = ResolvedTimeResampleGrouper(grouper, group, self)
10161017

10171018
return resample_cls(

0 commit comments

Comments
 (0)