(self, chunks: T_Chunks)
| 764 | return self._shuffle_obj(chunks) |
| 765 | |
| 766 | def _shuffle_obj(self, chunks: T_Chunks) -> T_Xarray: |
| 767 | from xarray.core.dataarray import DataArray |
| 768 | |
| 769 | was_array = isinstance(self._obj, DataArray) |
| 770 | as_dataset = self._obj._to_temp_dataset() if was_array else self._obj |
| 771 | |
| 772 | for grouper in self.groupers: |
| 773 | if grouper.name not in as_dataset._variables: |
| 774 | as_dataset.coords[grouper.name] = grouper.group |
| 775 | |
| 776 | shuffled = as_dataset._shuffle( |
| 777 | dim=self._group_dim, indices=self.encoded.group_indices, chunks=chunks |
| 778 | ) |
| 779 | unstacked: Dataset = self._maybe_unstack(shuffled) |
| 780 | if was_array: |
| 781 | return self._obj._from_temp_dataset(unstacked) |
| 782 | else: |
| 783 | return unstacked # type: ignore[return-value] |
| 784 | |
| 785 | def map( |
| 786 | self, |
no test coverage detected