They're free, but use at your own risk
The scripts in PHP and Perl referenced here are used in the operation of this weather station, and may be freely copied and used to support your station. Please note that you use these scripts at your own risk. No warranty is expressed or implied. I accept no liability for any damages that may ensue from their use.
You will need to configure them for your own particular station website.
A RSS Feed is available to help keep you informed on updates to the scripts.
A Version History is available -- check back from time to time to see if there are updates to scripts you have downloaded earlier. Announcements of version updates and new scripts are made on WXForum.net and Weather-Watch forums as they become available.
This page was updated
Monday, 31-Dec-2007 2:53 PM
PHP Scripts (run on webserver)
These scripts have run on PHP 4.1.2, and PHP 4.4.1. I don't have access to PHP 3.x, so it is not known if they will work on versions below PHP 4.1.2. If you try them and they work (or not) on earlier versions of PHP, please send me a message at webmaster[at]saratoga-weather.org and let me know the results.
Great PHP scripts from others...
I've used several scripts from other folks and they have my greatful thanks for sharing their developments! Here are the links:
PHP for NWS Area Forecast Area Discussion
This PHP script will fetch and cache the Forecast Area Discussion issued by your local NWS office.
Thanks to Mike Challis of Long Beach, WA for the inspiration for and enhancement of this script.
000
FXUS66 KMTR 042339
AFDMTR
AREA FORECAST DISCUSSION
NATIONAL WEATHER SERVICE SAN FRANCISCO BAY AREA CA
244 PM PDT SAT JUL 4 2009
.DISCUSSION...AS OF 2:44 PM PDT SATURDAY...THE STRATUS TOOK A LITTLE
LONGER THAN EXPECTED TO SCATTER OUT OVER MONTEREY THIS AFTERNOON BUT
NOW SKIES ARE FINALLY LOOKING MOSTLY CLEAR ACROSS THE CWA. THE
LATEST VISIBLE SATELLITE IMAGE IS SHOWING STRATUS LINGER OFF OF
THE COAST AND IT IS EXPECTED TO RETURN THIS EVENING.
OF COURSE THE BIG CONCERN THIS EVENING IS WHETHER OR NOT THERE
WILL BE LOW CLOUDS TONIGHT FOR THE LOCAL FIRE WORKS DISPLAYS. LOW
CLOUDS ARE EXPECTED TO RETURN TO THE DISTRICT TONIGHT BUT THEY WILL
NOT AFFECT THE SAN FRANCISCO BAY AREA UNTIL AFTER MIDNIGHT.
UNFORTUNATELY...STRATUS IS EXPECTED TO RETURN TO THE MONTEREY BAY
SANTA CRUZ AREA AROUND 8:00 OR 9:00 PM PDT.
CURRENTLY THE WATER VAPOUR IMAGE IS SHOWING A TROUGH OF LOW
PRESSURE OFF OF THE PACIFIC NORTHWEST...CENTERED AT ABOUT 140 WEST
AND 43 NORTH. THE MODEL SOLUTIONS HAVE INITIALIZED WELL WITH THIS
FEATURE AND MOVE IT INTO NORTHERN CALIFORNIA AND SOUTHERN OREGON BY
SUNDAY EVENING. AS THE LOW SLIDES INLAND OVER THE PACIFIC NORTHWEST
QUASI ZONAL FLOW MOVES INTO THE CWA. 500MB HEIGHTS ARE PROGGED TO
FALL A BIT WITH THE 1200 UTC GFS SHOWING THE GREATEST COOLING
WEDNESDAY. THE GFS IS FORECASTING 850 MB TEMPERATURES AROUND 14
DEGREES CELSIUS BY WEDNESDAY AFTERNOON WHICH IS 4 DEGREES WARMER THAN
PREVIOUS RUNS.
&&
.AVIATION...AS OF 4:30 PM SATURDAY...MARINE LAYER HAS DEEPENED
TO OVER 2000 FEET WHILE THE ONSHORE FLOW IS A HEALTHY 3.0 MB FROM
SF0-SAC. LATEST VISIBLE SATELLITE SHOWS STRATUS ADVECTING ONTO THE
SAN MATEO COAST FROM THE SOUTHWEST SUGGESTING A SOUTHWEST FLOW
OVER THE SFO BAY AREA. THIS IS ALSO SUPPORTED BY BUOY
REPORTS JUST OFF THE COAST.
VICINITY OF KSFO...SOUTHWESTERLY FLOW SHOULD KEEP CEILINGS OUT
OF KSFO UNTIL AFTER 06Z. BASES BETWEEEN 1200 AND 1500 FEET.
WEST WINDS GUSTING TO 25 KT THROUGH 04Z.
KSFO BRIDGE APPROACH...SOUTHWESTERLY FLOW SHOULD KEEP CEILINGS OUT
OF KSFO UNTIL AFTER 06Z. BASES BETWEEEN 1200 AND 1500 FEET.
MONTEREY BAY TERMINALS...LESS CLOUDS IN THE MRY BAY COMPARED TO
YESTERDAY. SO CLOUDS WILL BE LATER TO RETURN TO MRY AND SNS COMPARED
TO YESTERDAY. EXPECT CEILINGS TO STAY OUT OF SNS UNTIL 04Z AND MRY
UNTIL AFTER 05Z.
&&
.MTR WATCHES/WARNINGS/ADVISORIES...
.TNGT...SCA...SF BAY.
&&
$$
PUBLIC FORECAST: LARRY
AVIATION/MARINE: S ANDERSON/W PI
NWS ON THE WEB AT WEATHER.GOV/SANFRANCISCO
NWS MTR Office Area Forecast Discussion
To use, include the output of the script on your webpage by either using
<?php include("http://your.website.com/forecast-discussion.php?inc=Y"); ?>
or by using
<?php $doIncludeFD = true; include("forecast-discussion.php"); ?>
to perform the include. Settings inside the script are:
// settings:
// change myNWS to abbreviation for your local NWS office
// other settings are optional
//
$myNWS = 'MTR'; // San Francisco, NWS office
// $myNWS = 'PQR'; // Portland, OR
// $myNWS = 'OAX'; // Omaha, NE (Carter Lake, IA)
//
$cacheName = "forecast-discussion.txt"; // used to store the file so we don't have to
// fetch it each time
$refetchSeconds = 1800; // refetch every nnnn seconds
// end of settings
The only required setting is for $myNWS which designates the local NWS office.
To find the 3-character abbreviation for your local NWS office for the $myNWS variable, follow these steps:
- Browse to www.weather.gov
- Use the search box on the left to search for your city, state
- Look at the URL in the 'Forecast Discussion' link near the bottom of the page
- Use the 3-character abbreviation is in the &issuedby=XXX parameter on the
Forecast Discussion link (XXX will be your local office)
- put the XXX in the $myNWS = 'XXX'; statement
The script has two optional parameters when you call it by URL from your website::
- inc=Y
- Will return the contents without the surrounding <html><head></head><body> and </body></html> tags
- cache=no
- Will override the default $refetchSeconds=1800 so that the cache is refreshed immediately
NWS Area Forecast Discussion PHP script Demo and Download (Version 1.02 - 30-Dec-2007 see history).