Skip to content

Commit

Permalink
Hack to get sparse tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
max-sixty committed Dec 31, 2020
1 parent 510a6e1 commit 83a3b89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 6 additions & 1 deletion xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3832,7 +3832,12 @@ def unstack(

result = self.copy(deep=False)
for dim in dims:
if sparse:
# FIXME: remove
import sparse as sparse_

if sparse or any(
isinstance(v.data, sparse_.COO) for v in self.variables.values()
):
result = result._unstack_once(dim, fill_value, sparse)
else:
result = result._unstack_once_fast(dim, fill_value, sparse)
Expand Down
2 changes: 0 additions & 2 deletions xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1597,8 +1597,6 @@ def _unstack_once_fast(
new_shape = list(reordered.shape[: len(other_dims)]) + new_dim_sizes
new_dims = reordered.dims[: len(other_dims)] + new_dim_names

# missing_values = np.prod(new_shape) > np.prod(self.shape)

if fill_value is dtypes.NA:
fill_value = dtypes.get_fill_value(self.dtype)

Expand Down

0 comments on commit 83a3b89

Please sign in to comment.