From f68046178ace417f984362b4ddc0a02aa0bf83b9 Mon Sep 17 00:00:00 2001 From: k-rieck Date: Wed, 18 Dec 2024 10:38:43 +0100 Subject: [PATCH 1/5] fix tests --- hisim/components/weather_data_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hisim/components/weather_data_import.py b/hisim/components/weather_data_import.py index 74f12d4a7..adf2fe64b 100644 --- a/hisim/components/weather_data_import.py +++ b/hisim/components/weather_data_import.py @@ -6,7 +6,7 @@ import datetime import pandas as pd from wetterdienst import Settings -from wetterdienst.provider.dwd.observation import ( +from wetterdienst.provider.dwd.observation.api import ( DwdObservationParameter, DwdObservationRequest, DwdObservationResolution, From 007bf7c4123052d8414149732c9a756e59809ac1 Mon Sep 17 00:00:00 2001 From: k-rieck Date: Wed, 18 Dec 2024 10:48:10 +0100 Subject: [PATCH 2/5] fix wetterdienst version --- hisim/components/weather_data_import.py | 2 +- requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hisim/components/weather_data_import.py b/hisim/components/weather_data_import.py index adf2fe64b..74f12d4a7 100644 --- a/hisim/components/weather_data_import.py +++ b/hisim/components/weather_data_import.py @@ -6,7 +6,7 @@ import datetime import pandas as pd from wetterdienst import Settings -from wetterdienst.provider.dwd.observation.api import ( +from wetterdienst.provider.dwd.observation import ( DwdObservationParameter, DwdObservationRequest, DwdObservationResolution, diff --git a/requirements.txt b/requirements.txt index 6f8a617e2..ea48339e2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,6 +25,6 @@ ordered_set typing_extensions python-dotenv windpowerlib # ==0.2.1 -wetterdienst +wetterdienst==0.97.0 cdsapi -xarray \ No newline at end of file +xarray From de82eb7aebdc9d36ed6ed6ceec6ecd13a16f1a8b Mon Sep 17 00:00:00 2001 From: k-rieck Date: Wed, 18 Dec 2024 10:57:22 +0100 Subject: [PATCH 3/5] fix type anotation --- hisim/components/controller_mpc.py | 6 ++---- hisim/components/generic_car.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hisim/components/controller_mpc.py b/hisim/components/controller_mpc.py index d296943c5..9f17203f5 100644 --- a/hisim/components/controller_mpc.py +++ b/hisim/components/controller_mpc.py @@ -709,10 +709,8 @@ def optimize( # noqa: C901 cop_sampled = cop_timestep[0::sampling_rate] eer_sampled = eer_timestep[0::sampling_rate] - cop_sampled_array = np.reshape(np.array(cop_sampled), (1, len(cop_sampled))) - eer_sampled_array = np.reshape(np.array(eer_sampled), (1, len(eer_sampled))) - cop_sampled_array = np.reshape(np.array(cop_sampled), (1, len(cop_sampled))) - eer_sampled_array = np.reshape(np.array(eer_sampled), (1, len(eer_sampled))) + cop_sampled_array: np.ndarray = np.reshape(np.array(cop_sampled), (1, len(cop_sampled))) + eer_sampled_array: np.ndarray = np.reshape(np.array(eer_sampled), (1, len(eer_sampled))) # Numerical values of pv forecast (casadi fromat) pv_forecast_24h = np.reshape(np.array(pv_forecast_24h), (1, len(pv_forecast_24h))) diff --git a/hisim/components/generic_car.py b/hisim/components/generic_car.py index da3be82e2..ce6ac7478 100644 --- a/hisim/components/generic_car.py +++ b/hisim/components/generic_car.py @@ -574,7 +574,7 @@ def resample_meters_driven(self, meters_driven: List, seconds_per_timestep: int) trimmed_meters_driven = meters_driven[: num_timesteps * minutes_per_timestep] # Reshape and sum the data - reshaped_meters = np.reshape(trimmed_meters_driven, (num_timesteps, minutes_per_timestep)) + reshaped_meters: np.ndarray = np.reshape(trimmed_meters_driven, (num_timesteps, minutes_per_timestep)) resampled_meters = np.sum(reshaped_meters, axis=1) return resampled_meters From ab8d15ddadff58ca85dba979211a6441f65a3da7 Mon Sep 17 00:00:00 2001 From: k-rieck Date: Wed, 18 Dec 2024 11:03:40 +0100 Subject: [PATCH 4/5] fix wetterdienst version --- hisim/components/controller_mpc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hisim/components/controller_mpc.py b/hisim/components/controller_mpc.py index 9f17203f5..a9cb903ec 100644 --- a/hisim/components/controller_mpc.py +++ b/hisim/components/controller_mpc.py @@ -715,9 +715,9 @@ def optimize( # noqa: C901 # Numerical values of pv forecast (casadi fromat) pv_forecast_24h = np.reshape(np.array(pv_forecast_24h), (1, len(pv_forecast_24h))) - p_el = np.reshape(np.array(price_purchase_forecast_24h), (1, len(price_purchase_forecast_24h))) + p_el: np.ndarray = np.reshape(np.array(price_purchase_forecast_24h), (1, len(price_purchase_forecast_24h))) - feed_in_tariff = np.reshape( + feed_in_tariff: np.ndarray = np.reshape( np.array(price_injection_forecast_24h), (1, len(price_injection_forecast_24h)), ) From 35fa4b5b7d5bfb9417396f17ce0ba781b089f87c Mon Sep 17 00:00:00 2001 From: k-rieck Date: Wed, 18 Dec 2024 12:27:08 +0100 Subject: [PATCH 5/5] try to find well working wetterdienst version --- hisim/components/weather_data_import.py | 4 ++-- requirements.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hisim/components/weather_data_import.py b/hisim/components/weather_data_import.py index 74f12d4a7..01405323d 100644 --- a/hisim/components/weather_data_import.py +++ b/hisim/components/weather_data_import.py @@ -130,7 +130,7 @@ def dwd_10min_request( ts_interpolation_use_nearby_station_distance=40, ) - parameters = [DwdObservationParameter.MINUTE_10.TEMPERATURE_AIR_MEAN_2M, + parameters = [DwdObservationParameter.MINUTE_10.TEMPERATURE_AIR_MEAN_200, DwdObservationParameter.MINUTE_10.PRESSURE_AIR_SITE, DwdObservationParameter.MINUTE_10.WIND_DIRECTION, DwdObservationParameter.MINUTE_10.WIND_SPEED, @@ -240,7 +240,7 @@ def dwd_10min_request( ) print("Write Weather Data into Dataframe.") temperature_dwd_df = ( - values[values["parameter"] == "temperature_air_mean_2m"] + values[values["parameter"] == "temperature_air_mean_200"] .groupby("date")["value"] .apply(lambda x: ", ".join(map(str, x))) .reset_index() diff --git a/requirements.txt b/requirements.txt index ea48339e2..c6ec4ed40 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,6 +25,6 @@ ordered_set typing_extensions python-dotenv windpowerlib # ==0.2.1 -wetterdienst==0.97.0 +wetterdienst==0.63.0 cdsapi xarray