Skip to content

Commit

Permalink
Revert "Fix optimize for chunked DataArray (#4432)" (#4434)
Browse files Browse the repository at this point in the history
This reverts commit 9a8a62b.
  • Loading branch information
max-sixty authored Sep 18, 2020
1 parent 9a8a62b commit 902f1fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 0 additions & 2 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ Bug fixes
- Fix `KeyError` when doing linear interpolation to an nd `DataArray`
that contains NaNs (:pull:`4233`).
By `Jens Svensmark <https://github.com/jenssss>`_
- Fix ``dask.optimize`` on ``DataArray`` producing an invalid Dask task graph (:issue:`3698`)
- Fix incorrect legend labels for :py:meth:`Dataset.plot.scatter` (:issue:`4126`).
By `Peter Hausamann <https://github.com/phausamann>`_.
- Fix indexing with datetime64 scalars with pandas 1.1 (:issue:`4283`).
By `Stephan Hoyer <https://github.com/shoyer>`_ and
`Justus Magin <https://github.com/keewis>`_.


Documentation
~~~~~~~~~~~~~
Expand Down
3 changes: 3 additions & 0 deletions xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@ def __dask_postpersist__(self):

@staticmethod
def _dask_finalize(results, array_func, array_args, dims, attrs, encoding):
if isinstance(results, dict): # persist case
name = array_args[0]
results = {k: v for k, v in results.items() if k[0] == name}
data = array_func(results, *array_args)
return Variable(dims, data, attrs=attrs, encoding=encoding)

Expand Down
7 changes: 0 additions & 7 deletions xarray/tests/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -1607,10 +1607,3 @@ def test_more_transforms_pass_lazy_array_equiv(map_da, map_ds):
assert_equal(map_da._from_temp_dataset(map_da._to_temp_dataset()), map_da)
assert_equal(map_da.astype(map_da.dtype), map_da)
assert_equal(map_da.transpose("y", "x", transpose_coords=False).cxy, map_da.cxy)


def test_optimize():
a = dask.array.ones((10, 5), chunks=(1, 3))
arr = xr.DataArray(a).chunk(5)
(arr2,) = dask.optimize(arr)
arr2.compute()

0 comments on commit 902f1fc

Please sign in to comment.