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
and saratogaWXPHP Twitter account 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 301748
AFDMTR
AREA FORECAST DISCUSSION
NATIONAL WEATHER SERVICE SAN FRANCISCO BAY AREA CA
1048 AM PDT FRI JUL 30 2010
.DISCUSSION...AS OF 8:56 AM PDT FRIDAY...THE MORNING SATELLITE IMAGE
IS SHOWING STRATUS ALONG THE ENTIRE CALIFORNIA COAST. LOCALLY
STRATUS HAS PUSHED INTO ALL OF THE INLAND VALLEYS WITH REDUCED
VISIBILITY BEING REPORTED AROUND THE MONTEREY BAY AREA. ACCORDING
TO THE FORT ORD PROFILER THE MARINE LAYER IS ABOUT 1600 FEET DEEP
AND CLOUD BASES ARE BEING REPORTED AT 600 TO 900 FEET WITH MONTEREY
AIRPORT REPORTING OVERCAST SKIES AT 100 FEET.
FOR THE MOST PART PERSISTENCE WILL BE THE BEST FORECAST WITH LITTLE
CHANGE IN THE OVERALL SYNOPTIC PATTERN EXPECTED. IN THE NEAR TERM
THE ONLY SYNOPTIC FEATURE OF INTEREST IS A TROUGH OF LOW PRESSURE
POSITIONED JUST OFF OF THE NORTHERN CALIFORNIA SOUTH OREGON COAST.
AS THIS FEATURE PUSHES EAST THE MARINE LAYER WILL DEEPEN AND
PUSH STRATUS BACK INTO THE FORECAST AREA. WITH THE DEEPENING
MARINE LAYER COASTAL AREAS CAN EXPECT SOME PATCHY MORNING
DRIZZLE AND FOG. CLEAR SKIES ARE EXPECTED ONCE AGAIN TOMORROW
AFTERNOON. IN FACT THIS PATTERN OF MORNING FOG AND AFTERNOON SUNSHINE
WILL REPEAT BOTH SATURDAY AND SUNDAY.
EXTENDED...AS THE PREVIOUSLY MENTIONED TROUGH OF LOW PRESSURE PASSES
TO THE EAST HIGH PRESSURE WILL BUILD IN OVER THE EASTERN PACIFIC BY
MONDAY. AS HIGH PRESSURE BUILDS 500MB HEIGHTS WILL REACH 590DM AND
850MB TEMPERATURES WILL RISE TO AROUND 24 DEGREES CELSIUS. THIS WILL
RESULT IN A WARM UP FOR THE BEGINNING OF NEXT WEEK WITH TEMPERATURES
CREEPING UP TO NEAR NORMAL VALUES INLAND. AT THIS POINT IT APPEARS
THAT COASTAL LOCATIONS WILL REMAIN RELATIVELY COOL WITH ONSHORE FLOW
EXPECTED TO PERSIST INTO MIDWEEK.
&&
.AVIATION...AS OF 10:48 AM PDT FRIDAY...WIDESPREAD CIGS THIS
MORNING ACROSS THE BAY REGION. THE MARINE LAYER IS SLIGHTLY MORE
COMPRESSED FROM YESTERDAY...CURRENTLY RUNNING AT AROUND 1600 FEET.
OVERALL AN UPPER TROUGH OVER CALIFORNIA AND LITTLE CHANGE IN THAT
FROM YESTERDAY.
VICINITY OF KSFO...IFR CONDITIONS UNTIL AROUND 18Z. ONSHORE WINDS FOR
THE AFTERNOON HOURS WITH GUSTS AS HIGH AS 25 KNOTS.
KSFO BRIDGE APPROACH...IFR CONDITIONS WITH CLEARING EXPECTED
AROUND 1800Z.
MRY BAY AREA TERMINALS...IFR CONDITIONS AND NORTHWEST ONSHORE FLOW
WILL KEEP CLOUDS AND CIGS IN THROUGH 19Z.
&&
.MTR WATCHES/WARNINGS/ADVISORIES...
.TDA...SCA...PT ARENA TO PIGEON PT 10-60 NM.
...SFO BAY.
&&
$$
PUBLIC FORECAST: LARRY
AVIATION/MARINE: SSA
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).