Hourly Weather in Canada¶
The National Office of Climate Services at Environment and Climate Change Canada has a dataset of weather measurements at monthy, daily, or even hourly intervals for almost 9000 weather stations. Check out this example for YEG Christmas 2019.
List of Weather Stations¶
Let’s start by importing and mapping the locations of all of the weather stations.
import pandas as pd
import requests
from io import StringIO
stations_url = 'https://drive.google.com/uc?export=download&id=1egfzGgzUb0RFu_EE5AYFZtsyXPfZ11y2'
stations = pd.read_csv(StringIO(requests.get(stations_url).text), header=3)
stations.drop(columns=['Latitude','Longitude'], inplace=True)
stations.rename(columns={'Latitude (Decimal Degrees)':'Latitude','Longitude (Decimal Degrees)':'Longitude'}, inplace=True)
stations
Name | Province | Climate ID | Station ID | WMO ID | TC ID | Latitude | Longitude | Elevation (m) | First Year | Last Year | HLY First Year | HLY Last Year | DLY First Year | DLY Last Year | MLY First Year | MLY Last Year | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | ACTIVE PASS | BRITISH COLUMBIA | 1010066 | 14 | NaN | NaN | 48.87 | -123.28 | 4.0 | 1984 | 1996 | NaN | NaN | 1984.0 | 1996.0 | 1984.0 | 1996.0 |
1 | ALBERT HEAD | BRITISH COLUMBIA | 1010235 | 15 | NaN | NaN | 48.40 | -123.48 | 17.0 | 1971 | 1995 | NaN | NaN | 1971.0 | 1995.0 | 1971.0 | 1995.0 |
2 | BAMBERTON OCEAN CEMENT | BRITISH COLUMBIA | 1010595 | 16 | NaN | NaN | 48.58 | -123.52 | 85.3 | 1961 | 1980 | NaN | NaN | 1961.0 | 1980.0 | 1961.0 | 1980.0 |
3 | BEAR CREEK | BRITISH COLUMBIA | 1010720 | 17 | NaN | NaN | 48.50 | -124.00 | 350.5 | 1910 | 1971 | NaN | NaN | 1910.0 | 1971.0 | 1910.0 | 1971.0 |
4 | BEAVER LAKE | BRITISH COLUMBIA | 1010774 | 18 | NaN | NaN | 48.50 | -123.35 | 61.0 | 1894 | 1952 | NaN | NaN | 1894.0 | 1952.0 | 1894.0 | 1952.0 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
8761 | WEST ST MODESTE | NEWFOUNDLAND | 8504216 | 6803 | NaN | NaN | 51.60 | -56.70 | 12.2 | 1990 | 2002 | NaN | NaN | 1990.0 | 2002.0 | 1990.0 | 2002.0 |
8762 | WEST ST MODESTE | NEWFOUNDLAND | 8504217 | 6804 | NaN | NaN | 51.58 | -56.72 | 15.2 | 1984 | 1987 | NaN | NaN | 1984.0 | 1987.0 | 1984.0 | 1987.0 |
8763 | CHURCHILL FALLS | NEWFOUNDLAND | 850A131 | 6940 | NaN | NaN | 53.53 | -63.97 | 488.5 | 1993 | 1998 | NaN | NaN | 1993.0 | 1998.0 | 1993.0 | 1998.0 |
8764 | MAKKOVIK (AUT) | NEWFOUNDLAND | 850B5HR | 9025 | NaN | NaN | 55.08 | -59.17 | 71.3 | 1985 | 1986 | 1985.0 | 1986.0 | NaN | NaN | NaN | NaN |
8765 | MARY'S HARBOUR | NEWFOUNDLAND | 850B5R1 | 10227 | 71339.0 | YMH | 52.30 | -55.83 | 11.6 | 1992 | 2014 | 1994.0 | 2014.0 | 1992.0 | 2013.0 | 2005.0 | 2007.0 |
8766 rows × 17 columns
print('This will map will take a minute or two to create with', len(stations), 'weather stations.')
import folium
from folium.plugins import MarkerCluster
latitude = stations['Latitude'].mean()
longitude = stations['Longitude'].mean()
station_map = folium.Map(location=[latitude,longitude], zoom_start=3)
marker_cluster = MarkerCluster()
for row in stations.itertuples():
marker_cluster.add_child(folium.Marker(location=[row.Latitude,row.Longitude], tooltip=row.Name, popup=row._4))
station_map.add_child(marker_cluster)
print('You can zoom, pan, and click to expand markers. Clicking on a marker will display its station ID.')
station_map
This will map will take a minute or two to create with 8766 weather stations.
You can zoom, pan, and click to expand markers. Clicking on a marker will display its station ID.
Make this Notebook Trusted to load map: File -> Trust Notebook