Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add forecasting horizon in forecast_latest/weather influxDB table #147

Open
maxi-fort opened this issue Apr 30, 2024 · 3 comments
Open

Add forecasting horizon in forecast_latest/weather influxDB table #147

maxi-fort opened this issue Apr 30, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@maxi-fort
Copy link
Collaborator

WHAT:

Currently in openstef-dbc, influxDB schema does not allow to store all weather forecasts with their corresponding forecasting horizon.
openstef-dbc uses weather as standard time series whereas it is not (a particulier "_time" could be present several times in the table since weather forecast are udpated several times a day).

In order to take into account weather forecast uncertainty into quantile regression training (the farer the horizon, the higher the uncertainty), forecasting horizon must be available into the database.

HOW :

  • add a tag "tAhead" in the influxDB table
  • add a new argument in get_weather_data in order to enable filtering in the influxDB query
  • interpolate weather after grouping by "forecast datetime of origin" (datetime_of_origin = _time - timedelta(tAhead, unit = "h")) when datetimeindex does contain duplicats (which means different tAhead exists in the database)
  • return additionnal "horizon" column in the pandas dataframe if tag exists in the db and column is not constant (so that it does not impact openstef feature engineering in that case).

TEST :
Extract weather forecat with tAhead between a range of hours (e.g [0,48])

@maxi-fort maxi-fort added the enhancement New feature or request label Apr 30, 2024
@bartpleiter
Copy link
Collaborator

Hi, we just added code for the first bullet (adding a tAhead tag in the influxDB table)
You can find the changes here: #148

Note that the weather data with tAhead tag is written to a new table so that other implementations/usecases that just need the latest forecasts stay working.

We hope this helped you with the issue/story!

@maxi-fort
Copy link
Collaborator Author

Hi Bart,

In your changes, you added the computation of tAhead :
https://github.com/OpenSTEF/openstef-dbc/blob/00f73180db8374ac33e2722daf94c1fa3bc27f4f/openstef_dbc/services/write.py#L376C9-L381

Your definition of tAhead is the time difference between the forecasted time and the time of insertion into de database.
Therefore, we cannot use this method to write archive forecasts in the database when setting up openstef.

Don't you think it would be better to define tAhead as the time difference between the forecasted time and the time when weather forecast started running ?

@bartpleiter
Copy link
Collaborator

That sounds better indeed. Lets do that instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants