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

hvplot expects xarray coordinate variable and dimension name to be the same? #329

rsignell-usgs opened this issue Oct 9, 2019 · 1 comment · Fixed by #450


Copy link

rsignell-usgs commented Oct 9, 2019

This fails:

import xarray as xr
import hvplot.xarray

url = ''
ds  = xr.open_dataset(url)
ds.temp.hvplot.quadmesh(x='lon', y='lat', rasterize=True)

with a cryptic error:

ValueError: can only convert an array of size 1 to a Python scalar

By trial and error, I discovered that the vertical coordinate name is sigma, but the dimension name of sigma is nsigma: sigma(nsigma).

If I simply rename the dimension nsigma to sigma, everything works as expected:

ds = ds.rename({'nsigma':'sigma'})


Copy link

I think the correct way to handle this is to set sigma as an index: .set_index({'nsigma': 'sigma'}). I'll see if we can automate that though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

2 participants