diff --git a/src/app.py b/src/app.py index cef4d6e2754b97b2af1c6c672400d912e4293c51..80a7f04dd921f51fcc192b10b6746171d5115071 100644 --- a/src/app.py +++ b/src/app.py @@ -235,7 +235,7 @@ class ForecastMonitor: current_forecast = session.query(PegelForecasts).filter( and_( PegelForecasts.model == actual_model_name, - PegelForecasts.tstamp == last_required_hour + PegelForecasts.tstamp >= last_required_hour ) ).first() @@ -615,7 +615,7 @@ class ForecastMonitor: model_id = selected_row['model_id'] metrics_data, edge_times = self.get_model_metrics(model_id, metric_name) - if metrics_data.empty: + if metrics_data is None or metrics_data.empty: return html.Div("Keine Metriken verfügbar"), html.Div() fig = create_metrics_plots(metrics_data, metric_name) @@ -696,11 +696,16 @@ class ForecastMonitor: self.app.run(host=host, port=port, debug=debug) if __name__ == '__main__': + #TODO Db initialisation like in predict_db.py + #oracledb.init_oracle_client(lib_dir=main_config["db_params"]["config_dir"]) + #oracledb.init_oracle_client() + monitor = ForecastMonitor( username="c##mspils", password="cobalt_deviancy", dsn="localhost/XE" ) + #monitor.run(host="172.17.0.1", port=8050, debug=True) #monitor.run(host="134.245.232.166", port=8050, debug=True) monitor.run() \ No newline at end of file diff --git a/src/bsh_extractor_v2.py b/src/bsh_extractor_v2.py index 45335202cd2cdb456e70fe2d1f04fbff55fb11de..232fa4ec6c45efed66a7b0f415a2c480fda86f40 100644 --- a/src/bsh_extractor_v2.py +++ b/src/bsh_extractor_v2.py @@ -11,7 +11,7 @@ import oracledb import pandas as pd import yaml -from utils.db_tools.db_tools import OracleDBHandler +from utils.db_tools.db_logging import OracleDBHandler logger = logging.getLogger("bsh_export") logger.setLevel(logging.DEBUG) diff --git a/src/dashboard/tables_and_plots.py b/src/dashboard/tables_and_plots.py index 7348ee462fbee131cd035007ae6c79e80063500d..ee3925882d279ef84a374060fb24942f2cdcff6a 100644 --- a/src/dashboard/tables_and_plots.py +++ b/src/dashboard/tables_and_plots.py @@ -1,4 +1,4 @@ -from datetime import datetime, timedelta +from datetime import datetime, timedelta,timezone import pandas as pd import plotly.express as px @@ -333,7 +333,7 @@ def create_inp_forecast_status_table(df_forecast,ext_forecast_names): #sensor_names = sorted(df_forecast['sensor_name'].unique()) # Create index of last 48 hours at 3-hour intervals - last_required_hour = datetime.now().replace(minute=0, second=0, microsecond=0) + last_required_hour = datetime.now(timezone.utc).replace(minute=0, second=0, microsecond=0) while last_required_hour.hour % 3 != 0: last_required_hour -= timedelta(hours=1) diff --git a/src/icon_export_v3.py b/src/icon_export_v3.py index 931fc516a2b2bee65e6f7949cd75c82235204d95..1b087e12b0c6ba28f587d5cf6b2878b6f0cdaf1b 100755 --- a/src/icon_export_v3.py +++ b/src/icon_export_v3.py @@ -220,7 +220,8 @@ def dict_to_zrx( logger.warning("File %s already exists, file will not be saved.", target_file) else: with open(target_file, "w", encoding="utf-8") as file: - file.write("#REXCHANGEWISKI." + name + ".N.KNN|*|\n") + #file.write("#REXCHANGEWISKI." + name + ".N.KNN|*|\n") + file.write("#REXCHANGE" + name + ".N.ICOND2|*|\n") file.write("#RINVAL-777|*|\n") # if mode in ['hourly','single']: if member == 0: @@ -515,11 +516,10 @@ class ICON_Exporter: gribfile[1].values.flatten()[index - 1].mean() ) - logger.debug("Message: %s", gribfile[1]) - logger.debug( - "Grid shape is %s ,does this match the index files?", - gribfile[1].values.shape, - ) + #logger.debug("Message: %s", gribfile[1]) + #logger.debug( + # "Grid shape is %s ,does this match the index files?", + # gribfile[1].values.shape,) source_file = [ x diff --git a/src/utils/db_tools/db_tools.py b/src/utils/db_tools/db_tools.py index df4a9e558c44a56a8cf0ea6ddfbc61bb81613732..310e857f7034d01e2250513821f41e07f34c1e1e 100644 --- a/src/utils/db_tools/db_tools.py +++ b/src/utils/db_tools/db_tools.py @@ -105,7 +105,7 @@ class OracleWaVoConnection: self.members = self.get_member_list() self.times = self.get_times() - self.not_found = [] + self.not_found = [] #TODO diese liste wird nicht gefllt? mal in alten commits gucken. stand 26.11. def handle_gauge(self, gauge_config: dict) -> None: """