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 , Weather-Watch, and Ambient forums as they become available.
This page was updated
Monday, 31-Dec-2007 2:53 PM
PHP Scripts (run on webserver)
These scripts have run on PHP 4.1.2, and PHP 4.4.1. I don't have access to PHP 3.x, so it is not known if they will work on versions below PHP 4.1.2. If you try them and they work (or not) on earlier versions of PHP, please send me a message at webmaster[at]saratoga-weather.org and let me know the results.
Great PHP scripts from others...
I've used several scripts from other folks and they have my greatful thanks for sharing their developments! Here are the links:
PHP for NWS Area Forecast Area 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 272204
AFDMTR
AREA FORECAST DISCUSSION
NATIONAL WEATHER SERVICE SAN FRANCISCO BAY AREA CA
304 PM PDT WED AUG 27 2008
.DISCUSSION...AS OF 2:40 PM PDT WEDNESDAY...SKIES ARE CLEAR ACROSS
THE DISTRICT...EXCEPT FOR THE COAST SOUTH OF SANTA CRUZ WHERE THERE
IS A SHALLOW LAYER OF FOG. IN FACT...IT IS SO SHALLOW THAT THERE IS
BARELY A HINT OF A MARINE LAYER PER THE FT ORD PROFILER. PER THE FT
ORD PROFILER IT LOOKS LIKE 850 MB TEMPS ARE NEAR 24-25C.
TEMPS THIS AFTN ARE SIGNIFICANTLY WARMER THAN YESTERDAY...AS MUCH
AS 15 DEGREES WARMER IN DOWNTOWN SAN FRANCISCO WHERE IT IS CURRENTLY
86 DEGREES. TEMPS ARE IN THE 70S AND 80S ALONG THE COAST AND BAYS
TO THE 90S INLAND. THE GRADIENT BETWEEN ARCATA-SFO IS NORTHERLY NOW
UP TO 7.5 MB WHILE THE SFO-SAC GRADIENT IS AT 1.3 MB. THE SFO-SANTA
MARIA GRADIENT IS SOUTHERLY AT 1.2 MB.
THE WILD CARD IS THE SHALLOW STRATUS LAYER STRETCHING FROM JUST
SOUTH OF SANTA CRUZ SOUTHWARD ALONG THE COAST. OVER THE LAST HOUR IT
SEEMS THAT IT HAS HALTED ITS NORTHERLY MOTION. SINCE THE MODELS DID
NOT INITIALIZE THE STRATUS...IT ISN`T GOING TO BE ABLE TO FORECAST
ITS MOVEMENT. BEST ESTIMATE IS THAT THE OFFSHORE FLOW SHOULD
STRENGTHEN OVERNIGHT...PUSHING THE STRATUS SOUTH. THE RIDGE IS AT
ITS STRONGEST ON THURSDAY WITH OFFSHORE FLOW AND 850 MB TEMPS
RANGING FROM 28-30C. THIS SHOULD BRING TEMPS INTO THE 70S AND 80S
ALONG THE COAST...90S ALONG THE BAYS...AND WELL OVER 100 INLAND. IF
THE STRATUS DOES MOVE NORTH THEN TEMPS WILL BE SIGNIFICANTLY COOLER
ALONG THE COAST. VARIOUS HEAT ADVISORIES HAVE BEEN ISSUED (PLEASE SEE
SFONPWMTR OR WMO HEADER WWUS76 KMTR FOR DETAILS). THE RIDGE BREAKS
DOWN SLOWLY ON FRIDAY FOR SOME COOLING...MAINLY NEAR THE COAST.
A TROF WILL DEEPEN ALONG THE COAST OVER THE WEEKEND FOR SIGNIFICANTLY
COOLER TEMPERATURES. HIGH PRESSURE BUILDS BACK IN ON MONDAY AND
TUESDAY FOR ANOTHER POSSIBLE OFFSHORE EVENT...BUT THERE ARE TIMING
DIFFERENCES BETWEEN THE MODELS. ANOTHER TROF WILL BRING COOLING
TEMPS THE MIDDLE OF NEXT WEEK...BEFORE ANOTHER POSSIBLE OFFSHORE
EVENT NEXT FRIDAY.
&&
.FIRE WEATHER...AS OF 2:55 PM PDT WEDNESDAY...THE RED FLAG WARNINGS
FOR THE NORTH AND EAST BAY HILLS WILL BE EXTENDED THROUGH 8 AM
FRIDAY.
THE NAM12 IS INDC NORTHEAST WINDS UP TO 20-30 KT IN THE NORTH AND
EAST BAY HILLS TONIGHT INTO THURSDAY MORNING...WITH WINDS DECREASING
THURSDAY. WINDS WILL PICK UP AGAIN THURSDAY NIGHT INTO FRIDAY MORNING
WITH THE RED FLAG WARNING EXTENDED THROUGH 8 AM FRIDAY. AS WAS
STATED IN THE PREVIOUS DISCUSSION...THE LATEST MODEL SOLUTIONS ARE
NOW MORE IN LINE WITH A TYPICAL OFFSHORE WIND EVENT FOR THE NORTH AND
EAST BAY HILLS ALTHOUGH IT IS BY NO MEANS AN EXTREME WIND EVENT.
WILL HAVE TO WATCH FOR ANOTHER POTENTIAL OFFSHORE WIND EVENT WITH THE
GFS40 BRINGING 30 KNOT NORTHEAST WINDS BY LABOR DAY MORNING TO THE
NORTH AND EAST BAY HILLS.
&&
.AVIATION...AS OF 10:35 AM PDT WEDNESDAY...CLEAR SKIES AND GOOD
VISIBILITIES OVER ALL AREA TERMINALS THIS MORNING AS AN UPPER-LEVEL
RIDGE OF HIGH PRESSURE BUILDS IN OVER THE WEST COAST. WINDS NEAR THE
SURFACE ARE BECOMING MORE NORTHERLY AND FURTHER ALOFT MORE
NORTHEASTERLY...WHICH WILL HELP KEEP THE REGION FREE OF ANY LOW
CLOUDS. THE ONLY HINT OF ANY CLOUDS ARE ALONG THE BIG SUR COASTLINE.
THIS IS A WEAK SOUTHERLY SURGE TRYING TO MAKE ITS WAY UP INTO MRY
BAY...BUT IT APPEARS TO BE FALLING APART AND AM NOT EXPECTING ANY
STRATUS TO MOVE INTO MRY BAY AREA. SO...BASICALLY CLEAR SKIES THROUGH
THE NEXT 24 HOURS AND GENERALLY LIGHT VARIABLE WINDS AT THE
SURFACE...EXCEPT AT NEAR-COAST TERMINALS WHICH WILL SEE A SLIGHT
AFTERNOON SEA-BREEZE. LOOK FOR KSFO WINDS TO BECOME WNWLY BY LATE
THIS AFTERNOON (~23 Z) WITH GUSTS UP TO 20-22 KNOTS.
&&
.MTR WATCHES/WARNINGS/ADVISORIES...
.TNGT..SCA...PT ARENA TO PIGEON PT 20-60 NM
PT ARENA TO POINT REYES 0-20 NM
.RED FLAG WARNING FOR THE NORTH BAY AND EAST BAY HILLS
(ZONES 507 AND 511) UNTIL 8 AM FRIDAY.
.HEAT ADVISORY FOR SAN FRANCISCO...SAN FRANCISCO BAY
SHORELINE...EAST BAY INTERIOR VALLEYS...AND THE SANTA
CLARA VALLEY FROM NOON THRU 8 PM THURSDAY.
.HEAT ADVISORY FOR THE SANTA CLARA VALLEY FROM NOON
THROUGH 8 PM FRIDAY.
$$
PUBLIC FORECAST: MHS
AVIATION/MARINE: TENTINGER
FIRE WEATHER: R WALBRUN/MHS/LARRY
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).