Skip to content

Commit feed922

Browse files
authored
Actually copy dask arrays in Variable.copy() (#1180)
* Actually copy dask arrays in Variable.copy() Fixes GH1166 * Add documentation / whats new * Remove Python 3.3 from install page
1 parent 7ad2544 commit feed922

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

doc/installing.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Installation
66
Required dependencies
77
---------------------
88

9-
- Python 2.7, 3.3, 3.4 or 3.5
9+
- Python 2.7, 3.4 or 3.5
1010
- `numpy <http://www.numpy.org/>`__ (1.7 or later)
1111
- `pandas <http://pandas.pydata.org/>`__ (0.15.0 or later)
1212

@@ -36,7 +36,8 @@ For accelerating xarray
3636
For parallel computing
3737
~~~~~~~~~~~~~~~~~~~~~~
3838

39-
- `dask.array <http://dask.pydata.org>`__: required for :ref:`dask`.
39+
- `dask.array <http://dask.pydata.org>`__ (0.9.0 or later): required for
40+
:ref:`dask`.
4041

4142
For plotting
4243
~~~~~~~~~~~~

doc/whats-new.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Breaking changes
7070
- Coordinates used to index a dimension are now loaded eagerly into
7171
:py:class:`pandas.Index` objects, instead of loading the values lazily.
7272
By `Guido Imperiale <https://github.com/crusaderky>`_.
73-
- xarray no longer supports python 3.3
73+
- xarray no longer supports python 3.3 or versions of dask prior to v0.9.0.
7474

7575
Deprecations
7676
~~~~~~~~~~~~
@@ -223,6 +223,9 @@ Bug fixes
223223
- Fixed a bug with facetgrid (the ``norm`` keyword was ignored, :issue:`1159`).
224224
By `Fabien Maussion <https://github.com/fmaussion>`_.
225225

226+
- Fix to make ``.copy()`` actually copy dask arrays, which will be relevant for
227+
future releases of dask in which dask arrays will be mutable (:issue:`1180`).
228+
226229
.. _whats-new.0.8.2:
227230

228231
v0.8.2 (18 August 2016)

xarray/core/variable.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,12 @@ def copy(self, deep=True):
437437
# don't share caching between copies
438438
data = indexing.MemoryCachedArray(data.array)
439439

440-
if deep and not isinstance(
441-
data, (dask_array_type, PandasIndexAdapter)):
442-
# pandas.Index and dask.array objects are immutable
443-
data = np.array(data)
440+
if deep:
441+
if isinstance(data, dask_array_type):
442+
data = data.copy()
443+
elif not isinstance(data, PandasIndexAdapter):
444+
# pandas.Index is immutable
445+
data = np.array(data)
444446

445447
# note:
446448
# dims is already an immutable tuple

0 commit comments

Comments
 (0)