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.

413
FXUS66 KMTR 210342
AFDMTR

Area Forecast Discussion
National Weather Service San Francisco Bay Area
842 PM PDT Fri Oct 20 2017

.SYNOPSIS...A warming trend will begin over the weekend and
continue into early next week. Much warmer and drier conditions
are expected to develop by Monday and Tuesday. Slight cooling is
likely during the second half of the week, but temperatures will
remain well above seasonal averages.

&&

.DISCUSSION...As of 8:40 PM PDT Friday...Last night`s rain-
producing cold front ushered a cool airmass into our area today.
High temperatures today were uniformly in the 60s and were as
much as ten degrees cooler than normal. Expect a cool night
tonight, especially in the interior valleys where overnight lows
will drop into the mid and upper 30s. There may be enough low
level moisture remaining for patchy fog to develop late tonight
and early Saturday, particularly in the North Bay Valleys.

A warming trend is anticipated over the weekend, along with
mostly clear skies and dry conditions, as an upper ridge builds
over California and onshore flow gradually weakens. High
temperatures on Saturday are forecast to be about 5 degrees warmer
than today, with another 5-7 degrees of warming then expected for
Sunday. By Sunday, look for widespread highs in the 70s and lower
80s.

Winds are forecast to turn offshore by Sunday night. Based on the
latest WRF model moderate to locally strong north to northeast
winds will develop in the hills by late Sunday night, especially
in the North Bay Hills, but also locally in the East Bay Hills and
Santa Cruz Mountains. Fortunately, last night`s rain has eased
fire weather concerns, at least temporarily, but dry offshore
winds may raise those concerns once again by late Sunday night
(see Fire Weather Discussion below for more details).

The warming trend will ramp up by Monday as the upper ridge
strengthens over California and offshore winds dry out our
airmass. 850 mb temperatures are forecast to climb from about 5
deg C currently to more than 15 deg C by Sunday and then over 20 C
on Monday and Tuesday. Monday and Tuesday look to be the warmest
days next week with widespread highs in the 80s and lower 90s.

The upper ridge is forecast to weaken and retreat offshore
starting around midweek, and this will likely result in modest
cooling during the second half of next week. In any case,
temperatures are expected to remain well above average through
the week ahead.

&&

.AVIATION...As of 4:30 pm PDT for 00Z Saturday TAFs. Satellite
this late afternoon reveals scattered high clouds passing over
the area as well as some post-frontal cumulus clouds over the
hills and mountains surrounding the Bay Area. Expect VFR
conditions to prevail at most TAF sites through the period. Breezy
onshore flow this evening will gradually subside after sunset.

Vicinity of KSFO....Breezy west winds around 15 to 20 kt (with
higher gusts) this evening will gradually diminish after sunset.
VFR conditions expected at the terminal.

SFO Bridge Approach...Similar to KSFO.

Monterey Bay Terminals...VFR conditions generally expected through
the period. Could see some FEW/SCT low clouds overnight at both
KMRY and KSNS, but at this point don`t expect any BKN/OVC low
clouds.

&&

.FIRE WEATHER...As of 8:30 PM PDT Friday...Thursday Night`s rain
was beneficial and 10 hour fuel sticks on area RAWs sites remain
very wet. Even the ERC readings took a pretty good dip to
temporarily mitigate fire weather concerns. General trend for
Saturday and Sunday will be modest warming and drying trend. By
Sunday night there is the potential for another offshore wind
event in the hills, primarily the North Bay Hills, but also
locally in the East Bay Hills and Santa Cruz Mountains. If we
hadn`t received rain on Thursday night, this Sunday night pattern
would be very concerning. However this upcoming moderate offshore
wind event will occur with somewhat higher humidity and with
fuels still on the moist side. We will continue to coordinate with
staff on-site at the Atlas and Tubbs Fires to coordinate if any
Fire Weather Watches or Red Flag Warnings are needed.

A very strong ridge builds Monday through much of next week. This
will bring increased fire weather concerns with above normal
temperatures, low humidity and drying fuels. The upshot is that
fire season will continue despite recent rainfall.

&&

.MARINE...as of 04:21 PM PDT Friday...Generally light winds will
prevail tonight in the wake of a cold front. A large, long period
northwest swell has entered the waters and will gradually taper
down into the weekend, creating hazardous seas for mariners
operating small crafts. Breezy northerly winds return late into
the weekend into early next week.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tngt...SCA...Mry Bay
             SCA...Pigeon Pt to Pt Pinos 0-10 nm
             SCA...Pt Pinos to Pt Piedras Blancas 0-10 nm
             SCA...Pt Arena to Pigeon Pt 10-60 nm
             SCA...Pigeon Pt to Pt Piedras Blancas 10-60 nm
             SCA...Pt Arena to Pt Reyes 0-10 nm
             SCA...Pt Reyes to Pigeon Pt 0-10 nm
             SCA...Rough Bar Advisory for SF Bar
             SCA...SF Bay until 9 PM

&&

$$

PUBLIC FORECAST: Dykema
AVIATION: Rowe
MARINE: DRP
FIRE WEATHER: RWW/Dykema

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 Thursday, October 19, 2017

High Temperature

99°F at El Centro Naf, CA

Low Temperature

14°F at Big Piney Amos, WY

High Precipatation

1.83in at Bremerton Ntnl Awos, WA

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