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

Area Forecast Discussion
National Weather Service San Francisco Bay Area
1025 PM PDT Fri Oct 19 2018

.SYNOPSIS...Sunny and warm with a only a few degrees of cooling
through the weekend. More noted cooling to return early next week
as fronts pass to our north with increasing onshore flow and a
cooling airmass. Any light rain from these fronts will likely
stay north of Sonoma county next week while high pressure builds
over southern and Central California by the second half.

&&

.DISCUSSION...as of 9:00 PM PDT Friday...High pressure ridging
across the Pacific Northwest coupled with a thermal trough along
the coast brought clear skies and light offshore flow to the
forecast area today. Afternoon highs rose anywhere from a couple
of degrees along the coast to as much as 11 degrees inland
finishing well above normal for this time of year. Coastal area
reached into the 60s with mid to upper 70s around the Bay. Inland
areas reached well into the 80s with a few 90s over the warmest
inland areas.

Latest satellite imagery depicts mainly clear skies across inland
areas this evening with widespread low clouds spread across the
coastal waters from the California/Oregon border to south of
Pigeon Point. As the night progresses low clouds will fill in
along the coast and locally inland through coastal gaps and
valleys with patchy dense fog possible. The marine layer stands at
approximately 800 feet at this hour with little change expected.
High pressure ridging across Northern California and into the
Great Basin will maintain a compressed marine layer and as well as
light offshore flow. The combination of the two will keep status
confined mainly to the coast with limited inland intrusion
overnight. The gradient from WMC to SFO continues to trend
stronger and is currently 9.5 MB while the onshore gradient from
SFO to SAC remains weak at 0.5 MB.

The forecast remains on track. No updated expected.

From previous discussion...The upper level high pressure ridge
over California will maintain warm conditions through Saturday
with a gradual cooling trend beginning on Sunday and persisting
through midweek as low pressure systems move across the Pacific
Northwest. Latest model guidance keeps all rain chances north of
our CWA through the forecast period, though.

Another ridge is forecast to approach California from the Eastern
Pacific late in the week ushering in another warming trend by next
weekend. The latest run of the ECMWF hints at another upper
trough possibly affecting Northern California by the end of the
month...we`ll see, although climatologically, this timing checks
out.

&&

.AVIATION...as of 10:25 PM PDT Friday...For 06z tafs. A shallow
marine layer remains in place as satellite imagery shows low
clouds along the coast beginning to move inland locally. VFR
conditions forecast through the period at this time aside from
patchy fog in the North Bay. Some localized intrusion of low
clouds along the coast may occur and briefly cause MVFR/IFR cigs
at coastal terminals. Satellite will be monitored and tafs will be
amended as needed.

Vicinity of KSFO...VFR with some patchy low clouds possible early
tomorrow morning.

SFO Bridge Approach...Similar to KSFO.

Monterey Bay Terminals...VFR. Patchy low ceilings may return into
tomorrow morning.

&&

.MARINE...as of 08:11 PM PDT Friday...Generally light to locally
breezy northwesterly winds will continue as high pressure over the
Great Basin and the eastern Pacific weakens heading into next
week. Mixed moderate period northwest and southerly swell will
persist before a longer period southerly swell arrives early next
week.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tngt...None.

$$

PUBLIC FORECAST: CW
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 Thursday, October 18, 2018

High Temperature

97°F at New Orleans/Nas, LA

Low Temperature

6°F at Mount Washington, NH

High Precipatation

1.70in at Chillicothe, MO

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