Fetch Weather and Climate Data with MeteoStat Open-Source Python Library
An easy and robust solution for data science and machine learning applications
3 min readApr 11, 2023
Meteostat is an open-source python library for fetching weather and climate data around the globe, the data is based on the open interface from governments.
To install the library in the environment
pip install meteostat
# importing the library
from datetime import datetime
import matplotlib.pyplot as plt
from meteostat import Point, Daily
# setting the start and end time
start = datetime(2023, 1, 1)
end = datetime(2023, 12, 31)
The point method is used to fetch the weather and climate data from any location. The arguments passed in this method are latitude and longitude.
# fetching point data from New Delhi
New_Delhi = Point(28.654667138557485, 77.23127697641567)
# using the start and end date for data
data = Daily(New_Delhi, start, end)
data = data.fetch()
# visualizing the line chart of temperature
data.plot(y=['tavg', 'tmin', 'tmax'])
plt.show()
Output: