diff --git a/src/utils.py b/src/utils.py index cd834b6..409045f 100644 --- a/src/utils.py +++ b/src/utils.py @@ -146,15 +146,17 @@ def format_plevels(national_forecast_value: NationalForecastValue): :return: """ logger.debug(f"{national_forecast_value.plevels}") + power = national_forecast_value.expected_power_generation_megawatts if (not isinstance(national_forecast_value.plevels, dict)) or ( national_forecast_value.plevels == {} ): - power = national_forecast_value.expected_power_generation_megawatts national_forecast_value.plevels = { "plevel_10": round(power * 0.8, 2), "plevel_90": round(power * 1.2, 2), } + logger.info(f"plevels set to default: {national_forecast_value.plevels}") + # rename '10' and '90' to plevel_10 and plevel_90 for c in ["10", "90"]: if c in national_forecast_value.plevels.keys(): @@ -163,14 +165,10 @@ def format_plevels(national_forecast_value: NationalForecastValue): ) if national_forecast_value.plevels["plevel_10"] is None: - national_forecast_value.plevels["plevel_10"] = round( - national_forecast_value.expected_power_generation_megawatts * 0.8, 2 - ) + national_forecast_value.plevels["plevel_10"] = round(power * 0.8, 2) if national_forecast_value.plevels["plevel_90"] is None: - national_forecast_value.plevels["plevel_90"] = round( - national_forecast_value.expected_power_generation_megawatts * 1.2, 2 - ) + national_forecast_value.plevels["plevel_90"] = round(power * 1.2, 2) def filter_forecast_values(