diff --git a/holoviews/core/data/grid.py b/holoviews/core/data/grid.py index 215ce1a128..029335f814 100644 --- a/holoviews/core/data/grid.py +++ b/holoviews/core/data/grid.py @@ -273,7 +273,7 @@ def ndloc(cls, dataset, indices): selected[kd.name] = coords all_scalar = False for d in dataset.dimensions(): - if d in dataset.kdims and cls.irregular(dataset, d): + if d in dataset.kdims and not cls.irregular(dataset, d): continue arr = dataset.dimension_values(d, flat=False) if all_scalar and len(dataset.vdims) == 1: diff --git a/holoviews/core/data/iris.py b/holoviews/core/data/iris.py index caebdb26b4..96bd1fd10d 100644 --- a/holoviews/core/data/iris.py +++ b/holoviews/core/data/iris.py @@ -132,6 +132,12 @@ def validate(cls, dataset, vdims=True): raise DataError("Iris cubes do not support more than one value dimension", cls) + @classmethod + def irregular(cls, dataset, dim): + "CubeInterface does not support irregular data" + return False + + @classmethod def shape(cls, dataset, gridded=False): if gridded: diff --git a/holoviews/core/data/xarray.py b/holoviews/core/data/xarray.py index 2b55da53ba..a0ba3afece 100644 --- a/holoviews/core/data/xarray.py +++ b/holoviews/core/data/xarray.py @@ -191,7 +191,7 @@ def coords(cls, dataset, dim, ordered=False, expanded=False, edges=False): def values(cls, dataset, dim, expanded=True, flat=True): dim = dataset.get_dimension(dim, strict=True) data = dataset.data[dim.name].data - irregular = cls.irregular(dataset, dim) + irregular = cls.irregular(dataset, dim) if dim in dataset.kdims else False if dim in dataset.vdims or irregular: coord_dims = list(dataset.data[dim.name].dims) if dask and isinstance(data, dask.array.Array): @@ -226,18 +226,18 @@ def unpack_scalar(cls, dataset, data): @classmethod def ndloc(cls, dataset, indices): - kdims = [d.name for d in dataset.kdims[::-1]] + kdims = [d for d in dataset.kdims[::-1]] adjusted_indices = [] slice_dims = [] for kd, ind in zip(kdims, indices): - if dataset.data[kd].ndim > 1: + if cls.irregular(dataset, kd): coords = [c for c in dataset.data.coords if c not in dataset.data.dims] - dim = dataset.data[kd].dims[coords.index(kd)] - shape = dataset.data[kd].shape[coords.index(kd)] + dim = dataset.data[kd.name].dims[coords.index(kd.name)] + shape = dataset.data[kd.name].shape[coords.index(kd.name)] coords = np.arange(shape) else: coords = cls.coords(dataset, kd, False) - dim = kd + dim = kd.name slice_dims.append(dim) ncoords = len(coords) if np.all(coords[1:] < coords[:-1]):