Closed rsignell-usgs closed 4 years ago
This fails:
import xarray as xr import hvplot.xarray url = 'http://tds.glos.us/thredds/dodsC/glos/glcfs/huron/fcfmrc-3d/Lake_Huron_-_3D_best.ncd' 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).
sigma
nsigma
sigma(nsigma)
If I simply rename the dimension nsigma to sigma, everything works as expected:
ds = ds.rename({'nsigma':'sigma'})
See https://nbviewer.jupyter.org/gist/rsignell-usgs/d5eee45716933297c978318e2a147fb6
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.
.set_index({'nsigma': 'sigma'})
This fails:
with a cryptic error:
By trial and error, I discovered that the vertical coordinate name is
sigma
, but the dimension name ofsigma
isnsigma
:sigma(nsigma)
.If I simply rename the dimension
nsigma
tosigma
, everything works as expected:See https://nbviewer.jupyter.org/gist/rsignell-usgs/d5eee45716933297c978318e2a147fb6