Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature regression for hvplot.xarray since holoviews 1.14.7 #5214

Closed
michaelaye opened this issue Feb 18, 2022 · 3 comments
Closed

Feature regression for hvplot.xarray since holoviews 1.14.7 #5214

michaelaye opened this issue Feb 18, 2022 · 3 comments

Comments

@michaelaye
Copy link
Contributor

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)
Python 3.9
bokeh 2.4.2
xarray 0.21.1
hvplot 0.7.3
holoviews: 1.14.6 / 1.14.7

Description of expected behavior and the observed behavior

The issue is created by a new requirement of holoviews in 1.14.7 that clashes with the xarray hvplot extension.

xarrays can have NON-dimension coordinates that were previously ignored (correctly, IMHO) when defining what goes into the dynamic map generation for undefined kdims by hvplot.

Complete, minimal, self-contained example code that reproduces the issue

# code goes here between backticks
import xarray as xr
import hvplot.xarray
import holoviews as hv
hv.extension('bokeh', inline=False)

arr = xr.DataArray(
    np.random.random((2, 3, 4)), 
    dims=['x', 'y', 'time'],
    coords={'x': np.arange(2), 'y': np.arange(3), 'time': np.arange(4), 'x2': ('x', np.arange(2)*2)}
)
arr.hvplot(x='x', y='y')

With 1.14.6, hvplot creates, as expected a nice dynamic map, scanning the remaining unspecified time dimension with a widget:

image

With 1.14.7, I get this complaint from holoviews:

DataError: The coordinates on the 'value' DataArray do not match the provided key dimensions (kdims). The following coords were left unspecified: ['x2']. If you are requesting a lower dimensional view such as a histogram cast the xarray to a columnar format using the .to_dataframe or .to_dask_dataframe methods before providing it to HoloViews.

This change is a pretty big impact on how to work with xarray, I have dozens of codes that rely on the fact that only the dimension coordinates are being considered as kdims.
The whole data model of xarray builds around the idea of carrying other representation of coordinates (meters <-> lat/lon e.g.) with only one being the dimension coordinate at a given time, and demanding to do something with those before hvplot would work is a strong reduction in usefulness for hvplot, IMHO.

Screenshots or screencasts of the bug in action

image

@jbednar
Copy link
Member

jbednar commented Feb 18, 2022

Can you test with HoloViews 1.14.8?

@michaelaye
Copy link
Contributor Author

Ah, overtaken by reality. :) fixed by #5208

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants