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 Sunday, 10-Feb-2019 7:10 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 230010
AFDMTR

Area Forecast Discussion
National Weather Service San Francisco Bay Area
510 PM PDT Mon Apr 22 2019

.SYNOPSIS...High pressure will continue to build over the region
resulting in well above normal temperatures through midweek.
Conditions cool slightly late in the week as onshore flow returns
and the ridge of high pressure weakens.

&&

.DISCUSSION...as of 02:39 PM PDT Monday...Mostly sunny conditions
prevail over the region this afternoon as the last patch of
stratus over the Monterey Bay dissipates. This is a result of the
building high pressure aloft and weak offshore flow developing
over the region. Temperatures have already reached into the lower
80s in the North Bay Valleys as warmer, drier air mixes down to
the surface. For tonight, cannot rule out a few low clouds
returning near the Monterey Bay, yet mostly clear conditions are
more likely region-wide.

Much warmer conditions are forecast for Tuesday afternoon as
widespread 80s will be common inland. Cannot rule out interior
valleys of the North Bay, East Bay and portions of the Salinas
Valley reaching into the lower 90s. With the weak offshore pattern
and lack of a marine layer, 70s will be common along the coast with
even lower 80s in locations such as Santa Cruz and Big Sur. These
temperatures are a good 5-10 deg above average at the coast and 10
to as much as 20 deg in the interior. With this said, heat impacts
may reach into moderate levels during the afternoon hours across the
interior valley locations on Tuesday. However, overall risk will be
lower given modest cooling during the overnight hours. Folks
sensitive to heat should plan outdoor activities during the early
morning or late evening hours and avoid extraneous activity during
the peak heating.

The ridge aloft will remain the dominate feature heading into
Wednesday with above average temperatures ongoing, especially
inland. However, the ridge will shift eastward a bit and allow for
weak onshore flow to return to coastal areas. Thus, look for cooling
temperatures near the coast and to a lesser degree over inland areas
as well. Onshore flow will continue to increase late in the week and
result in modest cooling region-wide. Overnight/morning coastal
clouds may even return as early as Wednesday along the coast and
spread further inland later in the week.

The forecast models continue to indicate a mid/upper level low will
develop and approach the southern California coast this upcoming
weekend. This would bring an increase in cloud cover, slightly
cooler temperatures and potential for light precipitation over the
southern portion of the state. While some ensemble members bring
light QPF (around 0.01" of an inch or so) to portions of the Central
Coast, will maintain a dry forecast at this time as widespread
rainfall appears unlikely. Something worth watching nonetheless.

&&

.AVIATION...As of 05:00 PM PDT Monday...for 00Z TAFs. VFR
conditions and clear skies prevail across the region. Light to
moderate onshore winds will gradually diminish later this evening.
Continue to expect the the San Francisco Bay Area terminals to
remain VFR through the night and into Tuesday as the north to
south pressure gradient remains pretty strong, and the boundary
layer air mass relatively dry. On the other hand, do believe
ceilings will develop overnight at the Monterey Bay terminals.

Vicinity of KSFO...VFR conditions are forecast to prevail through
the night and on Tuesday. Moderately strong onshore winds 20 to 25
kt will prevail through around sunset, then progressively
decrease.

SFO Bridge Approach...Same as KSFO.

Monterey Bay Terminals...VFR conditions are expected to prevail
through the evening hours, but latest model output and
statistical guidance indicate likelihood of ceiling development
after around 06Z. Light onshore winds will become light and
variable by mid-evening.


&&

.MARINE...as of 02:57 PM PDT Monday...Moderate winds will prevail
through the evening and into the overnight hours over the coastal
waters as high pressure remains over the eastern Pacific. Winds
will gradually subside on Tuesday, though remaining locally breezy
north of Pigeon Point. Northwest swells are forecast to remain
small over the next several days.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tngt...SCA...Mry Bay until 9 PM
             SCA...Pigeon Pt to Pt Pinos 0-10 nm until 9 PM
             SCA...Pt Arena to Pt Reyes 0-10 nm
             SCA...Pt Arena to Pigeon Pt 10-60 nm
             SCA...Pt Reyes to Pigeon Pt 0-10 nm until 3 AM
             SCA...Pt Pinos to Pt Piedras Blancas 0-10 nm until 3 AM
             SCA...Pigeon Pt to Pt Piedras Blancas 10-60 nm until 3 AM

&&

$$

PUBLIC FORECAST: RGass
AVIATION: Blier
MARINE: Rowe

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.06 - 27-Feb-2018 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 Sunday, April 21, 2019

High Temperature

94°F at Laredo/Intl, TX

Low Temperature

25°F at Leadville, CO
25°F at Truckee-tahoe, CA

High Precipatation

2.39in at Abilene/Dyess Afb, TX

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 = "https://www.cpc.ncep.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.03e - 09-Feb-2019 see history).

deformed-offering