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
WXForum.net and
Weather-Watch forums
and saratogaWXPHP Twitter account as they become available.
This page was updated
Friday, 15-Oct-2010 8:28 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.
000
FXUS66 KMTR 161138
AFDMTR
AREA FORECAST DISCUSSION
NATIONAL WEATHER SERVICE SAN FRANCISCO BAY AREA
438 AM PDT WED MAY 16 2012
.DISCUSSION...AS OF 3:15 AM PDT WEDNESDAY...HIGH PRESSURE WAS
CENTERED RIGHT ALONG THE COAST. THE FT ORD PROFILER IS INDC THAT
TEMPS ALOFT HAVE WARMED SIGNIFICANTLY...AS MUCH AS 13C AT 3500 FT
ASL. THE FT ORD PROFILER IS INDC THAT THE MARINE INVERSION IS
AROUND 1200 FT ASL...AND THE LATEST GOES WEST FOG DEPTH IMAGERY IS
INDC THAT THE DEPTH OF THE LOW CLOUDS IS BETWEEN 1000-1100 FT.
TEMPS THIS MORNING RANGE FROM THE 40S AND 50S IN THE MARINE
LAYER...TO THE UPPER 60S ALONG THE HIGHER PEAKS SUCH AS MT
DIABLO...WHICH MATCHES WHAT THE FT ORD PROFILER IS INDC. THE
LATEST GRADIENT PICTURE IS INDC A WEAK NORTHERLY GRADIENT OF 1.2
MB BETWEEN ARCATA-SFO AND A GOOD ONSHORE GRADIENT OF 2.3 MB
BETWEEN SFO-SAC. THIS GOOD ONSHORE GRADIENT HAS ALLOWED LOW CLOUDS
TO SURGE INLAND THIS EARLY MORNING...EVEN INTO THE EAST BAY
VALLEYS SUCH AS LIVERMORE.
TODAY WILL BE ANOTHER TYPICAL LATE SPRING DAY WITH COOL TEMPS
ALONG THE COAST AND WARM TEMPS INLAND. TEMPS WILL BE SIGNIFICANTLY
COOLER ON THURSDAY AS A STRONG...BUT DRY...MID LEVEL TROUGH MOVES
INTO THE DISTRICT. WITH MOST OF THE DEEP MOISTURE REMAINING TO THE
NORTH AND EAST WOULD NOT EXPECT ANY SHOWERS WITH THIS SYSTEM. THE
MARINE LAYER SHOULD MIX OUT THURSDAY AFTN AND EVENING WITH THE
COMBINATION OF COLD AIR ADVECTION AND BREEZY CONDITIONS.
AS THE TROUGH MOVES TO THE EAST A RELATIVELY FLAT RIDGE WILL BUILD
IN FROM THE PACIFIC. THIS WILL RESULT IN A SLOW WARMING TREND
BEGINNING ON FRIDAY AND CONTINUING THROUGH THE WEEKEND. COOLER
TEMPS COULD RETURN THE BEGINNING OF NEXT WEEK AS ANOTHER DRY MID
LEVEL TROUGH MOVES INTO THE DISTRICT.
&&
.AVIATION...AS OF 4:30 AM PDT WEDNESDAY...TYPICAL STRATUS DAY WITH ONSHORE
FLOW AT THE SURFACE AND VERY MINOR FORCING IN THE UPPER LEVELS
AS THE UPPER LEVEL RIDGE MOVES EAST.
VICINITY OF KSFO...IFR CIGS IMPROVING TO MVFR CIGS AFTER 17Z.
CLEARING EXPECTED BY 1830Z WHICH IS IN AGREEMENT WITH THE EARLY
RUNS OF THE CONSENSUS MODELS.
KSFO BRIDGE APPROACH...SIMILAR TO KSFO.
MONTEREY BAY AREA TERMINALS...IFR CIGS CLEARING AFTER 18Z.
&&
.MTR WATCHES/WARNINGS/ADVISORIES...
.TDAY...SCA...PT ARENA TO PT REYES 0-10 NM FROM 3 PM
SCA...PT ARENA TO PIGEON PT 10-60 NM FROM 3 PM
SCA...PT PINOS TO PT PIEDRAS BLANCAS 0-10 NM
SCA...SF BAY FROM 1 PM
SCA...PIGEON PT TO PT PIEDRAS BLANCAS 10-60 NM UNTIL 9 AM
&&
$$
PUBLIC FORECAST: STROBIN
AVIATION/MARINE: W PI
NWS MTR Office Area Forecast Discussion
To use, include the output of the script on your webpage 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).