WiGLE is a popular platform which can be used for finding the location of a device using the names of WiFi networks in its vicinity. I’ve written about this before, and wrote some Python code to interact with their API. This API has since been retired and replaced with a new one, as of December […]
If you want to know how to design your building you to need to know what the local weather is like. If you want to understand how your building is performing you need to know what weather it was coping with. If you want to install renewable energy – solar panels, wind turbines – you need to know what kind of weather conditions you’ll be able to harness. Weather Underground is a great source of free weather data, aggregating a multitude of independent weather stations all around the world.
I first needed to pull some data from Weather Underground after I found out that the weather station on a university campus down in Cornwall where I’m monitoring a building had been damaged during the construction of another building on the campus. And then I found out the same thing had happened to another building I’m monitoring down there. The problem was I needed months and months of data for two sites, but Weather Underground only seemed to serve up one day at a time. And so was born
You can do some pretty cool things with weather data. This one plots temperature against heating energy use.
And this one plots the wind conditions for a location. Very useful if you’re considering installing a wind turbine. If you or someone you know are interested, Small-Scale Wind Power: A Practical Guide would make a great present – and it’s on offer this Christmas!
After that as a bit of a challenge to improve my non-VBA coding, I thought it might be a nice idea to try and put together a proper web-based API to simplify things a bit . If it gets too much traffic I’ll have to take it down, hobble it, or password protect it – so be gentle!. I don’t want to take real business away from the Wunderground people, but I don’t think there’ll be enough traffic to this site to really worry them.
So, how does it work?
It’s really a very simple API. There are three URL parameters,
enddate. Basically you build your URL as follows:
That downloads you a CSV file containing all the data between the two dates specified. For this example the file will be called
Since my site is currently hosted in the United States (if you’re looking for hosting, check out my affiliate link ), the resulting file comes back with temperatures in Farenheit, rainfall in inches, wind speeds in miles per hour, etc. by default.
I’ll add a parameter to specify whether you want imperial/US or metric data in the future but this will do for now. For metric data just tick the checkbox option.
As well as the API, I’ve also put together a web form that you can use to do the downloading if you’re not minded to use the API directly. It’s as easy as putting in the weather station ID which you can find from here, and the start and end date of the period you want.
 Disclosure: Apparently iPage will pay me for referrals, but I’d recommend them anyway. My partner’s site, Another Voice Translations is also hosted through iPage on my recommendation and that was before I knew about the affiliate programme. They made making the transition from a WordPress blog to a self-hosted site really very simple, and adding the scripting that powers this API was also pretty easy. This site is independently owned and the opinions expressed here are my own.