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 040031 CCA
AFDMTR
AREA FORECAST DISCUSSION...CORRECTED AVIATION TIME
NATIONAL WEATHER SERVICE SAN FRANCISCO BAY AREA
429 PM PST FRI FEB 3 2012
.DISCUSSION...AS OF 2:35 PM PST FRIDAY...PLEASANT WEATHER THROUGH
THE WEEKEND WITH A CHANCE FOR PRECIPITATION EARLY NEXT WEEK.
THE CURRENT 24 HOUR TREND INDICATES THE HIGH CLOUDS HAVE KEPT
TEMPERATURES DOWN THIS AFTERNOON...GENERALLY 2-5 DEGS COOLER THAN THURSDAY.
HOWEVER...IT IS STILL A NICE DAY WITH MANY LOCATIONS IN THE 60S.
AS MENTIONED ON THE PREVIOUS DISCUSSION...THE SFO-WMC GRADIENT WAS
NEAR 10MB...BUT HAS RECENTLY DROPPED TO 7 MB. WINDS WERE BREEZY IN
THE HILLS...BUT HAVE DECREASE SLIGHTLY THIS AFTERNOON AS THE
PRESSURE GRADIENT HAS RELAXED.
SHORT TERM(TONIGHT-MONDAY)...
AN UPPER LEVEL RIDGE OF HIGH PRESSURE WILL BE THE DOMINANT WEATHER
FEATURE OVER THE REGION. THE RESULTING WEATHER WILL BE SLIGHTLY
ABOVE NORMAL DAYTIME TEMPERATURES...IN THE 60S TO LOWER 70S...AND
COOL OVERNIGHT LOWS. OFFSHORE FLOW DEVELOPS ON SUNDAY AND CURRENT
FORECAST IS ABOVE MODEL GUIDANCE...BUT IF OFFSHORE FLOW IS A TAD
STRONGER TEMPERATURES MAY NOT BE WARM ENOUGH. THAT BEING
SAID...WOULD NOT BE SURPRISED IF A FEW PLACES INTERIOR REACH THE
MID-UPPER 70S.
LONG TERM(TUESDAY-FRIDAY)...
THE MAIN FOCUS FOR THE LONG TERM CONTINUES TO BE A BRIEF PATTERN
CHANGE LATE MONDAY NIGHT THROUGH TUESDAY NIGHT. EVEN AFTER THE 12Z
MODEL SUITE CAME IN...MEDIUM RANGE MODELS STILL DO NOT PAINT A
CLEAR PICTURE. THE 12Z ECMWF KEEPS THE APPROACHING UPPER LOW
WEST OF THE COASTLINE AND DROPS IT SOUTHWARD. THE UKMET AND GEM
SHOW SIMILAR SCENARIOS FOR NEXT TUESDAY. THE GFS ON THE OTHER
HAND...DRIVE THE UPPER LOW RIGHT THROUGH THE RIDGE WITH MORE
PRECIP FOR THE CWA. IF THREE TO FOUR WEEKS AGO IS ANY
LESSON...THEN THE ECMWF WILL VERIFY(WESTERLY TRACK) MEANING LESS
OF CHANCE FOR PRECIP. WILL WAIT FOR ONE MORE RUN OF THE MODELS
BEFORE CUTTING PRECIP CHANCES...BUT IF THE TREND CONTINUES PRECIP
IS BEGINNING TO LOOK LESS LIKELY.
THE REST OF THE LONG TERM FEATURES A RE-BUILDING RIDGE WITH
SEASONABLY WARM TEMPERATURES. IF THE BIAS CORRECTED IN HOUSE MODEL
GUIDANCE IS CORRECT THEN WIDESPREAD 70S WILL BE POSSIBLE FOR THE
SECOND HALF OF NEXT WEEK.
&&
.AVIATION...AS OF 4:29 PM PST FRIDAY...INHERITED TAFS LOOK GOOD.
HIGH CONFIDENCE VFR FOR THE PERIOD. ONLY EXCEPTION IS KSTS WHERE
FOG IS POSSIBLE VERY LATE TONIGHT.
VICINITY OF KSFO...VFR.
KSFO BRIDGE APPROACH...VFR.
MONTEREY BAY AREA TERMINALS...VFR.
&&
.MTR WATCHES/WARNINGS/ADVISORIES...
.TNGT...SCA...ROUGH BAR ADVISORY FOR SF BAR FROM 10 PM
&&
$$
PUBLIC FORECAST: MM
AVIATION/MARINE: CANEPA
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).