panel icon indicating copy to clipboard operation
panel copied to clipboard

pn.widgets.DatetimePicker: Allow specification of enabled datetimes as iterables with datetime64

Open rsignell opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

In typical Pangeo workflows, we load simulation data into xarray and the time variable contains datetime64 objects.
Currently pn.widgets.DatetimePicker has only enabled_dates= and that only takes a list of datetime.date object or strings.

A clear and concise description of what you want to happen.

We would like an argument enabled_datetimes and it should be able to take iterables with datetime64 , so that this would work:

import hvplot.xarray  
import xarray as xr
import panel as pn

pn.extension

ds = xr.tutorial.open_dataset('air_temperature')
viz = ds['air'].hvplot(x='lon', y='lat')
pn.panel(viz, widgets={'time': pn.widgets.DatetimePicker(enabled_datetimes=ds.time[:5])})

rsignell avatar Jan 25 '24 20:01 rsignell