Skip to content
Snippets Groups Projects
Commit 9c2a252d authored by Sabine Schröder's avatar Sabine Schröder
Browse files

expand database table jobs to hold all possible application options; begin...

expand database table jobs to hold all possible application options; begin restructuring for better readability: keep constants and translations in separate files
parent 20470573
No related branches found
No related tags found
No related merge requests found
...@@ -59,8 +59,8 @@ conn.execute("INSERT INTO convoc_status (id,job_status) \ ...@@ -59,8 +59,8 @@ conn.execute("INSERT INTO convoc_status (id,job_status) \
conn.commit() conn.commit()
# There is the need for controlled_vocabulary for regions of interest # There is the need for controlled_vocabulary for regions of interest
# 0: finished # 0: NRW
# 1: active # 1: BB
conn.execute('''CREATE TABLE convoc_region conn.execute('''CREATE TABLE convoc_region
(id INT PRIMARY KEY NOT NULL, (id INT PRIMARY KEY NOT NULL,
region_name TEXT NOT NULL);''') region_name TEXT NOT NULL);''')
...@@ -72,6 +72,65 @@ conn.execute("INSERT INTO convoc_region (id,region_name) \ ...@@ -72,6 +72,65 @@ conn.execute("INSERT INTO convoc_region (id,region_name) \
conn.commit() conn.commit()
# There is the need for controlled_vocabulary for species of interest
# 0: ozone
# 1: no
# 2: no2
# 3: pm2p5
conn.execute('''CREATE TABLE convoc_species
(id INT PRIMARY KEY NOT NULL,
species_name TEXT NOT NULL);''')
conn.execute("INSERT INTO convoc_species(id,species_name) \
VALUES (0, 'ozone')")
conn.execute("INSERT INTO convoc_species(id,species_name) \
VALUES (1, 'no')")
conn.execute("INSERT INTO convoc_species(id,species_name) \
VALUES (2, 'no2')")
conn.execute("INSERT INTO convoc_species (id,species_name) \
VALUES (3, 'pm2p5')")
conn.commit()
# There is the need for controlled_vocabulary for output metrics (MLAir)
# 0: dma8eu
# 1: mean
conn.execute('''CREATE TABLE convoc_metric
(id INT PRIMARY KEY NOT NULL,
metric_name TEXT NOT NULL);''')
conn.execute("INSERT INTO convoc_metric (id,metric_name) \
VALUES (0, 'dma8eu')")
conn.execute("INSERT INTO convoc_metric (id,metric_name) \
VALUES (1, 'mean')")
conn.commit()
# There is the need for controlled_vocabulary for emission scenarios
# 0: standard
# 1: no-emission
# 2: home-office and energy saving
# 3: industry
# 4: e-traffic
# 5: fireplace
conn.execute('''CREATE TABLE convoc_emis_scen
(id INT PRIMARY KEY NOT NULL,
emis_name TEXT NOT NULL);''')
conn.execute("INSERT INTO convoc_emis_scen (id, emis_name) \
VALUES (0, 'standard')")
conn.execute("INSERT INTO convoc_emis_scen (id, emis_name) \
VALUES (1, 'no-emission')")
conn.execute("INSERT INTO convoc_emis_scen (id, emis_name) \
VALUES (2, 'home-office and energy saving')")
conn.execute("INSERT INTO convoc_emis_scen (id, emis_name) \
VALUES (3, 'industry')")
conn.execute("INSERT INTO convoc_emis_scen (id, emis_name) \
VALUES (4, 'e-traffic')")
conn.execute("INSERT INTO convoc_emis_scen (id, emis_name) \
VALUES (5, 'fireplace')")
conn.commit()
# Second, create the dashboard tables # Second, create the dashboard tables
conn.execute('''CREATE TABLE users conn.execute('''CREATE TABLE users
...@@ -99,40 +158,46 @@ conn.execute('''CREATE TABLE jobs ...@@ -99,40 +158,46 @@ conn.execute('''CREATE TABLE jobs
start_date datetime NOT NULL, start_date datetime NOT NULL,
forecast_length INT NOT NULL, forecast_length INT NOT NULL,
region INT NOT NULL, region INT NOT NULL,
species INT ,
metric INT ,
emis_scen INT ,
creation_date datetime NOT NULL, creation_date datetime NOT NULL,
FOREIGN KEY(user_id) REFERENCES user(id), FOREIGN KEY(user_id) REFERENCES user(id),
FOREIGN KEY(status) REFERENCES convoc_status(id), FOREIGN KEY(status) REFERENCES convoc_status(id),
FOREIGN KEY(application) REFERENCES convoc_application(id), FOREIGN KEY(application) REFERENCES convoc_application(id),
FOREIGN KEY(region) REFERENCES convoc_region(id));''') FOREIGN KEY(region) REFERENCES convoc_region(id),
FOREIGN KEY(species) REFERENCES convoc_species(id),
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ FOREIGN KEY(metric) REFERENCES convoc_metric(id),
VALUES ('832tgjhingj1', 1, 0, 1, '2018-07-18 00:00', 4, 1, '2024-01-12 16:03')") FOREIGN KEY(emis_scen) REFERENCES convoc_emis_scen(id));''')
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \
VALUES ('jjkl7t3li97m', 1, 1, 0, '2017-01-25 00:00', 3, 0, '2024-01-09 10:14')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('832tgjhingj1', 1, 0, 1, '2018-07-18 00:00', 4, 1, Null, Null, Null, '2024-01-12 16:03')")
VALUES ('7zhtglaza8ah', 1, 2, 1, '2018-07-18 00:00', 4, 1, '2024-01-15 08:01')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('jjkl7t3li97m', 1, 1, 0, '2017-01-25 00:00', 3, 0, 0, 0, Null, '2024-01-09 10:14')")
VALUES ('ji54Fdr0z99m', 1, 0, 0, '2018-07-18 00:00', 1, 0, '2023-12-18 13:57')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('7zhtglaza8ah', 1, 2, 1, '2018-07-18 00:00', 4, 1, Null, Null, 1, '2024-01-15 08:01')")
VALUES ('7zknt6702rx5', 1, 0, 3, '2017-01-25 00:00', 3, 0, '2023-12-12 11:27')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('ji54Fdr0z99m', 1, 0, 0, '2018-07-18 00:00', 1, 0, Null, Null, Null, '2023-12-18 13:57')")
VALUES ('klj836kahg2l', 1, 2, 0, '2018-07-18 00:00', 1, 0, '2023-12-21 17:59')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('7zknt6702rx5', 1, 0, 3, '2017-01-25 00:00', 3, 0, Null, Null, Null, '2023-12-12 11:27')")
VALUES ('a89uj20gxybb', 1, 2, 2, '2017-01-25 00:00', 4, 0, '2024-01-02 14:35')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('klj836kahg2l', 1, 2, 0, '2018-07-18 00:00', 1, 0, Null, Null, 2, '2023-12-21 17:59')")
VALUES ('832tgjhingj1', 2, 0, 1, '2018-07-18 00:00', 4, 1, '2024-01-12 16:03')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('a89uj20gxybb', 1, 2, 2, '2017-01-25 00:00', 4, 0, Null, Null, 5, '2024-01-02 14:35')")
VALUES ('jjkl7t3li97m', 2, 1, 0, '2017-01-25 00:00', 3, 0, '2024-01-09 10:14')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('832tgjhingj1', 2, 0, 1, '2018-07-18 00:00', 4, 1, Null, Null, Null, '2024-01-12 16:03')")
VALUES ('7zhtglaza8ah', 2, 2, 1, '2018-07-18 00:00', 4, 1, '2024-01-15 08:01')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('jjkl7t3li97m', 2, 1, 0, '2017-01-25 00:00', 3, 0, 0, 0, Null, '2024-01-09 10:14')")
VALUES ('ji54Fdr0z99m', 2, 0, 0, '2018-07-18 00:00', 1, 0, '2023-12-18 13:57')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('7zhtglaza8ah', 2, 2, 1, '2018-07-18 00:00', 4, 1, Null, Null, 1, '2024-01-15 08:01')")
VALUES ('7zknt6702rx5', 2, 0, 3, '2017-01-25 00:00', 3, 0, '2023-12-12 11:27')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('ji54Fdr0z99m', 2, 0, 0, '2018-07-18 00:00', 1, 0, Null, Null, Null, '2023-12-18 13:57')")
VALUES ('klj836kahg2l', 2, 2, 0, '2018-07-18 00:00', 1, 0, '2023-12-21 17:59')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, creation_date) \ VALUES ('7zknt6702rx5', 2, 0, 3, '2017-01-25 00:00', 3, 0, Null, Null, Null, '2023-12-12 11:27')")
VALUES ('a89uj20gxybb', 2, 2, 2, '2017-01-25 00:00', 4, 0, '2024-01-02 14:35')") conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
VALUES ('klj836kahg2l', 2, 2, 0, '2018-07-18 00:00', 1, 0, Null, Null, 2, '2023-12-21 17:59')")
conn.execute("INSERT INTO jobs (id,user_id,application,status,start_date,forecast_length, region, species, metric, emis_scen, creation_date) \
VALUES ('a89uj20gxybb', 2, 2, 2, '2017-01-25 00:00', 4, 0, Null, Null, 5, '2024-01-02 14:35')")
conn.commit() conn.commit()
......
This diff is collapsed.
import datetime as dt
min_date_allowed=dt.date(2017, 1, 1)
max_date_allowed=dt.date(2018, 9, 1)
initial_visible_month=dt.date(2017, 1, 1)
from dash import html
layout_cards = [["Description", "Create Forecasts", "My Model Runs", "My Results"],
["Beschreibung", "Erstelle Vorhersagen", "Meine Modellläufe", "Meine Auswertungen"]]
description = [["The DestinE Air Quality Use Case demonstrates interactive triggering of advanced forecasting "
"and analysis workflows for air quality.",
html.Br(),
"The workflows are triggered by clicking on the buttons in the second tab.",
html.Br(),
"The results of the workflows are displayed in the third tab.",
html.Br(),
"The documentation of the use case can be found ",
html.A("here", href="https://www.fz-juelich.de/de/iek/iek-8/projekte/"
+ "destination-earth-use-case-fuer-luftqualitaet-de370c")],
["Der 'DestinE Air Quality Use Case' (Anwendungsfall) demonstriert die interaktive Auslösung "
"fortgeschrittener Vorhersage- und Analyse-Workflows für die Luftqualität.",
html.Br(),
"Die Workflows werden durch Klicken auf die Schaltflächen im zweiten Reiter ausgelöst.",
html.Br(),
"Die Ergebnisse der Workflows werden auf der dritten Registerkarte angezeigt.",
html.Br(),
"Die Dokumentation des Anwendungsfalls finden Sie ",
html.A("hier", href="https://www.fz-juelich.de/de/iek/iek-8/projekte/"
+ "destination-earth-use-case-fuer-luftqualitaet-de370c")]]
jobs_columns = [["Application", "Status", "Start date", "Forecast Length", "Region", "Species", "Metric", "Emission Scenario", "Creation Date", "Jobnr"],
["Anwendung", "Status", "Startdatum", "Vorhersagedauer", "Region", "Spezies", "Metrik", "Emissionsszenario", "Erstellungsdatum", "Jobnr"]]
results_columns = [["Result_ID", "Jobnr", "Application", "Used Options"],
["Resultats_ID", "Jobnr", "Anwendung", "Verwendete Optionen"]]
# The following lists should be created once from the controlled vocabulary
status_text = [["finished", "active", "waiting", "aborted"],
["beendet", "aktiv", "in der Warteschlange", "abgebrochen"]]
application_text = [["Field forecasting with EURAD-IM", "Point forecasting with MLAir", "EURAD-IM emission scenarios"],
["Gebietsvorhersage mit EURAD-IM", "Stationsvorhersage mit MLAir", "EURAD-IM Emissionsszenarien"]]
region_text = [["North Rhine-Westphalia", "Berlin-Brandenburg"],
["Nordrhein-Westfalen", "Berlin-Brandenburg"]]
description_text = [["This application produces high-resolution, i.e. 1 km or less, on-demand results over a "
+ "user-selected area for a forecast period of up to 4 days. Here, users can select the forecast "
+ "start date (default today) and the forecast length (shorter runs require less time and "
+ "resources), and the regional domain of the simulation. There are two EURAD-IM model "
+ "configurations applied in the background of this application: i) the default 9 km resolution "
+ "model covering all of Europe, and ii) region-specific 1 km configurations, initially limited "
+ "to North Rhine-Westphalia and Brandenburg. Users can select whether they wish to perform a "
+ "dedicated 1 km EURAD-IM simulation, or whether the 1 km results shall be obtained with ML "
+ "downscaling from the results of a 9 km simulation. For more information about EURAD-IM and ML "
+ "downscaling, please refer to the description tab.",
"This application concerns point forecasts of air quality at (German) measurement stations "
+ "with the MLAir tool. This workflow makes use of the TOAR database infrastructure that is "
+ "operated at JSC (https://toar-data.fz-juelich.de) and uses data from the continuous Digital "
+ "Twin (DT) as meteorological inputs. Users can select a forecast a start time and a region, and "
+ "the tool will then generate forecasts for all stations in the given region. Users can also "
+ "select the species of interest and the air quality metric that shall be computed. Initial "
+ "settings for these parameters are ozone and 'MDA8', i.e. the maximum daily 8-hour average "
+ "value. For more information about MLAir, please refer to the description tab.",
"This application, which can be directly applied for decision making, triggers an EURAD-IM "
+ "ensemble simulation with modified emission scenarios. This allows for the assessment of the "
+ "effectiveness of different air pollution mitigation strategies. User choices are similar to "
+ "the field forecast application, except that users will also have to choose the scenario they "
+ "wish to employ. For more information about EURAD-IM emissions, please refer to the description "
+ "tab."],
["Diese Anwendung erzeugt hochauflösende, d.h. 1 km oder weniger, On-Demand-Ergebnisse über ein "
+ "vom Benutzer ausgewähltes Gebiet für einen Vorhersagezeitraum von bis zu 4 Tagen. Dabei können "
+ "die Nutzer das Startdatum der Vorhersage (standardmäßig heute) und die Vorhersagelänge "
+ "(kürzere Läufe erfordern weniger Zeit und Ressourcen) sowie den regionalen Bereich der "
+ "Simulation auswählen. Im Hintergrund dieser Anwendung werden zwei "
+ "EURAD-IM-Modellkonfigurationen verwendet: i) das Standardmodell mit 9 km Auflösung, das ganz "
+ "Europa abdeckt, und ii) regionalspezifische 1 km-Konfigurationen, die zunächst auf "
+ "Nordrhein-Westfalen und Brandenburg beschränkt sind. Der Benutzer kann dann wählen, ob er eine "
+ "eigene 1 km EURAD-IM-Simulation durchführen möchte oder ob die 1 km-Ergebnisse durch "
+ "ML-Downscaling aus den Ergebnissen einer 9 km-Simulation gewonnen werden sollen. Weitere Details "
+ "über EURAD-IM finden sich unter 'Beschreibung'.",
"Diese Anwendung betrifft Punktvorhersagen der Luftqualität an (deutschen) Messstationen mit dem "
+ "MLAir-Tool. Sie nutzt die TOAR-Datenbankinfrastruktur, die beim JSC "
+ "(https://toar-data.fz-juelich.de) betrieben wird, und verwendet Daten aus dem kontinuierlichen "
+ "digitalen Zwilling (Digital Twin -- DT) als meteorologische Eingaben. Der Benutzer kann eine "
+ "Startzeit für die Vorhersage und eine Region auswählen, woraufhin das Tool Vorhersagen für "
+ "alle Stationen in der jeweiligen Region erstellt. Die Benutzer können auch die interessierende "
+ "Spezies und die zu berechnende Luftqualitätsmetrik auswählen. Die Grundeinstellungen für diese "
+ "Parameter sind Ozon und 'MDA8', d. h. der maximale 8-Stunden-Tagesmittelwert. Weitere "
+ "Informationen über MLAir finden sich im Beschreibungs-Tab.",
"Diese Anwendung löst eine "
+ "EURAD-IM-Ensemblesimulation mit veränderten Emissionsszenarien aus. Dies ermöglicht die "
+ "Bewertung der Wirksamkeit verschiedener Strategien zur Verringerung der Luftverschmutzung. Die "
+ "Auswahlmöglichkeiten des Benutzers sind ähnlich wie bei der Feldvorhersageanwendung, außer "
+ "dass der Benutzer auch das Szenario auswählen muss, das er verwenden möchte. Weitere "
+ "Informationen über EURAD-IM Emissionen finden sich im Beschreibungs-Tab."]]
user_label = ["user:", "Benutzer:"]
run_label = ["run", "Starten"]
run2_label = ["Run", "Lauf"]
close_label = ["close", "Schließen"]
date_label = ["date:", "Datum:"]
date_format = ["M/D/Y", "D.M.Y"]
date_format2 = ['%Y-%m-%d %H:%M', '%d.%m.%Y %H:%M']
first_day_of_week = [0, 1]
forecast_length_label = ["forecast length", "Vorhersagedauer"]
region_label = ["region:", "Region:"]
forecast_length_options = [["4 days", "3 days", "2 days", "1 day"],
["4 Tage", "3 Tage", "2 Tage", "1 Tag"]]
output_format_options = [["raw model output", "2D plots", "time series"],
["Rohmodellausgabe", "2D-Diagramme", "Zeitreihen"]]
state_label = ["state:", "Bundesland:"]
species_label = ["species:", "Spezies:"]
output_metrics_label = ["output metrics:", "Ausgabemetrik:"]
species_options = [["ozone", "NO", "NO2", "PM2.5"],
["Ozon", "Stickstoffmonoxid", "Stickstoffdioxid", "Feinstaub (PM2.5)"]]
metrics_options = [["dma8eu", "mean"],
["dma8eu", "Mittelwert"]]
emis_scen_label = ["emission scenario:", "Emissionsszenario:"]
help_metrics_label = ["Help on metrics", "Hilfe zu Ausgabemetriken"]
help_emissions_label = ["Help on emission scenarios", "Hilfe zu Emissions-Szenarien"]
map_select_label = ["Select on map", "auf Karte auswählen"]
time_step_label = ["Time step", "Zeitschritt"]
start_date_label = ["Start date", "Startdatum"]
location_label = ["Location", "Ort"]
day_label = ["day", "Tag"]
day_plural_label = ["s", "e"]
save_label = ["Save Results", "Ergebnisse sichern"]
download_label = ["Download Data", "Daten herunterladen"]
im_download_label = ["Download Plots", "Plots herunterladen"]
downscaling_label = ["Postprocessing with ML-Downscaling", "Postprocessing mit ML-Downscaling"]
show_downscaling_label = ["Show results with ML downscaling", "Ergebnisse mit ML-Downscaling anzeigen"]
out_option_label = ["output option", "Ausgabe-Option"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment