icecaps-summit / sleigh-dashboard

0 stars 0 forks source link

Panel into main #2

Closed DAndrewA closed 4 months ago

DAndrewA commented 4 months ago

Merge panel into the main branch. The main branch can be used on SANTA for the live served dashboard, and we can do seperate branches for each of the tabs.

This could be done by having files like:

cloud_tab.py

import panel as pn
import hvplot.xarray

data = load_data()

def options_widgets():
    x_widget = pn.widgets.Select(name='x', value=..., options=...)
    ...
    widgets = {
        'x':x_widget,
        ...
    }
    return widgets

def create_plot(**kwargs):
    ...
    return <hvplot object>

def cloud_tab():
    optional_widgets = options_widgets()
    bound_plot = pn.bind(create_plot, **options_widgets)
    tab_panel = pn.Column(*option_widgets.values(), bound_plot)
    return tab_panel

dashboard.py

import panel as pn
from . import cloud_tab
from . import mvp_tab
...
tabs = pn.Tabs(('MVP', mvp_tab.mvp_tab()))
tabs.append(('clouds', cloud_tab.cloud_tab()))
...
tabs.servable(title='ICECAPS SLEIGH-MVP Dashboard')

such that dashboard.py imports the other tab python files, which are the elements that can be editted individually on each branch. This will reduce merge conflicts in the future...