Closed MarcSkovMadsen closed 2 years ago
This is properly https://github.com/holoviz/geoviews/issues/576 which is causing the issue.
Can you try to remove all the geo features from the plot to verify it?
I removed the geo
stuff (see code below) and I no longer see the warning.
I'm running geoviews=1.9.5
import collections
import gdown
import hvplot
import hvplot.xarray
import numpy as np
import panel as pn
import panel.widgets as pnw
import xarray as xr
import pathlib
collections.Callable = collections.abc.Callable
CONFIG = {
"2022070700_231_example.nc": "1vI5xH-kmA4OkoqJJz9keze-vN3cYCIf4",
"2022070700_237_example.nc": "1RnWmfiW3U7VYS4Qoqo7_uFdeAIXAajye",
}
for file, file_id in CONFIG.items():
if not pathlib.Path(file).exists():
gdown.download(id=file_id, output=file, quiet=False)
file_list = [pathlib.Path(file) for file in CONFIG]
def open_dataset(file):
key = f"file {file}"
if not key in pn.state.cache:
pn.state.cache[key]=xr.open_dataset(file)
return pn.state.cache[key]
def get_sub_dataset(file, field):
xds = open_dataset(file)
return xds[field]
def get_options(file, field):
options = {}
xds_sub = get_sub_dataset(file, field)
for (_, d) in enumerate(xds_sub.dims):
for (_, c) in enumerate(xds_sub.coords):
if d == c and (d != "lon" and d != "lat"):
if xds_sub.coords[c].dtype == np.dtype("<M8[ns]"):
time_list = []
for _, el in np.ndenumerate(
xds_sub.coords["time"].values
):
time_list.append(np.datetime_as_string(el, timezone="UTC"))
options[d] = time_list
else:
options[d] = xds_sub.coords[c].values.tolist()
return options
def get_widgets(file, field):
options=get_options(file, field)
print("options", file,field,options)
return {key: pnw.DiscreteSlider(options=value) for key, value in options.items()}
xds = open_dataset(file_list[0])
select_file = pnw.Select(name="File", options=file_list)
select_field = pnw.Select(name="Field", value="HU", options=list(xds.data_vars))
# I just want to see the options
def warm():
for file in file_list:
xds = open_dataset(file)
for field in xds.data_vars:
options = get_options(file, field)
print(file, field, options)
warm()
@pn.depends(select_file, select_field)
def load_file(file, field):
xds_sub = get_sub_dataset(file,field)
widgets = get_widgets(file, field)
return (
xds_sub
.interactive.sel(**widgets)
.hvplot(
kind="quadmesh",
rasterize=True,
data_aspect=1,
frame_height=800,
cmap="jet",
)
)
pn.Row(pn.Card(select_file, select_field), load_file).servable()
hvplot=0.8.0, holoviews=1.15.0
I'm trying to help a user here https://discourse.holoviz.org/t/interactive-and-dynamically-created-dict-of-widgets-to-xarray-sel/4000/5
When running the below code example I see the WARNING
So I believe something in hvPlot needs an update. But I don't know where.
Please note the log seems to output every message twice with a different format. That is a bit of friction that would be nice to remove.