|
Here's a few companion programs to acquire weather data and do
something useful with it.
Wx is a script to capture localized weather data from Weather.com®
and logs it to your system for historical use. WxReport
presents that raw data and allows simple graphing.
WxPatch is another simple web script that can also acquire the weather data
from Weather.com® and posts a
small "patch" to your web site for at a glance information. Here's a sample.
You can hover your mouse over each element to get the details.
Note that access to Weather.com data
requires signing up with their service - but is free.
Additionally, with a companion script, you can then post-process that data into
various MRTG generated graphics - which tend to be better for examination
of historical data and trends:

Prerequisites
- Installed and operational web server - tested only with IIS on WinXP
- Perl installed and configured to serve CGIs from your web
- <webroot>\cgi-bin folder configured for script execution
- Weather.com sdk installed to <webroot>/Weather folder - this
provides the needed graphics
- Sign up at http://www.weather.com/services/oap.html
for access to weather data and sdk
Download the Perl Script
WxPatch.zip
Containing:
WxPatch.pl
XMLWeather.pm
WeatherParse.pl
WeatherData.cfg
Configure the Script
Manually install WxPatch.pl into <webroot>\cgi-bin folder. The
WxPatch.pl script requires 3 parameters - location code, partner number, and
partnerkey, which you get during your signup process at weather.com. This file is a text
file, so you can edit it with just about anything, notepad for instance.
Manually install XMLWeather.pm into "<path to perl>\site\lib\Geo"
folder.
Testing and Deployment
Point your browser to [typically] http://localhost/cgi-bin/WxPatch.pl
after which you should see the report.
Embed it into any web page with <!--#exec cgi="/cgi-bin/WxPatch.pl"
-->
Constraints
Caching of the data is now implemented in this version. As a result,
this script can be executed more often than once per 2 hours,
which aligns with the refresh rates defined in the Weather XML Data Feed
Implementation Guide. Recognize that the data itself will not be updated
more often than once per 2 hours.
License Agreement
This program is Webware. You may install it, test it for a reasonable
period of time, and even modify it, but if you elect to keep it in use,
whether in original form or in a modified form, you are then obligated to pay
on a scale based on the value you receive from it. You are not allowed to
redistribute any modified copy.
As with other license agreement, this program is supplied as is, and is not
guaranteed free from defects. You assume all risk for problems you may incur
as a result of the use of this program.
|