breos.weather.fetch_weather_data#
- breos.weather.fetch_weather_data(latitude, longitude, start_date, end_date, tilt, azimuth, freq='h', save_to_file=True, location_name=None, output_dir='weather')[source]#
Fetch historical weather data from the Open-Meteo API.
- Parameters:
latitude (
float) – Latitude of the locationlongitude (
float) – Longitude of the locationstart_date (
str) – Start date in format ‘YYYY-MM-DD’end_date (
str) – End date in format ‘YYYY-MM-DD’tilt (
float) – Tilt of the PV panel (degrees)azimuth (
float) – Azimuth of the PV system (0° S, -90° E, 90° W, 180° N)freq (
str) – Output frequency (‘h’ for hourly, ‘15min’ for 15-minute)save_to_file (
bool) – Whether to save the data to CSVlocation_name (
Optional[str]) – Location name for filename (e.g., ‘porto’). If None, uses lat/lon.output_dir (
str) – Directory to save the file (default: ‘weather’)
- Return type:
- Returns:
DataFrame with weather variables
- Raises:
ImportError – If openmeteo_requests is not installed
Note
Responses are cached in a
.cache.sqlitefile created in the current working directory (30-day expiry). Delete it to force fresh API responses.