Online Forecast Display

Version 1.60 - FINAL (Upgrade)
Jordan Gerth
July 15, 2007

The scripts provided in this package allow a web server to render a horizontal or vertical table with relevant images and key information based on a parsed plain text forecast generated from WX-SIM and uploaded to a web server.  Graphics are included that were developed by a third-party not affiliated with the author and are in the public domain.  Webmasters may opt to use a different set of graphics.  Table colors can also be customized at the discretion of the webmaster.

Version 1.12 is the first final release.  Any release after 1.12 is an upgrade.  Prior releases were for testing purposes.  Please upgrade to 1.60 and make sure the requirements are satisfied before requesting support.

A web server with PHP 4.0 or greater installed and 300 kB of disk space available.

You should read this page entirely before you download. (
wsofd.php, config.php, horizontal.php, vertical.php, textonly.php, icongen.php, precipamt.txt, and wxtypedata.txt; these components are required, also these instructions) (unless you already have a set of images and up/down arrows, in which case wxtypedata.txt will need to be edited to change the names of the image files)

Potential replacement images for tropical climates:
clear-n.png, mostlyclear-n.png, sunny-d.png, mostlysunny-d.png

New in 1.56, 1.57, 1.58, and 1.60

Thank you for the recent donations!  You sustained this release.
Obtain both packages and extract the files within them.  Open config.php with your favorite text editor (WordPad is fine) and adjust the configuration variables to your preference.  A description of each variable exists in config.php.  Take special care entering the server locations.  The scripts will fail if the two text files do not exist or are not readable.  This will be apparent when you attempt to access your forecast page.  
Upload the image files to the directory you defined in the configuration.

Upload wsofd.php, config.php, horizontal.php, vertical.php, textonly.php, icongen.php, precipamt.txt, and wxtypedata.txt to the same directory as the PHP file which will call/use them.  In that file, you should type
'<?php require("wsofd.php"); ?>' before the HTML coding begins (near the top).

Insert horizontal.php into a PHP file to display the horizontal table.  Likewise, insert vertical.php into a PHP file to display the vertical table.  This can be accomplished by using the require function:  '<?php require("horizontal.php"); ?>', for example, or a simple copy and paste to the exact location where you want the table to appear.

Insert textonly.php into a PHP file to display only the text arranged in a table.  This can be used in coordination with the horizontal table.  Use a require statement similar to above.

The precipamt.txt file determines what precipitation amount to use for each range appearing in a forecast period.  The second column (to the right of the exclamation point) can be edited to change the amount displayed per string of text found in the forecast.

The wxtypedata.txt file determines what image matches a forecast period.  The file lines are arranged according to importance (weather first, sky second).  Each term is checked against the entire forecast period text until there is a match.  Once a term is found, the search mechanism stops.  Your adjustments to this file should be made accordingly.  Each line is delimited by exclamation marks.  From left to right, the order of each line is:  search term (in all lower case), day image, night image, image representation, precipitation percentage color.  For example, 'overcast!cloudy-d!cloudy-n!Cloudy!b' will display the cloudy image if the word 'overcast' is found in the forecast period.  In horizontal table view, the word 'Cloudy' will appear beneath the image, as well as for the alternate text in both tables.  If there is precipitation associated with the cloudy verbiage, and GD is enabled to allow for custom image generation, then the percentage will appear on the associated graphic in the color black (l is blue, p is purple, g is green, and r is red).

An example of a PHP file displaying a sample WX-SIM forecast is available.  Problems?  Try example.php on your web server:  download, which also contains a sample plaintext.txt file.

This project has not been coordinated with the developer of WX-SIM.  Changes to the format of the plaintext.txt file are likely to render these scripts useless.

Mailer (PHP 4.3+) - Optional, separate development
Send your text forecast via e-mail in HTML format.

Obtain and extract the included PHP files (txt-mailer.php, which displays similar to how textonly.php appears on a web page, and vim-mailer.php,
which displays similar to how vertical.php appears on a web page) into a local directory.  Rename one you choose to use to mailer.php.  Before uploading, open mailer.php and change the addresses of the recipients at the top of the file, then scroll down to the bottom and change the 'From:' name and address.  You should also modify the '$pwd == "13579"' line such that $pwd will look for another value (change 13579 to a different alphanumeric string).  In order to e-mail the forecast, simply load, where 13579 represents the string that was modified in the previous statement.  This is very simple, primitive security.  It is done is to prevent someone else from calling your mailer.php on a loop and spamming the recipients with forecasts every minute or two.  If your web server has a cron task list available, that may be the best method of loading the mailer.  You may also wish to use Windows task scheduler, but problems will not be supported.

Those who use the mailer should consider an additional donation of USD $5.00, but by no means is required.

These scripts are offered free of charge provided credit is given and you inform Jordan Gerth (via the support e-mail) of the site on which the scripts are used.  However, if you find the scripts useful, you are asked to make a small donation (USD $10.00 to $25.00) to the author (to pay for a good meal or two).  Please use PayPal through the secure link below.  Thank you!

Jordan Gerth can be contacted best via e-mail (remove '_NOSPAM_'), and a reasonable attempt will be made to reply.  However, technical support and maintenance of this package should not be expected due to the author's busy schedule.  When time allows, priority will be given to those who have supported the author, but donations should not be made to induce support.  Support of the WX-SIM program and upload utility is not offered.

Jordan Gerth is employed by the University of Wisconsin's Space Science and Engineering Center to develop new capabilities for the Advanced Weather Information Processing System (AWIPS), which is primarily used by the National Weather Service.  These scripts were developed on private time.

The following link must appear on any web page using any form or version of the scripts offered here:

This table has been made possible using scripts written by Jordan Gerth.  Obtain these scripts for your web site.

This table has been made possible using scripts written by Jordan
Gerth. &nbsp;Obtain <a href="">these
scripts</a> for your web site.

This credit may only be removed after a donation of no less than USD $15.00 through the link above.

USING THESE SCRIPTS WITHOUT CREDIT OR PAYMENT IS A SERIOUS CRIME!  These scripts should not be part of any distribution sold for profit without the expressed written consent of Jordan Gerth.  Distribution between third parties is permitted without monetary exchange, as long as the scripts are in their original form without credit removed.  If any instances of these scripts are found to be in violation of the above agreement, which you consent to upon download, the administrative contact of the domain on which they appear will be liable for no less than USD $5,000.00 in damages, plus profits and attorney fees.

Disclaimer and Exclusion of Liability
Jordan Gerth, in no event or situation, will be liable for direct, indirect, special, incidental, or consequential damages resulting from the use of these scripts, including an improper rendering of the forecast file.  Webmasters should use these scripts at their own risk, and are encouraged to review them prior to installation.  Some states do not allow for the exclusion or limitation of implied warranties or liability for incidental or consequential damages, so the above exclusion or limitation may not apply to you.  This warranty gives you specific legal rights, and you may have other rights which vary from state to state.