Weather Reports
From The Tronically Hip
The weather report on our homepage actually comes from two separate sources.
The original intent was to use the RSS weather feed provided by RSS Weather. However, it was decided that a much cooler approach would be to use data a little closer to home.
Contents |
[edit] UW Weather Station
It turned out that the Civil Engineers at UWaterloo had up some kind of weather apparatus just north of the campus, and all the data was online, being updated on a 15-minute cycle. Not only that, but Frank Seglenieks informed us of a basic XML feed he'd been working on.
But because the UW station is fully automatic, there's no human observer to report sky conditions or make forecasts.
[edit] Environment Canada
The Meteorological Service of Canada publishes pages of conditions and forecasts gathered from airfields all over the country. It looked like the Waterloo Regional Airport data would suit us fine. As an extra bonus, they even include images on a white background!
[edit] The Grab
The EnviroCan page is not basic XML, but it's very thoughtfully laid out, clearly with the intention of being easily scraped. Using the PHP function preg_match and some basic regexes had the relevant information extracted.
But what about the UW Weather Station? We now had the same data also at EnviroCan. The same? No, not quite. But then, the UW server seemed to be down or timed-out a lot of the time. So we use the UWWS data when it's available, and fall back on EnviroCan when it isn't.
[edit] Caching
To speed up page-rendering here and avoid hammering other servers, both of the files are cached locally on a fifteen minute cycle. So the data you're seeing is current within the last quarter-hour. The data for "Sweet Links" is also cached in a similar manner.
Enjoy your weather reports!

