Skip to content

Commit

Permalink
Allowed using xarray with dask arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jun 4, 2017
1 parent 03b6edc commit 76e704d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions holoviews/core/data/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import numpy as np
import xarray as xr

try:
import dask
except ImportError:
dask = None

from .. import util
from ..dimension import Dimension
from ..ndmapping import NdMapping, item_check, sorted_context
Expand Down Expand Up @@ -156,6 +161,8 @@ def values(cls, dataset, dim, expanded=True, flat=True):
data = dataset.data[dim.name].data
if dim in dataset.vdims:
coord_dims = dataset.data[dim.name].dims
if dask and isinstance(data, dask.array.Array):
data = data.compute()
data = cls.canonicalize(dataset, data, coord_dims=coord_dims)
return data.T.flatten() if flat else data
elif expanded:
Expand Down

0 comments on commit 76e704d

Please sign in to comment.