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 Tuesday, 27-Feb-2018 1:47 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 202042
AFDMTR

Area Forecast Discussion
National Weather Service San Francisco Bay Area
142 PM PDT Sun May 20 2018

.SYNOPSIS...Upper low over California will keep temperatures below
normal at least through Tuesday. Weak ridge builds around midweek
with temperatures near normal before another trough approaches
Friday through Sunday with onshore winds keeping temperatures on
the cool side of normal while mainly dry conditions are forecast.

&&

.DISCUSSION...as of 1:42 PM PDT Sunday...Below normal
temperatures and breezy onshore winds continue to be the main
forecast trend. So far this afternoon temps generally running from
the upper 50s beaches, 60s around the bay and 70s well inland.
Cloud decks are around 2500 feet deep along the coast due to an
upper low over the region. The Ben Lomond RAWS up in the Santa
Cruz mountains is sitting in the cloud layer and so far reporting
a high of only 49 degrees so far this afternoon. Onshore gradient
of 2.5 mb from sfo to sac is pushing some gusty winds from the
Golden Gate out into the Delta with SFO gusting to 33 mph last
hour.

Looking forward the last few nam runs have generated some coastal
drizzle tonight with cyclonic flow aloft and moist onshore flow
lifting the boundary layer. Coastal hills from San Mateo southward
to Monterey that are exposed to nw winds off the ocean is where
the modeling is showing some measurable drizzle type qpf that
should it develop will be localized.

Main forecast theme to start the work week will be continued below
normal temps and breezy onshore winds. The North Bay may see the
most sunshine on Monday with drier north/northeast flow around
the upper low. MOS data showing 79 degrees for Santa Rosa on
Monday while most cities around the Bay will see 60s once again
with some lower 70s for the Santa Clara Valley.

The upper low slowly ejects inland by Tuesday but a deep marine
layer and onshore flow will likely remain in its wake with
continued trend of below normal temps and onshore breezes.

Some weak ridging or zonal type flow develops Weds afternoon into
Thursday sending temps back to near normal.

Longwave trough approaches by Friday afternoon with onshore winds
and approaching upper low sending inland temps back below normal
once again for Saturday and Sunday of the upcoming Memorial Day
weekend. Latest ecmwf does indicate system may be progressive
with warmer high pressure by Memorial Day Monday but that scenario
may be dubious with developing tropical system in the Gulf of
Mexico potentially slowing the large scale west to east flow
across the US.

&&

.AVIATION...As of 10:35 AM PDT Sunday...For 18z TAFs. MVFR
ceilings continue to impact the San Francisco Bay and Monterey Bay
terminals this morning. Should see some partial clearing this
afternoon for the San Francisco Bay terminals with low clouds
likely to remain in place over the Monterey Bay terminals though
much of the day. Onshore winds will also increase and become gusty
at times through the afternoon and evening hours. Low clouds make
an early return once again given the deep marine layer in place
with winds diminishing slightly into Monday morning.

Moderate forecast confidence.

Vicinity of KSFO...MVFR ceilings through at least 20-21z, with
the possibility of only partial clearing this afternoon. Westerly
breezy/gusty winds will continue through the day and evening. Low
MVFR ceilings, if they do scatter out, likely to make early return
late this evening.

SFO Bridge Approach...Similar to KSFO.

Monterey Bay Terminals...MVFR ceilings likely to persist over the
Monterey Bay terminals through the forecast period. Slight chance
of brief clearing at KSNS this afternoon, but confidence is low.
Ceilings may lower to IFR tonight and into early Monday morning.
Breezy onshore winds, occasionally gusty this afternoon and
evening.

&&

.MARINE...as of 01:17 PM PDT Sunday...A strong north to south
pressure gradient along the California coast will maintain
moderate to strong northwesterly winds over  the coastal waters
through Monday. As a result, steep wind waves  will produce
hazardous conditions for small crafts. A long period  southerly
swell will increase and mix with northwesterly swell by  Monday
morning, gradually increasing through much of the week.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tngt...SCA...SF Bay until 9 PM
             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 Reyes to Pigeon Pt 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

&&

$$

PUBLIC FORECAST: RWW
AVIATION: RGass
MARINE: RGass

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 Saturday, May 19, 2018

High Temperature

100°F at Needles Airport, CA

Low Temperature

-15°F at Hot Springs/Ingalls, VA

High Precipatation

5.51in at Wilmington/New Hanover, NC

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