Can’t Complain About the Weather
As you may have noticed, I now sport the local weather forecast on my sidebar. This is partly a technical “because it’s there,” and partly an artifact of the fact that my former office did not have a window.
The forecast is powered by NOAA’s XML service that I blogged about previously. One of the cool things about the internet is that, in response to my complaints, NOAA’s Director of Internet Services, Bob Bunge, chimed in to say that they were working on my issues. I’d like to thank Bob and especially John Schattel for working with me to iron out the bugs in their service.
Some were quite amusing:
The trouble revolves around our decision to calculate the sunrise and sunset times and base the decision to use “night” when the data time occurs after the sun has set. This logic does not return the correct result in the central time zone at this time of year [mid-winter].
Anyway, it took a while, but it looks like the bugs in their service are mostly squashed. So, despite having moved offices in the interim, I now sport the local forecast on my sidebar.
I’ve gotten a couple of emails asking me how I deal with NOAA’s XML service, so here’s a brief summary.
- NOAA updates the current conditions hourly, at 20 past the hour. I use a (completely trivial) script to retrieve the current conditions and cache them locally.
- The forecasts are updated hourly, at 50 past the hour. The forecast data is retrieved via SOAP and cached using the script described previously.
- To put things together, I run yet another script twice an hour, i.e. after each NOAA update. It parses the aforementioned XML files, using
XML::Simple
, and spits out a file containing an XHTML fragment which I can include in my sidebar. Up to 7 days of forecasts can be produced. I settled for two.
Note that after haranguing NOAA for not using XML tools to assemble their XML, I copped out and generate my XHTML with a few simple-minded print
statements as well. Using XML::Simple
to assemble the desired XHTML document from the data would have been kinda painful. And, hey, nothing else in this sprawling expanse of blogging software does it “right” either.
Re: Can’t Complain About the Weather
Could you check the permissions on the Current and Forecast scripts? Thanks.