I recently twisted my ankle and during my recovery I was unable to play for awhile. As I dreamed of playing again, my mind turned to the upcoming football training days that might be rainy and with slippery field conditions. Days like those I would not be able to play, but how many possible days might I miss?
Ahhh, I love Python I said to myself. This would be a perfect opportunity to use Python again. I could use it to create a list of all the football training days and weather conditions for those days.
Since I’ve always checked wunderground.com for weather updates I decided it would be the perfect place to get weather data. From here I would have to find the weather for every day I have football training (Mondays and Thursdays). After finding the weather for those days I would then print them to a HTML document. Here is the final live webpage, yearly football weather.
First I had to create a api key in order to access the weather data, which was rather quite and easy to setup from here Wunderground’s documentation on how to access the data was also straight forward. There’s a nifty api testing tool, apigee, this tool allows you to determine what type of weather data you want to access, in my case it was weather history.
Parsing and Scripting
After retrieving the data I desired, I then wrote a script to firstly determine the days of the week that I would have football on for the current year. From these days I was able to then query the weather data and save the results to a HTML webpage.
The final output
With the generation of the HTML webpage one task was left, styling and adding the weather icons to the webpage. For the weather icons Wunderground again has provided a great set of icon sets to chose from, in my case I went with icon set #9 as it was the cleanest looking one. Here again is the webpage live, yearly football weather.