energy_forecast.consumption_forecast module#
- class energy_forecast.consumption_forecast.DayForecast[source]#
Bases:
TypedDict
- end_date: str#
- start_date: str#
- updated_date: str#
- class energy_forecast.consumption_forecast.OneValue[source]#
Bases:
TypedDict
- end_date: str#
- start_date: str#
- value: int#
- class energy_forecast.consumption_forecast.PeakValue[source]#
Bases:
TypedDict
- peak_hour: str#
- temperature: float#
- temperature_deviation: float#
- value: int#
- class energy_forecast.consumption_forecast.PredictionForecast[source]#
Bases:
TypedDict
- weekly_forecasts: list[DayForecast]#
- class energy_forecast.consumption_forecast.PredictionForecastAPI(secret: str | None = None)[source]#
Bases:
RTEAPROAuth2
Access the RTE API to get the weekly forecast of consumption.
- format_weekly_data(json_data: PredictionForecast) DataFrame [source]#
Format the raw data from the API into a DataFrame.
- Parameters:
json_data (PredictionForecast) – The raw data from the API.
- Returns:
pd.DataFrame – The formatted data. The Index is the date of the prediction. Includes the columns:
predicted_consumption: the predicted consumption in MW
predicted_at: the date when the prediction was calculated
- get_short_term_json(start_date: str | Timestamp | None = None, end_date: str | Timestamp | None = None, horizon='3d')[source]#
- get_weekly_forecast(start_date, end_date=None, horizon='1w')[source]#
Retrieve the weekly forecast of consumption.
- Parameters:
start_date (str, Timestamp) – the start date of the forecast.
end_date (str, Timestamp, optional) – the end of the forecast, by default None If None, the forecast is for the next
horizon
.horizon (str, Timedelta, optional) – If
end_date
is none, the duration of the forecast fromstart_date
, by default “1w”
- Returns:
pd.DataFrame – The weekly forecast of consumption.
See also
-
py:meth:get_raw_data
-
py:meth:format_weekly_data
- get_weekly_json(start_date: str | Timestamp | None = None, end_date: str | Timestamp | None = None, horizon='1w') PredictionForecast [source]#
Retrieve the raw data from the API.
- Parameters:
start_date (str, Timestamp) – the start date of the forecast.
end_date (str, Timestamp, optional) – the end of the forecast, by default None If None, the forecast is for the next
horizon
.horizon (str, Timedelta, optional) – If
end_date
is none, the duration of the forecast fromstart_date
, by default “1w”
- Returns:
PredictionForecast – The raw data from the API.
- url_api_short = 'https://digital.iservices.rte-france.com/open_api/consumption/v1/short_term'#
- url_api_weekly = 'https://digital.iservices.rte-france.com/open_api/consumption/v1/weekly_forecasts'#