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 251135
AFDMTR

Area Forecast Discussion
National Weather Service San Francisco Bay Area
435 AM PDT Mon Mar 25 2019

.SYNOPSIS...An unsettled weather pattern is expected to persist
through much of the week, with periods of rain forecast from today
through Thursday. Dry weather will likely return by Friday and
Saturday.

&&

.DISCUSSION...As of 2:55 AM PDT Monday...Rain has been slow to
develop early this morning as an incoming frontal boundary
gradually approaches the coast. Latest radar indicates widespread
rainfall should begin to develop in the North Bay within the next
few hours. This is consistent with the latest HRRR which spreads
rain across the North Bay between about 4 am and late morning. Wet
roadways will likely be an issue during the morning commute
across much of the North Bay, but not so in San Francisco or
points south and east of the City. Rainfall is expected to begin
in San Francisco around midday and gradually spread south and east
across the remainder of the SF Bay Area during the afternoon, and
into the Monterey Bay Area this evening. Models indicate the
incoming frontal boundary will produce moderate rain rates in the
North Bay this morning, and also perhaps as far south as San
Francisco and Oakland by early afternoon. But the front is
expected to rapidly weaken as it pushes south of the Golden Gate
and only light rainfall is forecast for the remainder of the
afternoon and evening for areas farther to the south. Rainfall
totals in the North Bay through midnight tonight are forecast to
range from 0.5-1.5". A half inch or less is forecast to accumulate
around San Francisco Bay and in the Santa Cruz Mountains and East
Bay Hills, and less than a quarter inch is expected elsewhere.
Gusty southerly winds are expected to occur just ahead of the
front from mid morning through early afternoon with local gusts up
to 40 mph possible near the ocean and in the hills.

What`s left of the frontal boundary is forecast to stall out along
a line from the Santa Clara Valley southwest to Monterey
tonight. Most shower activity tonight and into Tuesday will
likely be in the vicinity of the stalled front. Both the NAM and
GFS forecast some enhancement along the frontal boundary late
tonight and Tuesday morning as the upper trough offshore begins to
catch up to the surface front. However, the ECMWF completely
washes out the front and forecasts almost no precipitation in our
area from late tonight through Tuesday.

A large upper low currently centered about 800 miles west of the
CA/OR border is forecast to move very slowly to the east over the
next 3 days. As is draws nearer to the coast, a robust shortwave
trough rotating around the low will approach northern California
Tuesday night and produce widespread precipitation across our
area late Tuesday night and Wednesday morning, with scattered
showers continuing into Wednesday afternoon. The airmass over our
area will become increasingly unstable as the low draws nearer and
we may see isolated thunderstorms in our area on Wednesday. Gusty
south to southwest winds are expected late Tuesday night and
Wednesday, with local gusts up to 35 mph possible in coastal and
higher elevation locations.

Shower chances will continue Wednesday night into Thursday,
mainly across the northern portion of our area, as the upper low
finally approaches the Oregon Coast.

Additional rainfall from Tuesday through Thursday is forecast to
range from a half inch to an inch and a half.

Dry weather will likely develop across our entire area by Friday
and persist into at least the first half of next weekend as a
shortwave ridge develops over California. The GFS develops rain in
the North Bay on Sunday as a shortwave trough ripples across far
northern California, but both the ECMWF and Canadian maintain dry
conditions across all areas for the entire weekend.

&&

.AVIATION...As of 04:34 AM PDT Monday...For 12z tafs. VFR
conditions this morning before cigs lower to MVFR into the
afternoon. Cigs then forecast to remain MVFR through much of
tonight. Latest models show showers arriving to the Bay Area
between around 19z-21z. The front is forecast to quickly weaken
once it reaches the Bay Area this afternoon producing lighter
precip into this evening. Shower chances will diminish overnight
with precip lingering a little longer around the Monterey Bay
region. Southerly winds this morning will veer westerly this
afternoon. Southerly winds may become gusty late this morning into
this afternoon around 20-25 kt.

Vicinity of KSFO...VFR into the afternoon with southerly winds.
Gradually lowering cigs becoming MVFR by the afternoon along with
increasing shower chances. Wind gusts 20-25 kt late this morning
before winds gradually shift out of the W/SW this afternoon.
Shower chances will diminish into this evening as the front moves
through.

SFO Bridge Approach...Similar to SFO.

Monterey Bay Terminals...VFR with increasing SE winds down the
Salinas Valley this morning and afternoon. Showers this afternoon
and overnight with lowering cigs. Possible stalling of front
around the Central Coast tonight into tomorrow morning keeping
shower chances in place.

&&

.MARINE...As of 2:11 AM PDT Monday...Southerly winds and rain
will continue through the morning hours ahead of a low pressure
system and cold front. Gusty winds can be expected ahead of the
front. Winds will then gradually become westerly in the wake of
the frontal passage. After a brief break, expect winds to increase
again Tuesday night. Moderate west to northwest swell will
continue through the week.

&&

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

&&

$$

PUBLIC FORECAST: Dykema
AVIATION: AS
MARINE: AS

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, March 24, 2019

High Temperature

89°F at Laredo/Intl, TX

Low Temperature

4°F at Mount Washington, NH

High Precipatation

1.11in at Mount Ida, AR

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