Retrieving weather data

Next, we will retrieve our final data element: the weather. As mentioned earlier, we will use the WeatherUnderground service that allows us to gather historical weather reports for any place in the world. The weather API is REST-based and JSON-based, so we'll use the urllib module to request the data and the JSON library to parse it. Note that in this section, we cache the data locally so that you can run the script offline to test, if need be. Early on in this section is where you place your WeatherUnderground API key that is flagged by the text, YOUR KEY HERE:"Creating weather summary") # Get the bounding box centroid for georeferencing weather data centx = minx + ((maxx-minx)/2) centy = miny + ((maxy-miny)/2) ...

Get Learning Geospatial Analysis with Python - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.