Cannot swap between geoviews outputs are panel update

Hi,

I had some code that was working fine before the latest panel update. Swapping between variables when clicking the ‘load map button’ now just makes the geoviews box to display point data completely disappear and I am not sure why. It seems to work fine when data does not have a time dimension that can be scrubbed through, but when that extra dimension is added, this glitch occurs.

from datetime import datetime
import pandas as pd
import geoviews as gv
import panel as pn
from geoviews import opts
import numpy as np

gv.extension('bokeh', 'matplotlib')

dropdown1 = pn.widgets.Select(name='Real Time Data', options=['Precipitation Type','2m Temperature',])
load_map_button = pn.widgets.Button(name='Readload Map', button_type='primary')

# Sample data for demonstration
df2 = pd.DataFrame({
    'Lon': [-74.0060, -118.2437, -87.6298,-74.0060, -118.2437, -87.6298],
    'Lat': [40.7128, 34.0522, 41.8781,40.7128, 34.0522, 41.8781],
    'Time': ['2023-05-30 20:00:00+00:00', '2023-05-30 21:00:00+00:00', '2023-05-30 22:00:00+00:00','2023-05-30 20:00:00+00:00', '2023-05-30 21:00:00+00:00', '2023-05-30 22:00:00+00:00'],
    'Precipitation Label': ['Rain', 'Snow', 'Rain', np.nan, np.nan, np.nan],
    'Temperature (F)': [np.nan,np.nan,np.nan, 65.5, 50.2, 68.9],
    'Label': ['Precipitation Type' ,'Precipitation Type' ,'Precipitation Type' ,'2m Temperature','2m Temperature','2m Temperature']
})
df2['Temperature (F)'] = df2['Temperature (F)'].astype(float)

@pn.depends(load_map_button.param.clicks)
def update_map(event):

    kdims=['Lon','Lat','Time']
    if dropdown1.value == 'Precipitation Type':
        vdims = ['Precipitation Label']
    if dropdown1.value == '2m Temperature':
        vdims = ['Temperature (F)']

    df_sel = df2.loc[df2["Label"] == dropdown1.value]

    ds = gv.Dataset(df_sel, kdims=kdims)
    plot = (ds.to(gv.Points, ["Lon", "Lat"], vdims=vdims))

    return  pn.panel(plot.opts(size=25))

menu = pn.Column(dropdown1, load_map_button)
load_map_button.param.watch(update_map, "clicks")
row = pn.Row(menu, update_map)
row

I think this will be fixed by 1.0.4. Do you get any errors in the console or command line?

Nope, no errors at all from what I can see. Any idea when 1.0.4 should come out?

Tomorrow :slight_smile:

I am actually running into an error code in my jupyter notebook, but not with the MRE that I provided. It is
AttributeError: 'str' object has no attribute 'param'

Not sure if that’s helpful or not.

Try updating to panel 1.0.4.