openmeteo
openmeteo
#
Hourly weather forecasts from Open-Meteo (free, no API key).
CACHE_EXPIRY_SECONDS = 3600
module-attribute
#
How long a fetched forecast stays fresh in the HTTP cache.
HOURLY_VARIABLES = ('temperature_2m', 'apparent_temperature', 'dew_point_2m', 'relative_humidity_2m', 'pressure_msl', 'wind_speed_10m', 'wind_gusts_10m', 'wind_direction_10m', 'cloud_cover', 'precipitation', 'visibility', 'uv_index', 'is_day', 'weather_code')
module-attribute
#
The Open-Meteo hourly variables requested, in response order.
UNKNOWN_CONDITION = ('Unknown', 'cloud.fill')
module-attribute
#
What a WMO code outside the table reports.
WMO_CONDITIONS = {0: ('Clear', 'sun.max.fill'), 1: ('Mainly Clear', 'sun.max.fill'), 2: ('Partly Cloudy', 'cloud.sun.fill'), 3: ('Overcast', 'cloud.fill'), 45: ('Fog', 'cloud.fog.fill'), 48: ('Depositing Rime Fog', 'cloud.fog.fill'), 51: ('Light Drizzle', 'cloud.drizzle.fill'), 53: ('Moderate Drizzle', 'cloud.drizzle.fill'), 55: ('Dense Drizzle', 'cloud.drizzle.fill'), 61: ('Slight Rain', 'cloud.rain.fill'), 63: ('Moderate Rain', 'cloud.rain.fill'), 65: ('Heavy Rain', 'cloud.heavyrain.fill'), 71: ('Slight Snow', 'cloud.snow.fill'), 73: ('Moderate Snow', 'cloud.snow.fill'), 75: ('Heavy Snow', 'cloud.snow.fill'), 77: ('Snow Grains', 'cloud.snow.fill'), 80: ('Slight Rain Showers', 'cloud.rain.fill'), 81: ('Moderate Rain Showers', 'cloud.rain.fill'), 82: ('Violent Rain Showers', 'cloud.heavyrain.fill'), 85: ('Slight Snow Showers', 'cloud.snow.fill'), 86: ('Heavy Snow Showers', 'cloud.snow.fill'), 95: ('Thunderstorm', 'cloud.bolt.rain.fill'), 96: ('Thunderstorm with Slight Hail', 'cloud.bolt.rain.fill'), 99: ('Thunderstorm with Heavy Hail', 'cloud.bolt.rain.fill')}
module-attribute
#
Each WMO weather code as its condition name and SF Symbol.
default_cache_path()
#
Where Open-Meteo responses are cached when no path is given.
Source code in capturegraph-lib/capturegraph/scheduling/forecast/openmeteo.py
hourly_weather(location, days=3, cache_path=None)
#
Fetch an hourly weather forecast from Open-Meteo.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
Location
|
The place to forecast for. |
required |
days
|
int
|
Number of days to forecast (1-16). Defaults to 3. |
3
|
cache_path
|
Path | None
|
Where to cache the HTTP responses. Defaults to [default_cache_path][] under the user's cache directory. |
None
|
Returns:
| Type | Description |
|---|---|
Array[Weather]
|
One |
Raises:
| Type | Description |
|---|---|
ImportError
|
If openmeteo-requests is not installed. |
RuntimeError
|
If the response carries no hourly data. |
Source code in capturegraph-lib/capturegraph/scheduling/forecast/openmeteo.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |