This is a cross post from my Medium
Public APIs for climate data have become increasingly popular as journalists, academics, researchers, and enthusiasts try to make sense of historical climate data and forecasted climate data in the context of rapidly accelerating climate change.
In addition to academic papers from around the world, the most authoritative data on the subject of climate change comes from the Intergovernmental Panel on Climate Change (IPCC) data. While the IPCC website carries a complete dataset that includes comprehensive results from the numerous experiments and modeling exercises, navigating the site can be a little cumbersome for the uninitiated.
The World Bank Climate API is a great alternative that can be used to obtain broad forecasted statistics by country, for temperature and precipitation. I think this API is a great place for anyone who wants to get started with public climate data APIs and practice putting data sets together and analyzing them to look for basic statistical patterns.
My personal computer needed to be upgraded to Python 3.7 and I thought this would be a great opportunity to write a script that can make accessing data from this API a lot easier to manage, particularly when it comes to accessing the data using a GET method and writing the data to a file whether JSON or CSV.
The script currently allows a user to write the data to a CSV file or JSON file. Since the API supports XML, I may update the code with an XML option as well.
The script can be found here. Happy gathering.