Core forecast functions

This module is here to help fetching forecast data from the Steadysun API

It includes the _ForecastParameters class to model the parameters for the forecast API request, and the get_forecast function to retrieve forecast data as a pandas DataFrame.

steadysun.forecast.get_forecast(site_uuid: str, time_step: int | None = None, horizon: int | None = None, precision: int | None = None, fields: List[str] | None = None, use_timestamp_format: bool = False, time_stamp_unit: Literal['ms', 's'] | None = None) DataFrame

Fetch forecast data for a specific site with given parameters.

See default values and more information about each parameters at: https://steadyweb.steady-sun.com/rapidoc/#get-/forecast/-object_type-/-component_uuid-/

Parameters:
  • site_uuid (str) – The UUID of the site.

  • time_step (Optional[int], optional) – The time step of the forecast (in minutes).

  • horizon (Optional[int], optional) – The horizon of the forecast (in minutes).

  • precision (Optional[int], optional) – Maximal number of decimal places.

  • fields (Optional[List[str]], optional) – The fields to include in the forecast.

  • use_timestamp_format (bool, optional) – Should the timestamp format be used instead of iso_8601 for date.

  • time_stamp_unit (Optional[Literal["ms", "s"]], optional) – The unit of the time stamp (if use_timestamp_format).

Returns:

pd.DataFrame – The forecast data for the specified site.

Raises:

requests.exceptions.HTTPError – If the API request fails.

Example

Fetch forecast data for a specific site with a time step of 30 minutes, a horizon of 2440 minutes, a precision of 4 decimal places, and including the “all_sky_global_horizontal_irradiance” and “2m_temperature”:

forecast_df = get_forecast(
    site_uuid="SITE_UUID",
    time_step=30,
    horizon=2440,
    precision=4,
    fields=["all_sky_global_horizontal_irradiance", "2m_temperature"],
)