# Python Library
The Meteostat Python library provides a simple programming interface for accessing open weather and climate data. The historical observations and statistics are obtained from Meteostat's bulk data interface and consist of data provided by different public interfaces, most of which are governmental. Among the data sources are national weather services like the National Oceanic and Atmospheric Administration (NOAA) and Germany's national meteorological service (DWD).
The Meteostat Python package is available through PyPI (opens new window):
pip install meteostat
Let's pretend you want to plot temperature data for Vancouver, BC from 2018:
# Import Meteostat library and dependencies from datetime import datetime import matplotlib.pyplot as plt from meteostat import Stations, Daily # Set coordinates of Vancouver lat = 49.2497 lon = -123.1193 # Set time period start = datetime(2018, 1, 1) end = datetime(2018, 12, 31) # Get closest weather station to Vancouver, BC stations = Stations() stations = stations.nearby(lat, lon) stations = stations.inventory('daily', (start, end)) station = stations.fetch(1) # Get daily data for 2018 at the selected weather station data = Daily(station, start, end) data = data.fetch() # Plot line chart including average, minimum and maximum temperature data.plot(y=['tavg', 'tmin', 'tmax']) plt.show()