meteostat
meteostat
#
Historical weather from Meteostat station observations.
Backfills a cg.Weather for captures that did not record one. Meteostat
reports raw station units (km/h wind, % humidity, okta cloud cover) and omits
apparent temperature, visibility, and UV entirely.
COCO_CONDITIONS = {1: ('Clear', 'sun.max.fill'), 2: ('Mostly Clear', 'sun.max.fill'), 3: ('Partly Cloudy', 'cloud.sun.fill'), 4: ('Cloudy', 'cloud.fill'), 5: ('Fog', 'cloud.fog.fill'), 6: ('Freezing Fog', 'cloud.fog.fill'), 7: ('Light Rain', 'cloud.drizzle.fill'), 8: ('Rain', 'cloud.rain.fill'), 9: ('Heavy Rain', 'cloud.heavyrain.fill'), 10: ('Freezing Rain', 'cloud.sleet.fill'), 11: ('Heavy Freezing Rain', 'cloud.sleet.fill'), 12: ('Sleet', 'cloud.sleet.fill'), 13: ('Heavy Sleet', 'cloud.sleet.fill'), 14: ('Light Snow', 'cloud.snow.fill'), 15: ('Snow', 'cloud.snow.fill'), 16: ('Heavy Snow', 'cloud.snow.fill'), 17: ('Rain Shower', 'cloud.rain.fill'), 18: ('Heavy Rain Shower', 'cloud.heavyrain.fill'), 19: ('Sleet Shower', 'cloud.sleet.fill'), 20: ('Heavy Sleet Shower', 'cloud.sleet.fill'), 21: ('Snow Shower', 'cloud.snow.fill'), 22: ('Heavy Snow Shower', 'cloud.snow.fill'), 23: ('Lightning', 'cloud.bolt.fill'), 24: ('Hail', 'cloud.hail.fill'), 25: ('Thunderstorm', 'cloud.bolt.rain.fill'), 26: ('Heavy Thunderstorm', 'cloud.bolt.rain.fill'), 27: ('Storm', 'wind')}
module-attribute
#
Each Meteostat condition code as its condition name and SF Symbol.
OKTAS = 8.0
module-attribute
#
The full-sky cloud cover Meteostat's cldc counts eighths of.
UNKNOWN_CONDITION = ('Unknown', 'cloud.fill')
module-attribute
#
What a condition code outside the table reports.
fetch_past_weather(location, when)
#
Fetch the historical weather at a location and time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
Location
|
The place to fetch for, including its altitude. |
required |
when
|
datetime
|
The moment to fetch for (naive is treated as local). |
required |
Returns:
| Type | Description |
|---|---|
Weather
|
A |
Weather
|
does not report come back as |
Raises:
| Type | Description |
|---|---|
ImportError
|
If meteostat is not installed. |
ValueError
|
If no observations cover the location and time. |
Example
Source code in capturegraph-lib/capturegraph/scheduling/forecast/meteostat.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 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 | |