From 89cc70227182b74357c5feecf74b512c392c9a83 Mon Sep 17 00:00:00 2001 From: Jacob Bieker Date: Wed, 24 Apr 2024 12:11:43 +0100 Subject: [PATCH 1/2] Add sensor future minutes for using Meteomatics --- pvnet/models/multimodal/multimodal.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pvnet/models/multimodal/multimodal.py b/pvnet/models/multimodal/multimodal.py index ab6b7610..417fd5be 100644 --- a/pvnet/models/multimodal/multimodal.py +++ b/pvnet/models/multimodal/multimodal.py @@ -57,6 +57,7 @@ def __init__( pv_history_minutes: Optional[int] = None, wind_history_minutes: Optional[int] = None, sensor_history_minutes: Optional[int] = None, + sensor_forecast_minutes: Optional[int] = None, optimizer: AbstractOptimizer = pvnet.optimizers.Adam(), target_key: str = "gsp", interval_minutes: int = 30, @@ -121,6 +122,7 @@ def __init__( addition to the full forecast sensor_encoder: Encoder for sensor data sensor_history_minutes: Length of recent sensor data used as input. + sensor_forecast_minutes: Length of forecast sensor data used as input. adapt_batches: If set to true, we attempt to slice the batches to the expected shape for the model to use. This allows us to overprepare batches and slice from them for the data we need for a model run. @@ -240,9 +242,11 @@ def __init__( if self.include_sensor: if sensor_history_minutes is None: sensor_history_minutes = history_minutes + if sensor_forecast_minutes is None: + sensor_forecast_minutes = forecast_minutes self.sensor_encoder = sensor_encoder( - sequence_length=sensor_history_minutes // sensor_interval_minutes + 1, + sequence_length=sensor_history_minutes // sensor_interval_minutes + sensor_forecast_minutes // sensor_interval_minutes + 1, target_key_to_use=self._target_key_name, input_key_to_use="sensor", ) From 949e6f7b47b55a0e075bc365e60ced28ca0937b7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:16:19 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pvnet/models/multimodal/multimodal.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pvnet/models/multimodal/multimodal.py b/pvnet/models/multimodal/multimodal.py index 417fd5be..8167ac9f 100644 --- a/pvnet/models/multimodal/multimodal.py +++ b/pvnet/models/multimodal/multimodal.py @@ -246,7 +246,9 @@ def __init__( sensor_forecast_minutes = forecast_minutes self.sensor_encoder = sensor_encoder( - sequence_length=sensor_history_minutes // sensor_interval_minutes + sensor_forecast_minutes // sensor_interval_minutes + 1, + sequence_length=sensor_history_minutes // sensor_interval_minutes + + sensor_forecast_minutes // sensor_interval_minutes + + 1, target_key_to_use=self._target_key_name, input_key_to_use="sensor", )