Description
Code Sample, a copy-pastable example if possible
import xarray as xr
import numpy as np
import dask.array as da
import iris
# xarray (dask) -> iris (dask) -> xarray (numpy)
darr = xr.DataArray(
da.from_array(np.random.rand(4, 5), chunks=4), dims=['x', 'y'],
coords=dict(x=[10, 20, 30, 40], y=range(5)))
print(type(darr.data)) # <class 'dask.array.core.Array'>
cube = darr.to_iris()
print(type(cube.core_data())) # <class 'dask.array.core.Array'>
darr2 = xr.DataArray.from_iris(cube)
print(type(darr2.data)) # <class 'numpy.ndarray'>
Problem description
After converting an iris Cube into an xarray DataArray the core array object is no longer lazy.
The dask array is not immediately realised - the .from_iris() call completes instantly and plotting slices works as expected. I only noticed the issue when I tried to convert a large dataset back into a Cube, at which point everything ground to a halt.
(The ability to convert between libraries is very cool - thanks for developing this)
Expected Output
Array type to stay the same, data not to be computed if not needed.
Output of xr.show_versions()
xarray: 0.10.2
pandas: 0.21.0
numpy: 1.13.3
scipy: 1.0.0
netCDF4: 1.3.1
h5netcdf: 0.5.0
h5py: 2.7.1
Nio: None
zarr: None
bottleneck: 1.2.1
cyordereddict: None
dask: 0.17.1
distributed: 1.21.3
matplotlib: 2.1.0
cartopy: 0.15.1
seaborn: 0.8.1
setuptools: 36.5.0.post20170921
pip: 9.0.1
conda: 4.4.6
pytest: None
IPython: 6.2.1
sphinx: None