weather_api
frequenz.datasci.weather.weather_api ¤
Module for interacting with the weather API service for fetching historical forecast data.
The module provides a client for the weather API service. The client can be used to retrieve historical weather forecast data for multiple locations and a given time range.
Classes¤
Functions¤
frequenz.datasci.weather.weather_api.fetch_historical_weather_forecasts
async
¤
fetch_historical_weather_forecasts(
*,
service_address: str,
feature_names: list[str],
locations: list[tuple[float, float]],
start_time: datetime,
end_time: datetime,
file_to_store: str = ""
) -> DataFrame
Fetch historical weather forecast data and return a pandas dataframe.
PARAMETER | DESCRIPTION |
---|---|
service_address
|
The address of the service to connect to given in a form of a host followed by a colon and a port.
TYPE:
|
feature_names
|
The list of forecast feature names. Each feature is a string representing a ForecastFeature enum value. |
locations
|
The list of locations to retrieve the forecast data for. Expects location as a tuple of (latitude, longitude) in this order. |
start_time
|
Start of the time range to get weather forecasts for.
TYPE:
|
end_time
|
End of the time range to get weather forecasts for.
TYPE:
|
file_to_store
|
The filename to optionally store the data. The data will be stored in the specified file format. Supported formats are 'csv' and 'parquet'.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
A pandas dataframe containing the historical weather forecast data. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the file format is not supported. |