Skip to content

Commit

Permalink
More generalization
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Aug 17, 2024
1 parent c452276 commit 961ec6a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions xarray/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,9 +1049,7 @@ def quantile(
The American Statistician, 50(4), pp. 361-365, 1996
"""
if dim is None:
self._raise_if_not_single_group()
(grouper,) = self.groupers
dim = self.group1d.dims
dim = self._group_dim

# Dataset.quantile does this, do it for flox to ensure same output.
q = np.asarray(q, dtype=np.float64)
Expand Down Expand Up @@ -1267,9 +1265,7 @@ def _combine(self, applied, shortcut=False):
combined = self._concat_shortcut(applied, dim, positions)
else:
combined = concat(applied, dim)
self._raise_if_not_single_group()
(grouper,) = self.groupers
combined = _maybe_reorder(combined, dim, positions, N=grouper.group.size)
combined = _maybe_reorder(combined, dim, positions, N=self.group1d.size)

if isinstance(combined, type(self._obj)):
# only restore dimension order for arrays
Expand Down Expand Up @@ -1358,7 +1354,6 @@ class DatasetGroupByBase(GroupBy["Dataset"], DatasetGroupbyArithmetic):
@property
def dims(self) -> Frozen[Hashable, int]:
if self._dims is None:
self._raise_if_not_single_group()
index = self.encoded.group_indices[0]
self._dims = self._obj.isel({self._group_dim: index}).dims

Expand Down

0 comments on commit 961ec6a

Please sign in to comment.