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

for EURAD-IM: adapt filename to data from the digital twin; more adaptations...

for EURAD-IM: adapt filename to data from the digital twin; more adaptations to actual existing options
parent 3e827559
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,6 @@ from mlair.time_series import plot as plot_ml_time_series ...@@ -28,7 +28,6 @@ from mlair.time_series import plot as plot_ml_time_series
import pages.dashboard_translations as guitr import pages.dashboard_translations as guitr
import pages.dashboard_constants as guiconst import pages.dashboard_constants as guiconst
# the following should be done with static files! # the following should be done with static files!
APP_HOME = Path.cwd() APP_HOME = Path.cwd()
IMAGE_PATH = APP_HOME.joinpath("static", "images") IMAGE_PATH = APP_HOME.joinpath("static", "images")
...@@ -230,7 +229,7 @@ def generate_ml_fcast_body(language_id=0): ...@@ -230,7 +229,7 @@ def generate_ml_fcast_body(language_id=0):
def generate_ml_fcast_output_body(language_id): def generate_ml_fcast_output_body(language_id):
stations_list = info.get_available_stations(infile="mlair_stations.csv") stations_list = info.get_available_stations(infile="mlair_stations.csv")
stations_list = sorted(stations_list) # stations_list = sorted(stations_list)
return [ return [
dbc.Row(dbc.Label(f"{guitr.start_date_label[language_id]}: 18.07.2018, Ozon, Nordrhein Westfalen")), dbc.Row(dbc.Label(f"{guitr.start_date_label[language_id]}: 18.07.2018, Ozon, Nordrhein Westfalen")),
...@@ -239,7 +238,10 @@ def generate_ml_fcast_output_body(language_id): ...@@ -239,7 +238,10 @@ def generate_ml_fcast_output_body(language_id):
dbc.Col( dbc.Col(
dcc.Dropdown(id="station-dropdown-ml-output", dcc.Dropdown(id="station-dropdown-ml-output",
value=stations_list[0], value=stations_list[0],
options=stations_list, options= [{'label': stations_list[i],
'value': stations_list[i],
'disabled': True
} for i in range(len(stations_list))],
), width=6 ), width=6
), ),
dbc.Col(dbc.Button(f"{guitr.map_select_label[language_id]}", class_name="fzj_style_btn"), width=2) dbc.Col(dbc.Button(f"{guitr.map_select_label[language_id]}", class_name="fzj_style_btn"), width=2)
...@@ -256,24 +258,24 @@ def generate_ml_fcast_output_body(language_id): ...@@ -256,24 +258,24 @@ def generate_ml_fcast_output_body(language_id):
Output('image-container-ml-output', 'children'), Output('image-container-ml-output', 'children'),
Input('station-dropdown-ml-output', 'value'), Input('station-dropdown-ml-output', 'value'),
[State("user-info", "data"), [State("user-info", "data"),
State("job-info", "data")], State("job-info", "data")]
prevent_initial_call=True
) )
def update_mlair_image(selected_station, users_dict, job_dict): def update_mlair_image(selected_station, users_dict, job_dict):
jobid = json.loads(job_dict)["jobnr"]
if jobid != "bla":
try: try:
language_id = json.loads(users_dict)["language_id"] language_id = json.loads(users_dict)["language_id"]
except: except:
language_id = 0 language_id = 0
jobid = json.loads(job_dict)["jobnr"]
job_props = get_db_job_entry(jobid) job_props = get_db_job_entry(jobid)
image_path = plot_ml_time_series(selected_station, language_id, image_path = plot_ml_time_series(selected_station, language_id,
species=job_props['species'], species=job_props['species'],
start_date=job_props['start_date'], start_date=job_props['start_date'],
forecast_length=job_props['forecast_length']) forecast_length=job_props['forecast_length'])
image = html.Img(src=image_path, className='image-fit-container') image = html.Img(src=image_path, className='image-fit-container')
return image return image
else:
return None
def generate_ml_fcast_output_modal(jobnr=None, lisopen=False, language_id=0): def generate_ml_fcast_output_modal(jobnr=None, lisopen=False, language_id=0):
...@@ -575,8 +577,14 @@ def generate_eurad_scen_body(language_id): ...@@ -575,8 +577,14 @@ def generate_eurad_scen_body(language_id):
], class_name="row mt-3"), ], class_name="row mt-3"),
dbc.Row([ dbc.Row([
dbc.Col(dbc.Label(f"{guitr.emis_scen_label[language_id]}"), width=3), dbc.Col(dbc.Label(f"{guitr.emis_scen_label[language_id]}"), width=3),
dbc.Col(dcc.Dropdown(options=[{'label': emis_info[language_id][" Name"][i], 'value': i} for i in range(len(emis_info[language_id][" Name"]))], dbc.Col(
value=0, id="eurad_scen_emi")), dcc.Dropdown(value=0,
options=[{'label': emis_info[language_id][" Name"][i],
'value': i,
'disabled': True if i == len(emis_info[language_id][" Name"])-1 else False
} for i in range(len(emis_info[language_id][" Name"]))],
id="eurad_scen_emi"), width=6
),
dbc.Col(dbc.Button(f"{guitr.help_emissions_label[language_id]}", id="help_emis_open", class_name="fzj_style_btn"), width=3), dbc.Col(dbc.Button(f"{guitr.help_emissions_label[language_id]}", id="help_emis_open", class_name="fzj_style_btn"), width=3),
dbc.Modal([ dbc.Modal([
dbc.ModalHeader(f"{guitr.help_emissions_label[language_id]}"), dbc.ModalHeader(f"{guitr.help_emissions_label[language_id]}"),
...@@ -749,7 +757,7 @@ def get_job_status(jobid, application, convoc_status_dict): ...@@ -749,7 +757,7 @@ def get_job_status(jobid, application, convoc_status_dict):
new_status_code = convoc_status_dict['active'] new_status_code = convoc_status_dict['active']
elif new_status == 'queued': elif new_status == 'queued':
new_status_code = convoc_status_dict['waiting'] new_status_code = convoc_status_dict['waiting']
elif new_status == 'aborted': elif new_status == 'aborted' or new_status == 'suspended':
new_status_code = convoc_status_dict['aborted'] new_status_code = convoc_status_dict['aborted']
else: else:
new_status_code = -1 new_status_code = -1
...@@ -1320,7 +1328,9 @@ def postprocess_job(rows, derived_virtual_selected_rows, users_dict): ...@@ -1320,7 +1328,9 @@ def postprocess_job(rows, derived_virtual_selected_rows, users_dict):
eurad_im_output_modal_isopen = False eurad_im_output_modal_isopen = False
ml_fcast_output_modal_isopen = False ml_fcast_output_modal_isopen = False
eurad_scen_output_modal_isopen = False eurad_scen_output_modal_isopen = False
if ((derived_virtual_selected_rows != []) and (not derived_virtual_selected_rows)):
# if ((derived_virtual_selected_rows != []) and (not derived_virtual_selected_rows)):
if (derived_virtual_selected_rows != []):
status = rows[derived_virtual_selected_rows[0]][guitr.jobs_columns[language_id][1]] status = rows[derived_virtual_selected_rows[0]][guitr.jobs_columns[language_id][1]]
application = rows[derived_virtual_selected_rows[0]][guitr.jobs_columns[language_id][0]] application = rows[derived_virtual_selected_rows[0]][guitr.jobs_columns[language_id][0]]
jobnr = rows[derived_virtual_selected_rows[0]][guitr.jobs_columns[language_id][9]] jobnr = rows[derived_virtual_selected_rows[0]][guitr.jobs_columns[language_id][9]]
......
...@@ -22,9 +22,9 @@ def transfer_results_from_HPC(jobnr, model_date, iscen, data_path): ...@@ -22,9 +22,9 @@ def transfer_results_from_HPC(jobnr, model_date, iscen, data_path):
timestep_date = date(int(yy), int(mm), int(dd)) timestep_date = date(int(yy), int(mm), int(dd))
base_directory = f"{UNICORE_USER}/{jobnr.upper()}/CTM/{yy}{mm}/{dd}" base_directory = f"{UNICORE_USER}/{jobnr.upper()}/CTM/{yy}{mm}/{dd}"
if iscen == 0: if iscen == 0:
download_filename = f"ctmout_wrf_cutcropped_{timestep_date.strftime('%j')}_h09.nc" download_filename = f"ctmout_digitwin_cutcropped_{timestep_date.strftime('%j')}_de3.nc"
else: else:
download_filename = f"ctmout_wrf{iscen:03}_cutcropped_{timestep_date.strftime('%j')}_h09.nc" download_filename = f"ctmout_digitwin{iscen:03}_cutcropped_{timestep_date.strftime('%j')}_de3.nc"
# only transfer file if results are not already there (from another jobnr); # only transfer file if results are not already there (from another jobnr);
# in the latter case, a link to the already downloaded data is sufficient # in the latter case, a link to the already downloaded data is sufficient
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment