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.
Many of these scripts are now available on GitHub at https://github.com/ktrue
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.
Note: Twitter widget has been disabled 3-Jul-2023 since it no longer displays the recent update Tweets.
This page was updated
Tuesday, 28-Jul-2020 2:45 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.
887
FXUS66 KMTR 111413
AFDMTR
Area Forecast Discussion
National Weather Service San Francisco CA
713 AM PDT Wed Sep 11 2024
...New UPDATE, MARINE...
.SYNOPSIS...
Issued at 120 AM PDT Wed Sep 11 2024
An upper level trough moving into the Pacific Northwest today will
bring breezy winds to the region that will continue into Thursday.
Slightly warmer for Friday, near seasonal averages. Then a second
trough will begin to impact the region bringing chances of
precipitation at times through next week.
&&
.UPDATE...
Issued at 711 AM PDT Wed Sep 11 2024
Clouds this morning have cleared earlier than expected which will
lead to slightly warmer temperatures than what was felt yesterday
due to additional daytime heating. Wind continues to be the big
story of the day with gusts of 30-40 mph already being observed
across multiple stations in the area. The forecast remains on track
with no changes needed at this time.
&&
.SHORT TERM...
(Today and tonight)
Issued at 120 AM PDT Wed Sep 11 2024
A deep upper level trough is currently off of the Pacific Northwest
coast and is progressing southeastward and will move into the
Pacific Northwest by this evening. This will result in breezy
onshore winds late this morning and through the evening hours.
Widespread gusts of 30 mph are expected with gusts of 50+ mph
especially in the gaps, passes, and other favorable spots, namely
the Altamont Pass and the Salinas Valley. However, these speeds fall
short of needing a Wind Advisory but conditions will be monitored
closely.
A reminder from the previous forecaster...
Actions to take:
-Store or secure loose items such as patio furniture, sports
equipment, trampolines, and trash cans.
-Use caution when driving, especially high-profile vehicles.
-Have a plan in case of a power outage.
While the overall fire threat is on a downward trend due to lower
temperatures and higher relative humidities, fuels still remain
critically dry with large fires possible. Therefore, any fire that
starts will have no problem spreading and the strong winds will only
make matters worse. As always, it is imperative to remain vigilant
when it comes to exercising fire safety.
Actions to take:
-Properly discard cigarettes.
-Keep vehicles off of dry grass.
-Avoid activities with open flames or sparks.
-Avoid power equipment that creates sparks.
-Obey burn bans.
Tonight, winds diminish late this evening as the trough axis moves
inland and high pressure builds off of the West Coast. Expecting
northwest flow to remain breezy over the ocean with less widespread
cloud cover overnight. Any clouds will favor the northwest facing
terrain as a result.
&&
.LONG TERM...
(Thursday through Tuesday)
Issued at 120 AM PDT Wed Sep 11 2024
As the aforementioned trough shifts further inland, weak offshore
flow may develop over the Interior North Bay Mountains and East Bay
Hills on Thursday and into Friday morning. However, strong winds
that would reach Red Flag criteria are not expected at this time. A
small amplitude ridge will move in on Friday, bringing temperatures
to near seasonal averages.
Another trough will approach from the north on Saturday and cool
temperatures once again aloft. By Sunday and Monday, there remain
chances for precipitation across the region that will continue at
times through next week. There remains uncertainty with model
divergence in the extended forecast period and therefore there is
lower confidence in the details. However, the confidence is high
that troughing over the region will keep conditions cool for the
next 7-10 days at least. Stay tuned...
&&
.AVIATION...
(12Z TAFS)
Issued at 459 AM PDT Wed Sep 11 2024
Mix of MVFR, LIFR, and VFR conditions this morning. The incoming
upper level low pressure system is disrupting the marine layer and
causing stratus to dissipate earlier than previously expected. Low
to moderate confidence that OAK, SFO, SJC, and LVK will stay VFR
through the remainder of the morning. Patchy MVFR-IFR CIGs are
expected to redevelop at APC before VFR conditions return late
morning. VFR conditions will persist for most sites through the
afternoon/evening before stratus and MVFR CIGs return late this
evening. Gusty west to northwest winds are on track to develop by
early this afternoon and continue through the evening. Sustained
winds will generally be between 15 to 20 knots at most airports with
gusts between 20-25 knots. Locally higher gusts between 25-35 knots
are expected at SFO and OAK.
Vicinity of SFO...Stratus is dissipating earlier than previously
anticipated with low to moderate confidence that SFO will stay clear
of CIGs through the remainder of the morning. Gusty west winds
remain on track for SFO and OAK this afternoon with winds
strengthening by late morning and continuing through the evening.
Guidance indicates sustained winds will be between 20-25 knots with
gusts up to 35 knots. Winds are expected to weaken to 10-15 knots
overnight. Some uncertainty remains on timing of stratus return
tonight. Stratus is currently expected to return closer to 08Z but
ensemble guidance suggests it could return closer to 05Z.
SFO Bridge Approach...Similar to SFO.
Monterey Bay Terminals...Patchy MVFR CIGs are expected to persist
through the late morning. Current satellite observations show
stratus clearing slightly slower in the Monterey Bay Region than
observed in the rest of the Bay Area. However, given the overall
early clearing trend, confidence is low to moderate that CIGs will
clear earlier than currently forecast. Will continue to monitor
satellite observations and adjust the TAFs as needed. VFR conditions
are expected to return by mid to late this morning with stratus
returning early this evening around 00-01Z. Gusty west to northwest
winds remain on track with sustained winds between 10-15 knots and
gusts up to 25 knots expected.
&&
.MARINE...
(Today through Monday)
Issued at 711 AM PDT Wed Sep 11 2024
Widespread gusty north to northwest winds and rough seas continue
over the coastal waters. Significant wave heights will gradually
build to 8 to 10 feet by late Thursday. Gale warnings have been
issued across the inner coastal waters from Pigeon Point to Point
Piedras Blancas and for the Monterey Bay beginning Wednesday
morning and continuing through Wednesday afternoon. Near gale
force gusts to the occasional gale force gust are possible within
the San Francisco Bay and across the inner coastal waters from
Point Reyes to Pigeon Point. Unsettled conditions are expected to
continue through the end of the week, but winds and wave heights
reduce by the late weekend.
&&
.MTR WATCHES/WARNINGS/ADVISORIES...
CA...None.
PZ...Small Craft Advisory from 3 PM this afternoon to 3 AM PDT
Thursday for SF Bay N of Bay Bridge.
Small Craft Advisory until 3 PM PDT this afternoon for Mry Bay-
Pigeon Pt to Pt Pinos 0-10 nm.
Gale Warning from 3 PM this afternoon to 9 PM PDT this evening
for Mry Bay-Pigeon Pt to Pt Pinos 0-10 nm.
Small Craft Advisory until 9 PM PDT Thursday for Pigeon Pt to Pt
Pinos 10-60 NM-Pt Arena to Pt Reyes 0-10 nm.
Small Craft Advisory until 9 AM PDT Thursday for Pt Reyes to
Pigeon Pt 0-10 nm.
Small Craft Advisory until 9 AM PDT this morning for Pt Pinos to
Pt Piedras Blancas 0-10 nm.
Gale Warning until 9 PM PDT this evening for Pt Pinos to Pt
Piedras Blancas 0-10 nm.
Small Craft Advisory until 3 PM PDT this afternoon for Pt Arena
to Pt Reyes 10-60 NM.
Small Craft Advisory from 3 AM to 9 PM PDT Thursday for Pt Arena
to Pt Reyes 10-60 NM.
&&
$$
SHORT TERM...RGass
LONG TERM....RGass
AVIATION...Kennedy
MARINE...Kennedy
Visit us at www.weather.gov/sanfrancisco
Follow us on Facebook, Twitter, and YouTube at:
www.facebook.com/nwsbayarea
www.twitter.com/nwsbayarea
www.youtube.com/nwsbayarea
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
$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::
- 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 (1.06 - 27-Feb-2018 see history).
PHP for NWS CPC World Extremes
This script was originated by Michael of Relayweather.com and has been rewritten to use the NWS Climate Prediction Center's CSV file for world observations. The script does not produce output (other than HTML comments for status), so you are free to include it in a page, and format the text output as you desire. The script returns data in variables:
$omittedCountry (text list of countries excluded from $world high/low/precip scans)
Note: the setting $ignoreCountrys is the array of country names to to exclude
$worldhigh
$worldlow
$worldprecip
$selectedCountry (setting: country name for selected country high/low/precip)
Note: run http://your.site.com/worldextremes.php?list to see the list of country names to use
$countryhigh
$countrylow
$countryprecip
$usahigh (Note: for lower-48 USA states)
$usalow (Note: for lower-48 USA states)
$usaprecip (Note: for lower-48 USA states)
$selectedState (setting: USA state 2-character name abbreviation in settings area)
$selectState (a copy of $selectedState for compatibility with old stateextremes.php)
$statehigh
$statelow
$stateprecip
$reportDate (nicely formatted date of the report)
$stateReportDate (a copy of $reportDate for compatibility with old stateextremes.php)
You can run the script by using:
<?php
include_once("worldextremes.php");
print "<p>USA Extremes for $reportDate</p>\n";
print "<p>High Temperature<br/><br/>$usahigh</p>\n";
print "<p>Low Temperature<br/><br/>$usalow</p>\n";
print "<p>High Precipatation<br/><br/>$usaprecip</p>\n";
print "<p><small>Data courtesy of <a href=\"";
print "https://www.cpc.ncep.noaa.gov/products/cadb/";
print "\">NWS-CPC</a></small></p>\n";
?>
which produces this result (with live data):
USA Extremes for Tuesday, September 10, 2024
High Temperature
114°F at El Centro Naf, CA
Low Temperature
24°F at Marion Municipal Ap, IN
High Precipatation
4.96in at Bay Bridge Airport, MD
Data courtesy of NWS-CPC
The script has internal settings which you can adjust. If run in a Saratoga template, the cache file will be stored in the ./cache/ directory based on $SITE['cacheFileDir'] in Settings.php.
$cacheFileDir = './'; // directory to store cache file in.
$cacheFile2 = "worldextremesCache.txt";
// Age of cache file before re-fetch caching time, in seconds (3600 = 1 hour)
$cache_life = '3600';
$reportDateFormat = "l, F j, Y"; // Day, Month d, yyyy
$tUOM = '°F'; // or ='' for no temperature unit display (display in C is default)
$rUOM = 'in'; // or ='' for no rain unit display (display in mm is default)
#
$ignoreCountrys = array('Antarctica','Greenland'); // for world extremes - exclude these country(s)
$ignoreStations = array('99KLRJ'); // list of stn_id (field 0) to ignore for bogus data
$tempDiffAllowed = 40; // max difference Tmax-Tmin (C) for valid data
$selectedCountry = 'Canada'; // for country max/min/precip in $country* variables
// note: the $usa* variables will have the min/max/precip for the lower-48 states
$selectedState = 'CA'; // for USA state max/min/precip in $state* variables
Note that $cacheFileDir, $tUOM, $rUOM will use the Saratoga template Settings.php values if used in a Saratoga template.
NWS CPC One Day Extremes PHP script Download (5.04 - 28-Jul-2020 see history).