Hello,
I’m trying to adapt this example to my own data. The example successfully creates a quadmesh indexed by time and S-coordinate. Replacing the data with my own results in a KeyError when calling quadmesh (reproducible example below).
I imagine this must have to do with my dataset or its metadata, but I’m scratching my head as to what.
import numpy as np
import xarray as xr
import hvplot.xarray
import holoviews as hv
import pandas as pd
# make some pseudodata
temp = 15 + 8 * np.random.randn(2, 2, 4, 3)
precip = 10 * np.random.rand(2, 2, 4, 3)
lon = [[-99.83, -99.32], [-99.79, -99.23]]
lat = [[42.25, 42.21], [42.63, 42.59]]
# for real use cases, its good practice to supply array attributes such as
# units, but we won't bother here for the sake of brevity
ds = xr.Dataset({'temperature': (['x', 'y', 'z', 'time'], temp),
'precipitation': (['x', 'y', 'z', 'time'], precip)},
coords={'lon': (['x', 'y'], lon),
'lat': (['x', 'y'], lat),
'z': np.arange(4),
'time': pd.date_range('2014-09-06', periods=3),
'reference_time': pd.Timestamp('2014-09-05')})
#this works (by removing variability along the z dimension)
ds['temperature'].sel(z=1).hvplot.quadmesh(x='lon', y='lat', groupby='time')
#this throws a KeyError
ds['temperature'].hvplot.quadmesh(x='lon', y='lat', groupby=['z', 'time'])