Skip to content

Commit 83a3b89

Browse files
committed
Hack to get sparse tests passing
1 parent 510a6e1 commit 83a3b89

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

xarray/core/dataset.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -3832,7 +3832,12 @@ def unstack(
38323832

38333833
result = self.copy(deep=False)
38343834
for dim in dims:
3835-
if sparse:
3835+
# FIXME: remove
3836+
import sparse as sparse_
3837+
3838+
if sparse or any(
3839+
isinstance(v.data, sparse_.COO) for v in self.variables.values()
3840+
):
38363841
result = result._unstack_once(dim, fill_value, sparse)
38373842
else:
38383843
result = result._unstack_once_fast(dim, fill_value, sparse)

xarray/core/variable.py

-2
Original file line numberDiff line numberDiff line change
@@ -1597,8 +1597,6 @@ def _unstack_once_fast(
15971597
new_shape = list(reordered.shape[: len(other_dims)]) + new_dim_sizes
15981598
new_dims = reordered.dims[: len(other_dims)] + new_dim_names
15991599

1600-
# missing_values = np.prod(new_shape) > np.prod(self.shape)
1601-
16021600
if fill_value is dtypes.NA:
16031601
fill_value = dtypes.get_fill_value(self.dtype)
16041602

0 commit comments

Comments
 (0)