meteostat
meteostat
#
Historical weather from Meteostat station observations.
Backfills a cg.Weather for captures that did not record one: the day's
hourly observations are interpolated to the capture point, the hour nearest
the capture is picked, and its raw station units (km/h wind, % humidity, okta
cloud cover) convert to the canonical weather. Meteostat 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.
NEARBY_STATIONS = 4
module-attribute
#
How many stations around the point the observations interpolate between.
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 |
|---|---|
ValueError
|
If no observations cover the location and time. |