deformed-offering

Weather station scripts

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.
RSS feed for Scripts Updates A RSS Feed is available to help keep you informed on updates to the scripts.

If you find one or more of the scripts useful to you, please consider making a donation to help offset the routine expenses of operation of this website.
Thanks for your kind support!

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 Thursday, 13-Oct-2016 12:40 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.

000
FXUS66 KMTR 231133
AFDMTR

Area Forecast Discussion
National Weather Service San Francisco Bay Area
333 AM PST Thu Feb 23 2017

.SYNOPSIS...A few lingering showers will be possible again today,
mainly near the coast, although any rainfall amounts should be
very light. Otherwise, drier and cooler conditions are forecast
through Friday with chilly overnight temperatures. Unsettled
weather conditions return by the weekend with another storm system
approaching the coast.

&&

.DISCUSSION...as of 3:03 AM PST Wednesday...KMUX radar scans
continue so show a few showers over the coastal waters, but a few
have also moved over Monterey County. A brief shower moved over
the weather office here in Monterey about an hour ago and
actually tipped the bucket. Automated temperature gauges in Big
Sur indicate readings in the upper 20s to the mid 30s, thus
showers that are occuring in these areas could very well be snow.
Expect activity to continue to diminish this morning. Otherwise,
mostly clear to partly cloudy skies are allowing temperatures to
be cooler than yesterday with morning lows expected to be in the
30s in many locations. Patchy frost is a definite possibility
especially for sheltered spots in the North and East Bay.

A weak ridge of high pressure will build off the coast today and
Friday which will result in cool but mostly dry weather. Daytime
highs will mostly be in the 50s with lows in the 30s to lower 40s
again for Friday morning. Coldest spots in our CWA will drop into
the upper 20s by Friday morning.

Rain will return during the weekend as low pressure systems drop
south from the Gulf of Alaska along the coast and possibly
interact with another low pressure system moving eastward towards
the coast. Latest model guidance continues to vary regarding the
amount of subtropical moisture that can get caught up into these
systems in time to impact our district. The GFS is currently the
least aggressive and only brings two bouts of showers across on
Saturday, with a second system sweeping south along the coast on
Sunday, with the subtropical moisture tap hitting the coast near
Los Angeles. The ECMWF takes the first low farther west and does
pick up some of the moisture before moving inland over the Central
Coast, with the second low moving south across the area late
Sunday into Monday. The Canadian model is probably the most
bullish of the three regarding potential precip amounts, but it
skirts the upper low even farther west of the coast before it
swoops inland late Sunday. So, kept the forecast as it was for the
most part with showers late Friday through the weekend, tapering
off late Monday. Still a lot of uncertainty with this.

After the upper trough moves east, all three models build an upper
ridge over the eastern Pacific and onto the coast by the middle of
next week ushering in a warming and drying trend through 240
hours. We could certainly use a break.

&&

.AVIATION...As of 3:30 AM PST Thursday...For 12z Tafs. Current
KMUX radar shows popcorn-type showers, mainly offshore, drifting
from northwest to southeast. These light showers should remain
mainly offshore, but could affect Monterey Bay terminals, and end
later this morning. Otherwise, only a few low-to-mid level clouds
through the day, with VFR conditions prevailing. Onshore winds
will not be quite as strong today as yesterday, but could
occasionally be gusty this afternoon, 10-15 kt with gusts up to 20
kt possible. Moderate to high confidence with this forecast.

Vicinity of KSFO...VFR. Moderate west/northwest winds,
occasionally gusty this afternoon.

SFO Bridge Approach...Similar to SFO.

Monterey Bay Terminals...VFR. A brief shower or two possible through
the morning hours, especially for KMRY. However, not mentioned in
tafs. Shower chances end by late morning. Moderate onshore winds,
with occasional gusts up to 20 kt possible in the afternoon.

&&

.MARINE...as of 2:06 AM PST Thursday...Moderate northwesterly
winds will continue through the day today and should gradually
weaken by Friday morning. Winds will then shift out of the south
on Saturday as two different storm systems approach the area.
There is still some uncertainty of how winds and seas will
respond to these systems. Latest forecast models show only
moderate winds and seas this weekend with periods of showers
likely. This will be closely monitored over the next couple of
days as new data come in.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tday...SCA...Mry Bay
             SCA...Pt Arena to Pt Reyes 0-10 nm
             SCA...Pt Reyes to Pigeon Pt 0-10 nm
             SCA...Pigeon Pt to Pt Pinos 0-10 nm
             SCA...Pt Pinos to Pt Piedras Blancas 0-10 nm
             SCA...Pigeon Pt to Pt Piedras Blancas 10-60 nm
             SCA...Pt Arena to Pigeon Pt 10-60 nm

&&

$$

PUBLIC FORECAST: Sims
AVIATION: BAM
MARINE: BAM


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:

  1. Browse to www.weather.gov
  2. Use the search box on the left to search for your city, state
  3. Look at the URL in the 'Forecast Discussion' link near the bottom of the page
  4. Use the 3-character abbreviation is in the &issuedby=XXX parameter on the Forecast Discussion link (XXX will be your local office)
  5. 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.05 - 31-Mar-2015 see history).

PHP for NWS CPC USA Extremes

This script was originated by Michael of Relayweather.com and has been rewritten to use the NWS Climate Prediction Center's One Day Old Daily Data Summary text file for the USA. 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 four variables:

$usahigh - contains the text of the high temperature station(s) (value and station name from the NWS)
$usalow - contains the text of the low temperature station(s) (value and station name from the NWS)
$usaprecip - contains the text of the high precipitation station(s) (value and station name from the NWS)
$reportDate - contains the text of the date for the report (default format is 'Dayname, Month day, Year')

You can run the script by using:

<?php
include_once("usaextremes.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 courtsey of <a href=\"";
print "http://www.cpc.noaa.gov/products/analysis_monitoring/cdus/prcp_temp_tables/";
print "\">NWS-CPC</a></small></p>\n";

?>

which produces this result (with live data):

USA Extremes for Wednesday, February 22, 2017

High Temperature

98°F at Mcallen/Miller Intl, TX

Low Temperature

0°F at Yellowstone (ramos), WY

High Precipatation

2.85in at Cocoa Beach/Patrick Af, FL

Data courtsey 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.

// Site to Parse
$url2 = "http://www.cpc.noaa.gov/products/analysis_monitoring/cdus/prcp_temp_tables/dly_glob1.txt";
// Name of cache file  --  This file must be set to CHMOD-666
$cacheFileDir = './'; // directory to store cache file in.
$cacheFile2 = "usaextremesCache4.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 = '&deg;F'; // or ='' for no temperature unit display
$rUOM = 'in';     // or ='' for no rain unit display
$ignoreStations = array('99NRB'); // Station numbers to ignore, Array of station numbers

NWS CPC One Day Extremes PHP script Download (4.03 - 13-Oct-2016 see history).

deformed-offering