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
Tuesday, 01-Sep-2009 2:15 PM
PHP for NWS Area Forecast 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 110430
AFDMTR
AREA FORECAST DISCUSSION
NATIONAL WEATHER SERVICE SAN FRANCISCO BAY AREA CA
830 PM PST WED MAR 10 2010
.DISCUSSION...AS OF 8:30 PM PST WEDNESDAY...EVEN WITH SUNNY SKIES
TODAY OVER MUCH OF THE FORECAST AREA...TEMPERATURES WERE OVERALL
ONLY SLIGHTLY WARMER THAN YESTERDAY AND AT JUST A FEW LOCATIONS.
HIGHS TODAY RANGED FROM THE 40S IN THE HIGHER TERRAIN TO THE 50S TO
LOWER 60S ELSEWHERE. LOWS WERE IN THE 30S AND 40S. CURRENT SATELLITE
IMAGERY SHOWS MOSTLY CLEAR SKIES OVER THE CWA WITH JUST A FEW HIGH
CLOUDS APPROACHING THE COAST FROM THE NORTHWEST. ONLY MINIMAL PATCHY
FOG FORMATION IS ANTICIPATED OVERNIGHT...MAINLY IN THE NORTH BAY
VALLEYS AS WELL AS THE SOUTHERN SALINAS VALLEY.
WEAK HIGH PRESSURE ALOFT IS PROGGED TO BUILD OVER CALIFORNIA BY
THURSDAY FOR SLIGHTLY WARMER TEMPERATURES. BY FRIDAY AN APPROACHING
LOW PRESSURE SYSTEM IS EXPECTED TO SPREAD RAIN ACROSS THE CWA FROM
NORTH TO SOUTH BEGINNING AS EARLY AS BEFORE DAYBREAK. QPF ESTIMATES
GIVE UP TO 1.5 INCHES TO THE NORTH BAY WITH THE REST OF THE DISTRICT
EXPECTED TO RECEIVE AN INCH OR LESS. THE SYSTEM IS FORECAST TO MOVE
THROUGH QUICKLY AND BE OUT OF OUR AREA BY SATURDAY MORNING. ANOTHER
HIGH PRESSURE RIDGE IS THEN FORECAST TO REBUILD OVER THE WEST COAST
BEGINNING ON SUNDAY KEEPING THE AREA DRY THROUGH THE REMAINDER OF THE
VALID FORECAST PERIOD. A WEAK SYSTEM BRUSHING ACROSS NORTHERN
CALIFORNIA LATE TUESDAY AND WEDNESDAY COULD BRING SOME RAIN TO THE
NORTH BAY...BUT DETAILS ARE SKETCHY AND CONFIDENCE IS LOW.
&&
.AVIATION...AS OF 4:00 PM PST WEDNESDAY...DRY NW FLOW WILL KEEP
VFR CONDITIONS THROUGH THURSDAY. LOCAL IFR/LIFR AT KSTS OVERNIGHT.
VICINITY OF KSFO...VFR CONDITIONS.
KSFO BRIDGE APPROACH...VFR CONDITIONS.
MRY BAY AREA TERMINALS...VFR CONDITIONS.
PROPOSED RULE-MAKING...EFFECTIVE 15Z TUESDAY APRIL 6TH 2010 THE SAN
FRANCISCO BAY AREA OFFICE AT MONTEREY WILL BEGIN 3-HOURLY TAF
ISSUANCES FOR KSFO. THESE INTERMEDIATE TAFS AT 03Z...09Z...15Z...AND
21Z WILL BE ISSUED AS AMENDMENTS TO THE TAFS ISSUED AT 00Z...06Z...
12Z...AND 18Z. THE INTERMEDIATE TAFS WILL BE ISSUED DURING A 20-
MINUTE WINDOW BETWEEN 10 MINUTES BEFORE THE DESIGNATED ISSUANCE HOUR
AND 10 MINUTES AFTER THE HOUR. COMMENTS ON THIS PROPOSED RULE-MAKING
WILL BE ACCEPTED TO MARCH 19TH. COMMENTS CAN BE ADDRESSED TO THE
WEBMASTER AT THE NWS AT MONTEREY AT WWW.WEATHER.GOV/SANFRANCISCO.
&&
.MTR WATCHES/WARNINGS/ADVISORIES...
.TNGT...SCA...PIGEON POINT TO PIEDRAS BLANCAS 0 TO 60 NM.
...ROUGH BAR FOR SF BAR.
&&
$$
PUBLIC FORECAST: SSA
AVIATION/MARINE: 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).