diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 899175af45f..18c8bc379b8 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -21,8 +21,13 @@ v0.10.1 (unreleased) Enhancements ~~~~~~~~~~~~ -- :py:func:`~plot.contourf()` learned to contour 2D variables that have both a 1D co-ordinate (e.g. time) and a 2D co-ordinate (e.g. depth as a function of time). +- :py:func:`~plot.contourf()` learned to contour 2D variables that have both a + 1D co-ordinate (e.g. time) and a 2D co-ordinate (e.g. depth as a function of + time) (:issue:`1737`). By `Deepak Cherian `_. +- Use ``pandas.Grouper`` class in xarray resample methods rather than the + deprecated ``pandas.TimeGrouper`` class (:issue:`1766`). + By `Joe Hamman `_. Bug fixes diff --git a/xarray/core/common.py b/xarray/core/common.py index 298630121ec..3bfcd484474 100644 --- a/xarray/core/common.py +++ b/xarray/core/common.py @@ -590,10 +590,9 @@ def resample(self, freq=None, dim=None, how=None, skipna=None, raise TypeError("Dimension name should be a string; " "was passed %r" % dim) group = DataArray(dim, [(dim.dims, dim)], name=RESAMPLE_DIM) - time_grouper = pd.TimeGrouper(freq=freq, closed=closed, - label=label, base=base) + grouper = pd.Grouper(freq=freq, closed=closed, label=label, base=base) resampler = self._resample_cls(self, group=group, dim=dim_name, - grouper=time_grouper, + grouper=grouper, resample_dim=RESAMPLE_DIM) return resampler @@ -615,9 +614,9 @@ def _resample_immediately(self, freq, dim, how, skipna, if isinstance(dim, basestring): dim = self[dim] group = DataArray(dim, [(dim.dims, dim)], name=RESAMPLE_DIM) - time_grouper = pd.TimeGrouper(freq=freq, how=how, closed=closed, - label=label, base=base) - gb = self._groupby_cls(self, group, grouper=time_grouper) + grouper = pd.Grouper(freq=freq, how=how, closed=closed, label=label, + base=base) + gb = self._groupby_cls(self, group, grouper=grouper) if isinstance(how, basestring): f = getattr(gb, how) if how in ['first', 'last']: