Fetch Weather and Climate Data with MeteoStat Open-Source Python Library

An easy and robust solution for data science and machine learning applications

Amit Chauhan
3 min readApr 11, 2023
Photo by Alex Chumak on Unsplash

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:

--

--

Amit Chauhan
Amit Chauhan

Written by Amit Chauhan

Data Scientist, AI/ML/DL, Azure Cloud

No responses yet