Pandas is the best tool available for analyzing timeseries data. The API has a nice tester tool to help when issues arise. If the API returns an error or an empty dictionary it means you likely have a mistake in your arguments. ResponseDict = json.loads(response.read())
Python’s urllib and json libraries make it easy to request the data from the API and convert the response it into a dictionary.
#Pandas python download full
The full list of variables is quite long and it can sometimes be tricky to specify the correct one because of differences between site sources. Use commas to request multiple variables with a single query. For this example I want to request a timeseries of temperature data in Fahrenheit from Seatac airport in Washington for the first week of June 2018 in UTC time. The first step is to put all of our arguments for the JSON query into a dictionary. As demonstrated below, the advantage of Python is not in the query but rather the ability to reformat, clean, and plot the data in just a few lines of code. This can be done in a number of programming languages. So how do we get our hands on this juicy data? After getting an API key, we can write simple API queries to download the data. And speaking of sites, Mesowest has sites from many sources including ASOS, RAWS, HADS, CWOP, USCRN, and SNOTEL.
There are limitless possibilities for using this data–and besides temperature you can also get everything else the sensor records–dew point, wind speed/direction, pressure, and a whole list of other variables depending on the site.
The ease of data acquisition enables cool applications such as showing how the 2017 solar eclipse caused a temperature drop in the middle of the day across nearly the entire US: The launch of the Mesonet API in 2016 made it extremely easy to download years worth of timeseries data from surface sites. Mesowest, a weather data site run by the University of Utah, is one of the best online sources for surface weather data.