They're free, but use at your own risk
The scripts 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 weather 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
and saratogaWXPHP Twitter account as they become available.
This page was updated
Tuesday, 31-Jul-2012 10:34 AM
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.
FXUS66 KMTR 230938
AREA FORECAST DISCUSSION
NATIONAL WEATHER SERVICE SAN FRANCISCO BAY AREA
238 AM PDT THU MAY 23 2013
.DISCUSSION...AS OF 2:38 AM PDT THURSDAY...COOL TEMPERATURES AND
BREEZY CONDITIONS ARE EXPECTED ACROSS THE FORECAST AREA ONCE AGAIN
TODAY AS A RESULT OF A LOW PRESSURE SYSTEM CENTERED OVER THE
PACIFIC NORTHWEST. THIS LOW PRESSURE SYSTEM IS ADVECTING COOL
MARINE AIR INTO THE FORECAST AREA AND IS EXPECTED TO LINGER AROUND
THROUGH THE END OF THE WEEK.
AS PREVIOUSLY STATED A LOW PRESSURE SYSTEM IS CENTERED OVER THE
PACIFIC NORTHWEST THIS MORNING. ANOTHER LOW PRESSURE SYSTEM IN
APPARENT ON THE CURRENT SATELLITE WATER VAPOUR IMAGE ENTERING
THE BERING SEA. BOTH THE 0000Z GFS AND ECMWF HAVE INITIALIZED WELL
WITH THESE FEATURES PUSHING THE PACIFIC NORTHWEST LOW NORTHEAST
INTO CANADA SATURDAY. BOTH MODELS CONTINUE TO DEPICT A COOL TROUGHY
PATTERN OVER OUR FORECAST AREA THROUGH THE WEEKEND. BOTH MODELS
THEN INTRODUCE A NEW TROUGH OF LOW PRESSURE MOVING TOWARDS THE WEST
COAST MONDAY BRINGING A POSSIBILITY OF RAIN TO NORTHERN PORTIONS
OF THE FORECAST AREA BY LATE MONDAY MORNING. AT THIS POINT IT LOOKS
LIKE RAIN WILL ARRIVE TO THE NORTH BAY AREA LATE MONDAY MORNING
SPREADING SOUTH TO SAN FRANCISCO BY LATE AFTERNOON AND MONTEREY BY
EARLY EVENING. KEEP IN MIND THAT THIS FORECAST IS STILL SEVERAL
DAYS OUT AND THE TIMING OF THE RAIN MAY CHANGE BY MONDAY. BY MID
WEEK THE FORECAST MODELS ARE DEPICTING A DIRTY RIDGE SCENARIO
WHICH WILL RESULT IN COOL ONSHORE FLOW AND POSSIBLY A SHOWER OR
TWO THROUGH THE END OF THE WORK WEEK.
.AVIATION...AS OF 11:10 PM PDT WEDNESDAY...FOR 06Z TAFS. SOME
CLOUDS ARE SHOWING UP ALONG THE SAN MATEO COAST NEAR KHAF AND
AROUND MONTEREY BAY UNDER STIFF ONSHORE WINDS. CIG HEIGHTS ALONG
THE COAST ARE AROUND 1500-2000 FEET. GUSTY WEST WINDS WILL SLOWLY
EASE OVERNIGHT AND NOT EXPECTING CIGS INSIDE THE BAY BUT SOME
PATCHY CLOUDS POSSIBLE BUMPING UP ON THE EAST BAY HILLS.
VICINITY OF KSFO...VFR SKIES. GUSTY WEST WINDS EASING OVERNIGHT THEN
INCREASING AGAIN THURSDAY AFTERNOON.
KSFO BRIDGE APPROACH...VFR. SIMILAR TO KSFO BUT LIGHTER WINDS.
MONTEREY BAY AREA TERMINALS...SCT-BKN CIGS AT 1500-2000 FT
OVERNIGHT THROUGH 16Z THURSDAY...THEN CLEARING. GUSTY WEST WINDS
THRU THE PERIOD.
.TDAY...SCA...PT ARENA TO PT REYES 0-10 NM UNTIL 3 PM
SCA...PT REYES TO PIGEON PT 0-10 NM UNTIL 3 PM
SCA...PIGEON PT TO PT PINOS 0-10 NM UNTIL 3 PM
SCA...PT PINOS TO PT PIEDRAS BLANCAS 0-10 NM UNTIL 3 PM
SCA...PT ARENA TO PIGEON PT 10-60 NM UNTIL 3 PM
SCA...PIGEON PT TO PT PIEDRAS BLANCAS 10-60 NM UNTIL 3 PM
PUBLIC FORECAST: LARRY
VISIT US AT WWW.WEATHER.GOV/SANFRANCISCO
FOLLOW US ON FACEBOOK, TWITTER, AND YOUTUBE AT:
NWS MTR Office Area Forecast Discussion
To use, include the output of the script on your webpage by using
$doIncludeFD = true;
to perform the include. Settings inside the script are:
// 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
$cacheFileDir = './'; // default cache file directory
// 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::
- Will return the contents without the surrounding <html><head></head><body> and </body></html> tags
- Will override the default $refetchSeconds=1800 so that the cache is refreshed immediately
NWS Area Forecast Discussion PHP script Demo and Download (1.04 - 31-Jul-2012 see history).