diff --git a/assets/geojsons/DREAM8-MACC b/assets/geojsons/DREAM8-MACC new file mode 120000 index 0000000000000000000000000000000000000000..0270aa9b815cff91f9da94dd441aba07233261e1 --- /dev/null +++ b/assets/geojsons/DREAM8-MACC @@ -0,0 +1 @@ +/data/products/DREAM8-MACC \ No newline at end of file diff --git a/assets/geojsons/ECMWF b/assets/geojsons/ECMWF new file mode 120000 index 0000000000000000000000000000000000000000..e7d6adc49d78eaf669680cbef7ef99eaa7ee9d9c --- /dev/null +++ b/assets/geojsons/ECMWF @@ -0,0 +1 @@ +/data/products/ECMWF \ No newline at end of file diff --git a/assets/geojsons/EMA-RegCM4 b/assets/geojsons/EMA-RegCM4 new file mode 120000 index 0000000000000000000000000000000000000000..14692ea7e0b5790b6e0571ec6949a321a1eea7b8 --- /dev/null +++ b/assets/geojsons/EMA-RegCM4 @@ -0,0 +1 @@ +/data/products/EMA-RegCM4 \ No newline at end of file diff --git a/assets/geojsons/ICON-ART b/assets/geojsons/ICON-ART new file mode 120000 index 0000000000000000000000000000000000000000..2496b18b924e1fcf68388ca9394ccccde20464e0 --- /dev/null +++ b/assets/geojsons/ICON-ART @@ -0,0 +1 @@ +/data/products/ICON-ART \ No newline at end of file diff --git a/assets/geojsons/LOTOS-EUROS b/assets/geojsons/LOTOS-EUROS new file mode 120000 index 0000000000000000000000000000000000000000..b3cc3b5e8bd7f1f16239755e5bc0a68771cabf69 --- /dev/null +++ b/assets/geojsons/LOTOS-EUROS @@ -0,0 +1 @@ +/data/products/LOTOS-EUROS \ No newline at end of file diff --git a/assets/geojsons/MOCAGE b/assets/geojsons/MOCAGE new file mode 120000 index 0000000000000000000000000000000000000000..37ccee12d9351f5222ef27ad8c3c3294f1ba82e6 --- /dev/null +++ b/assets/geojsons/MOCAGE @@ -0,0 +1 @@ +/data/products/MOCAGE \ No newline at end of file diff --git a/assets/geojsons/NASA-GEOS b/assets/geojsons/NASA-GEOS new file mode 120000 index 0000000000000000000000000000000000000000..71869a08feda851691009f88daf604d8e0ba14f2 --- /dev/null +++ b/assets/geojsons/NASA-GEOS @@ -0,0 +1 @@ +/data/products/NASA-GEOS \ No newline at end of file diff --git a/assets/geojsons/NCEP-NGAC b/assets/geojsons/NCEP-NGAC new file mode 120000 index 0000000000000000000000000000000000000000..e787063bdf0aac6aeec5b641a2cb6e5e74f78030 --- /dev/null +++ b/assets/geojsons/NCEP-NGAC @@ -0,0 +1 @@ +/data/products/NCEP-NGAC \ No newline at end of file diff --git a/assets/geojsons/NMMB-BSC b/assets/geojsons/NMMB-BSC new file mode 120000 index 0000000000000000000000000000000000000000..6d340c3496d08f13b31d7ad8c2b2159fc165dcb5 --- /dev/null +++ b/assets/geojsons/NMMB-BSC @@ -0,0 +1 @@ +/data/products/NMMB-BSC \ No newline at end of file diff --git a/assets/geojsons/NMME-DREAM b/assets/geojsons/NMME-DREAM new file mode 120000 index 0000000000000000000000000000000000000000..05c4af535f41a95543ffae94732ce5f310eaab5b --- /dev/null +++ b/assets/geojsons/NMME-DREAM @@ -0,0 +1 @@ +/data/products/NMME-DREAM \ No newline at end of file diff --git a/assets/geojsons/SILAM b/assets/geojsons/SILAM new file mode 120000 index 0000000000000000000000000000000000000000..87258ed61f1a7da54f38045464a8f338066d2631 --- /dev/null +++ b/assets/geojsons/SILAM @@ -0,0 +1 @@ +/data/products/SILAM \ No newline at end of file diff --git a/assets/geojsons/ZAMG-WRF-CHEM b/assets/geojsons/ZAMG-WRF-CHEM new file mode 120000 index 0000000000000000000000000000000000000000..c9aa903760b26e169f6e51351ee11c57bb2e3101 --- /dev/null +++ b/assets/geojsons/ZAMG-WRF-CHEM @@ -0,0 +1 @@ +/data/products/ZAMG-WRF-CHEM \ No newline at end of file diff --git a/assets/geojsons/median b/assets/geojsons/median new file mode 120000 index 0000000000000000000000000000000000000000..05d44874b3b85ebca881452c7be3f74f68ed6052 --- /dev/null +++ b/assets/geojsons/median @@ -0,0 +1 @@ +/data/products/median \ No newline at end of file diff --git a/assets/geojsons/modis b/assets/geojsons/modis new file mode 120000 index 0000000000000000000000000000000000000000..f869740f6079dc83639c805e5d17ca55dab0219d --- /dev/null +++ b/assets/geojsons/modis @@ -0,0 +1 @@ +/data/daily_dashboard/obs/modis \ No newline at end of file diff --git a/assets/geojsons/msg-metoffice b/assets/geojsons/msg-metoffice new file mode 120000 index 0000000000000000000000000000000000000000..603e5e815de32164d93eacfa1c097aef0bf877b1 --- /dev/null +++ b/assets/geojsons/msg-metoffice @@ -0,0 +1 @@ +/data/products/msg-metoffice \ No newline at end of file diff --git a/assets/geojsons/prob b/assets/geojsons/prob new file mode 120000 index 0000000000000000000000000000000000000000..fd58a3eadcf0cf12caf30be487bb7b4e6cf3d59b --- /dev/null +++ b/assets/geojsons/prob @@ -0,0 +1 @@ +/data/daily_dashboard/prob \ No newline at end of file diff --git a/assets/images/AOD.png b/assets/images/AOD.png deleted file mode 100644 index 7ffc932a8fb281e63f9f09e7a22847c3b469a870..0000000000000000000000000000000000000000 Binary files a/assets/images/AOD.png and /dev/null differ diff --git a/assets/images/DryDeposition.png b/assets/images/DryDeposition.png deleted file mode 100644 index 20907e8ab54061e34066349cf9252695f268bddf..0000000000000000000000000000000000000000 Binary files a/assets/images/DryDeposition.png and /dev/null differ diff --git a/assets/images/DustLoad.png b/assets/images/DustLoad.png deleted file mode 100644 index a997e2460c4e46d8b67aa69b7c7e627d506e6193..0000000000000000000000000000000000000000 Binary files a/assets/images/DustLoad.png and /dev/null differ diff --git a/assets/images/Prob.png b/assets/images/Prob.png deleted file mode 100644 index 0a77a755802cca209766cdc3329db36b6466af5a..0000000000000000000000000000000000000000 Binary files a/assets/images/Prob.png and /dev/null differ diff --git a/assets/images/SurfaceConcentration.png b/assets/images/SurfaceConcentration.png deleted file mode 100644 index 56b6957e2ab09a3efde4c59a007c34e1a7a9182e..0000000000000000000000000000000000000000 Binary files a/assets/images/SurfaceConcentration.png and /dev/null differ diff --git a/assets/images/SurfaceExtintion.png b/assets/images/SurfaceExtintion.png deleted file mode 100644 index 3ed2c828e22470970508a438fe13e2fadc46be24..0000000000000000000000000000000000000000 Binary files a/assets/images/SurfaceExtintion.png and /dev/null differ diff --git a/assets/images/WetDeposition.png b/assets/images/WetDeposition.png deleted file mode 100644 index 20907e8ab54061e34066349cf9252695f268bddf..0000000000000000000000000000000000000000 Binary files a/assets/images/WetDeposition.png and /dev/null differ diff --git a/assets/sidebar.css b/assets/sidebar.css index 4a68d2e538c45295b0a7674b1758f85dda90b370..2c3c66396abc540e726e34819860ef6e0caadc5a 100644 --- a/assets/sidebar.css +++ b/assets/sidebar.css @@ -84,7 +84,6 @@ .sidebar-first-item .Select-menu-outer { background-color: #F1B545 !important; overflow: hidden; - height: 22rem !important; } .sidebar-dropdown { @@ -201,7 +200,7 @@ /* Info button on the sidebar bottom */ .sidebar-bottom #info-button { - background-image: url("/daily_dashboard/assets/images/Icon_Info.png"); + background-image: url("assets/images/Icon_Info.png"); background-position: center; width: 52px !important; height: 52px !important; @@ -209,7 +208,7 @@ /* Download button on the sidebar bottom */ .sidebar-bottom #download-button { - background-image: url("/daily_dashboard/assets/images/Icon_Download.png"); + background-image: url("assets/images/Icon_Download.png"); background-position: 1rem; background-color: #2B383E; padding-left: 2rem; @@ -246,23 +245,25 @@ span>#was-apply { width: fit-content; } +/* .sidebar-bottom #info-button { - background-image: url("/daily_dashboard/assets/images/Icon_Info.png"); + background-image: url("assets/images/Icon_Info.png"); background-position: center; width: 2.8vw; } .sidebar-bottom #download-button { - background-image: url("/daily_dashboard/assets/images/Icon_Download.png"); + background-image: url("assets/images/Icon_Download.png"); background-position: 1rem; background-color: #2B383E; padding-left: 2rem; width: -webkit-fill-available; width: -moz-available; } +*/ .sidebar-bottom .card-text>.download-section { - background-image: url("/daily_dashboard/assets/images/download.svg"); + background-image: url("assets/images/download.svg"); background-repeat: no-repeat; background-position: 0.5rem; background-color: lightgrey; diff --git a/conf/dates.json b/conf/dates.json index 8fb17c452774d49d07d8155c3173cfc70c477eb4..a1a3b832c5be99717f2fd663d01a0d053d244771 120000 --- a/conf/dates.json +++ b/conf/dates.json @@ -1 +1 @@ -dates_prod.json \ No newline at end of file +dates_dev.json \ No newline at end of file diff --git a/dash_server.py b/dash_server.py index 6bc839afea2348161a6730e7dd6f4550a11048f9..2a3467b7551026dddb2609a515a26880848ae9c5 100755 --- a/dash_server.py +++ b/dash_server.py @@ -35,12 +35,17 @@ from tabs.observations import tab_observations from tabs.observations import sidebar_observations from tabs.observations_callbacks import register_callbacks as obs_callbacks +import uuid import socket -# HOSTNAME = socket.gethostbyname_ex(socket.gethostname())[0] +HOSTNAME = socket.gethostbyname_ex(socket.gethostname())[0] -TIMEOUT = 10 +if HOSTNAME in ('bscesdust03.bsc.es', 'pre-sds-was'): + pathname = '/daily_dashboard/' +else: + pathname = '/dashboard/' +TIMEOUT = 10 fontawesome = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css' # fontawesome = 'https://use.fontawesome.com/releases/v5.15.4/css/all.css' @@ -52,24 +57,16 @@ app = dash.Dash(__name__, dbc.themes.GRID, fontawesome ], - url_base_pathname='/daily_dashboard/', + url_base_pathname=pathname, server=srv, prevent_initial_callbacks=True ) app.css.config.serve_locally = True app.scripts.config.serve_locally = True -app.config.update({ - # as the proxy server will remove the prefix - #'routes_pathname_prefix': '/', - - # the front-end will prefix this string to the requests - # that are made to the proxy server - #'requests_pathname_prefix': '/daily_dashboard/' -}) app.config.suppress_callback_exceptions = True server = app.server -cache_dir = "/dev/shm" +cache_dir = "/dev/shm/{}".format(str(uuid.uuid1())) Path(cache_dir).mkdir(parents=True, exist_ok=True) cache_config = { @@ -186,4 +183,4 @@ obs_callbacks(app, cache=cache, cache_timeout=cache_timeout) if __name__ == '__main__': app.run_server(debug=True, # use_reloader=False, # processes=4, threaded=False, - host='0.0.0.0', port=7778) + host='0.0.0.0', port=7777) diff --git a/data_handler.py b/data_handler.py index 4cb58ab8eb99ba1b33ff73d5e679e0c558d3419f..2141807871535176e4f4294d979a351707be83d7 100644 --- a/data_handler.py +++ b/data_handler.py @@ -1099,6 +1099,7 @@ class ScoresFigureHandler(object): self.sites = None self.size = 7 + network_name = OBS[network]['name'] filedir = OBS[network]['path'] filename = "{}_{}.h5".format(selection, statistic) tab_name = "{}_{}".format(statistic, selection) @@ -1108,8 +1109,8 @@ class ScoresFigureHandler(object): months = ' - '.join([datetime.strptime(sel, '%Y%m').strftime("%B %Y") for sel in selection.split('-')]) - self.title = """{model} {score}
{selection}""".format( - score=STATS[statistic], model='{model}', selection=months) + self.title = """{model} - {network_name} {score}
{selection}""".format( + score=STATS[statistic], network_name=network_name, model='{model}', selection=months) self.xlon = np.array([-25, 60]) self.ylat = np.array([0, 65]) self.stat = statistic diff --git a/tabs/evaluation_callbacks.py b/tabs/evaluation_callbacks.py index 22f2c57881aec6532954a42bd6cc5fad8d4211f9..01e1709b14f7d4035604c8040629e4e1696495f1 100644 --- a/tabs/evaluation_callbacks.py +++ b/tabs/evaluation_callbacks.py @@ -174,15 +174,19 @@ def register_callbacks(app, cache, cache_timeout): @app.callback( [Output('scores-map-modalbody', 'figure'), - Output('scores-map-modal', 'is_open')], + Output('scores-map-modal', 'is_open'), + Output('obs-models-dropdown-modal', 'value'), + Output('obs-statistics-dropdown-modal', 'value')], [Input('scores-map-apply', 'n_clicks'), Input('obs-models-dropdown-modal', 'value'), Input('obs-statistics-dropdown-modal', 'value'),], [State('obs-network-dropdown', 'value'), - State('obs-selection-dropdown', 'value')], + State('obs-selection-dropdown', 'value'), + State('obs-models-dropdown', 'value'), + State('obs-statistics-dropdown', 'value')], ) @cache.memoize(timeout=cache_timeout) - def scores_maps_retrieve(n_clicks, model, score, network, selection): + def scores_maps_retrieve(n_clicks, model, score, network, selection, orig_model, orig_stats): """ Read scores tables and plot maps """ from tools import get_scores_figure mb = MODEBAR_LAYOUT_TS @@ -197,22 +201,28 @@ def register_callbacks(app, cache, cache_timeout): if DEBUG: print('::: 1 :::') figure = get_scores_figure(network, model, score, selection) figure.update_layout(mb) - return figure, True - + return figure, True, model, score + raise PreventUpdate if DEBUG: print('::: 2 :::') - figure = get_scores_figure(network, model, score, selection) - figure.update_layout(mb) - return figure, True - - if model is not None and score is not None: - if DEBUG: print('::: 3 :::') - figure = get_scores_figure(network, model, score, selection) - figure.update_layout(mb) - return figure, True - - return dash.no_update, False # PreventUpdate + if orig_model and orig_stats: + figure = get_scores_figure(network, orig_model[0], orig_stats[0], selection) + figure.update_layout(mb) + return figure, True, orig_model[0], orig_stats[0] + else: + print('::: 2.5 :::') + figure = get_scores_figure(network, model, score, selection) + figure.update_layout(mb) + return figure, True, model, score + +# if model is not None and score is not None: +# if DEBUG: print('::: 3 :::') +# figure = get_scores_figure(network, model, score, selection) +# figure.update_layout(mb) +# return figure, True, orig_model[0], orig_stats[0] + + return dash.no_update, False, dash.no_update, dash.no_update # PreventUpdate @app.callback( diff --git a/tabs/forecast.py b/tabs/forecast.py index 308f1c2d9e59c3b75d8e1dd4272de81150b8fb01..61bd0a930690684c52531fd1581566d30f78eeca 100644 --- a/tabs/forecast.py +++ b/tabs/forecast.py @@ -421,7 +421,7 @@ def sidebar_forecast(variables, default_var, models, default_model): dbc.Card([ dbc.CardHeader(html.H2( dbc.Button("Warning Advisory System", - color="link", id='group-3-toggle', disabled=True) + color="link", id='group-3-toggle', disabled=False) )), dbc.Collapse( id='collapse-3', diff --git a/tabs/forecast_callbacks.py b/tabs/forecast_callbacks.py index bdccd185cfb4a50ad38f4c183a91497d5675e30f..5eab722cf923f29851dacfb4e0917d44255128ca 100644 --- a/tabs/forecast_callbacks.py +++ b/tabs/forecast_callbacks.py @@ -55,7 +55,8 @@ def register_callbacks(app, cache, cache_timeout): Output('collapse-2', 'is_open'), Output('collapse-3', 'is_open'), Output('group-2-toggle', 'disabled'), - Output('group-3-toggle', 'disabled')], + Output('group-3-toggle', 'disabled'), + Output('variable-dropdown-forecast','value')], [Input('group-1-toggle', 'n_clicks'), Input('group-2-toggle', 'n_clicks'), Input('group-3-toggle', 'n_clicks'), @@ -63,7 +64,7 @@ def register_callbacks(app, cache, cache_timeout): [State('collapse-1', 'is_open'), State('collapse-2', 'is_open'), State('collapse-3', 'is_open'),], - prevent_initial_call=False + prevent_initial_call=True ) def render_forecast_tab(modbutton, probbutton, wasbutton, var, modopen, probopen, wasopen): """ Function rendering requested tab """ @@ -74,33 +75,32 @@ def register_callbacks(app, cache, cache_timeout): if button_id == "group-1-toggle" and modbutton: if modopen is True: - return not modopen, False, False, dash.no_update, dash.no_update - return not modopen, False, False, dash.no_update, dash.no_update + return not modopen, False, False, dash.no_update, dash.no_update, dash.no_update + return not modopen, False, False, dash.no_update, dash.no_update, dash.no_update elif button_id == "group-2-toggle" and probbutton: if probopen is True: - return False, not probopen, False, dash.no_update, dash.no_update - return False, not probopen, False, dash.no_update, dash.no_update + return False, not probopen, False, dash.no_update, dash.no_update, dash.no_update + return False, not probopen, False, dash.no_update, dash.no_update, dash.no_update elif button_id == "group-3-toggle" and wasbutton: if wasopen is True: - return False, False, not wasopen, dash.no_update, dash.no_update - return False, False, not wasopen, dash.no_update, dash.no_update + return False, False, not wasopen, dash.no_update, dash.no_update, 'SCONC_DUST' + return False, False, not wasopen, dash.no_update, dash.no_update, 'SCONC_DUST' if var == 'SCONC_DUST': # raise PreventUpdate - return modopen, probopen, wasopen, False, False + return modopen, probopen, wasopen, False, False, dash.no_update elif var == 'OD550_DUST': # only models and prob can be opened if wasopen: - return True, False, False, False, True - return modopen, probopen, wasopen, False, True + return True, False, False, False, True, dash.no_update + return modopen, probopen, wasopen, False, True, dash.no_update else: if modopen: - return True, False, False, True, True - return True, False, False, True, True + return True, False, False, True, True, dash.no_update + return True, False, False, True, True, dash.no_update raise PreventUpdate - @app.callback( [Output('prob-dropdown', 'options'), Output('prob-dropdown', 'value')],