Skip to content

Commit

Permalink
Allow lower dimensional views on arbitrary dimensioned elements
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Feb 15, 2022
1 parent ed6686c commit a2fa45f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion holoviews/core/data/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,10 @@ def canonicalize(cls, dataset, data, data_coords=None, virtual_coords=[]):
dropped = [dims.index(d) for d in dims
if d not in dataset.kdims+virtual_coords]
if dropped:
data = np.squeeze(data, axis=tuple(dropped))
if len(dropped) == data.ndim:
data = data.flatten()
else:
data = np.squeeze(data, axis=tuple(dropped))

if not any(cls.irregular(dataset, d) for d in dataset.kdims):
inds = [dims.index(kd.name) for kd in dataset.kdims]
Expand Down
2 changes: 1 addition & 1 deletion holoviews/core/data/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def retrieve_unit_and_label(dim):
# Skip if all the dims on the coord are present on another coord
continue
undeclared.append(c)
if undeclared:
if undeclared and eltype.param.kdims.bounds[1] not in (0, None):
raise DataError(
'The coordinates on the %r DataArray do not match the '
'provided key dimensions (kdims). The following coords '
Expand Down

0 comments on commit a2fa45f

Please sign in to comment.