-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Is it intentional that creating a Dataset with a DataArray and dimension names for a single variable causes computation of that variable? In other words, why does xr.Dataset(dict(a=('d0', xr.DataArray(da.random.random(10)))))
cause the dask array to compute?
A longer example:
import dask.array as da
import xarray as xr
x = da.random.randint(1, 10, size=(100, 25))
ds = xr.Dataset(dict(a=xr.DataArray(x, dims=('x', 'y'))))
type(ds.a.data)
dask.array.core.Array
# Recreate the dataset with the same array, but also redefine the dimensions
ds2 = xr.Dataset(dict(a=(('x', 'y'), ds.a))
type(ds2.a.data)
numpy.ndarray