Skip to content

Commit

Permalink
improve error (#438)
Browse files Browse the repository at this point in the history
* improve error

* Format Python code with Black

Signed-off-by: black <[email protected]>

* Update openstef/tasks/create_components_forecast.py

Co-authored-by: Jan Maarten van Doorn <[email protected]>
Signed-off-by: Frank Kreuwel <[email protected]>

* Format Python code with Black

Signed-off-by: black <[email protected]>

* Update create_components_forecast.py

Signed-off-by: Frank Kreuwel <[email protected]>

---------

Signed-off-by: black <[email protected]>
Signed-off-by: Frank Kreuwel <[email protected]>
Signed-off-by: Frank Kreuwel <[email protected]>
Co-authored-by: Frank Kreuwel <[email protected]>
Co-authored-by: black <[email protected]>
Co-authored-by: Jan Maarten van Doorn <[email protected]>
  • Loading branch information
4 people authored Mar 1, 2023
1 parent 321d941 commit f45ed1b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions openstef/tasks/create_components_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import pytz
import structlog
import pandas as pd

from openstef.data_classes.prediction_job import PredictionJobDataClass
from openstef.enums import MLModelType
Expand Down Expand Up @@ -93,6 +94,11 @@ def create_components_forecast_task(
# Make forecast for the demand, wind and pv components
forecasts = create_components_forecast_pipeline(pj, input_data, weather_data)

if not isinstance(forecasts.index, pd.core.indexes.datetimes.DatetimeIndex):
raise ValueError(
f"Index is not datetime. Received forecasts:{forecasts.head()}"
)

if forecasts.index.max() < datetime.utcnow().replace(tzinfo=pytz.utc) + timedelta(
hours=30
):
Expand Down

0 comments on commit f45ed1b

Please sign in to comment.