diff --git a/src/pages/dashboard.py b/src/pages/dashboard.py index 3d390b69a1848ebdb7c12b704241236a9d218dea..15e35c21458b2ad4eee60703a9e5435172f370f3 100644 --- a/src/pages/dashboard.py +++ b/src/pages/dashboard.py @@ -28,7 +28,6 @@ from mlair.time_series import plot as plot_ml_time_series import pages.dashboard_translations as guitr import pages.dashboard_constants as guiconst - # the following should be done with static files! APP_HOME = Path.cwd() IMAGE_PATH = APP_HOME.joinpath("static", "images") @@ -230,7 +229,7 @@ def generate_ml_fcast_body(language_id=0): def generate_ml_fcast_output_body(language_id): stations_list = info.get_available_stations(infile="mlair_stations.csv") - stations_list = sorted(stations_list) +# stations_list = sorted(stations_list) return [ 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): dbc.Col( dcc.Dropdown(id="station-dropdown-ml-output", 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 ), 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): Output('image-container-ml-output', 'children'), Input('station-dropdown-ml-output', 'value'), [State("user-info", "data"), - State("job-info", "data")], - prevent_initial_call=True + State("job-info", "data")] ) def update_mlair_image(selected_station, users_dict, job_dict): - try: - language_id = json.loads(users_dict)["language_id"] - except: - language_id = 0 jobid = json.loads(job_dict)["jobnr"] - job_props = get_db_job_entry(jobid) - - image_path = plot_ml_time_series(selected_station, language_id, - species=job_props['species'], - start_date=job_props['start_date'], - forecast_length=job_props['forecast_length']) - image = html.Img(src=image_path, className='image-fit-container') - - return image + if jobid != "bla": + try: + language_id = json.loads(users_dict)["language_id"] + except: + language_id = 0 + job_props = get_db_job_entry(jobid) + image_path = plot_ml_time_series(selected_station, language_id, + species=job_props['species'], + start_date=job_props['start_date'], + forecast_length=job_props['forecast_length']) + image = html.Img(src=image_path, className='image-fit-container') + return image + else: + return None def generate_ml_fcast_output_modal(jobnr=None, lisopen=False, language_id=0): @@ -575,8 +577,14 @@ def generate_eurad_scen_body(language_id): ], class_name="row mt-3"), dbc.Row([ 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"]))], - value=0, id="eurad_scen_emi")), + dbc.Col( + 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.Modal([ dbc.ModalHeader(f"{guitr.help_emissions_label[language_id]}"), @@ -749,7 +757,7 @@ def get_job_status(jobid, application, convoc_status_dict): new_status_code = convoc_status_dict['active'] elif new_status == 'queued': 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'] else: new_status_code = -1 @@ -1320,7 +1328,9 @@ def postprocess_job(rows, derived_virtual_selected_rows, users_dict): eurad_im_output_modal_isopen = False ml_fcast_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]] 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]] diff --git a/utils/utils.py b/utils/utils.py index dee1753d40e0175becb4ef89e834cfb06be1ffb6..d906c5d193e09581d5aec3450f2b8957766466f8 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -22,9 +22,9 @@ def transfer_results_from_HPC(jobnr, model_date, iscen, data_path): timestep_date = date(int(yy), int(mm), int(dd)) base_directory = f"{UNICORE_USER}/{jobnr.upper()}/CTM/{yy}{mm}/{dd}" 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: - 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); # in the latter case, a link to the already downloaded data is sufficient