forked from ec-jrc/Thalassa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
58 lines (46 loc) · 1.37 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from __future__ import annotations
import logging.config
import holoviews as hv
import panel as pn
from holoviews import opts as hvopts
from ruamel.yaml import YAML
import thalassa
# load configuration
yaml = YAML(typ="safe", pure=True)
with open("config.yml", "rb") as fd:
config = yaml.load(fd.read())
# configure logging
logging.config.dictConfig(config["logging"])
# load bokeh
hv.extension("bokeh")
pn.extension(sizing_mode="scale_width")
# Set some defaults for the visualization of the graphs
hvopts.defaults(
hvopts.Image( # pylint: disable=no-member
# Don't set both height and width, or the UI will not be responsive!
# width=800,
height=500,
responsive=True,
show_title=True,
tools=["hover"],
active_tools=["pan", "wheel_zoom"],
align="end",
),
hvopts.Layout(toolbar="right"), # pylint: disable=no-member
)
ui = thalassa.ThalassaUI(
display_variables=True,
display_stations=True,
)
# https://panel.holoviz.org/reference/templates/Bootstrap.html
bootstrap = pn.template.BootstrapTemplate(
site="example.com",
title="Thalassa",
logo="thalassa/static/logo.png",
favicon="thalassa/static/favicon.png",
sidebar=[ui.sidebar],
sidebar_width=350, # in pixels! must be an integer!
# main_max_width="850px", # must be a string!
main=[ui.main],
)
bootstrap.servable()