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.

000
FXUS66 KMTR 231147
AFDMTR

Area Forecast Discussion
National Weather Service San Francisco Bay Area
447 AM PDT Wed Aug 23 2017

.SYNOPSIS...Look for a couple more days of normal to a bit below
normal temperatures across our region. A ridge of high pressure
will build toward our region starting on Friday which will lead to
a warming trend.

&&

.DISCUSSION...as of 3:15 AM PDT Wednesday...Much more straight-
forward satellite image this morning compared to yesterday! With a
marine layer around 1,200 feet plus a west-to-east surface
gradient over 2 MB clouds are across all coastal locations plus
the vast majority of valley spots. Worth noting that the marine
layer has slightly compressed over the past few hours, so will
need to see if that trend continues. Regardless, clouds will burn-
off toward the coast later this morning. Highs will be close to
normal to slightly below normal with 60s and 70s at the coast
while upper 70s to around 90 will be common inland. Tomorrow will
be a near repeat, although if the marine layer continues to
compress there will be fewer clouds Thursday morning.

Synoptically the upper level low currently overhead will dissipate
and head off well to the south. At the same time a ridge of high
pressure will start to build into our region from the Four Corners
area. This will lead to a further compression of the marine layer
along with a warming trend. 850 MB temps will soar to 25-27C by
next week while 500 MB heights will near 593 DM. Both of these
values are lower than record numbers for the month, however they are
on the upper end of the chart. Temperatures will see a nice
increase with inland spots returning to the upper 80s to lower
100s degree range in many spots. Isolated reports of 103 to to 107
can be expected although those will mostly be in spots that are
sparsely populated. At the coast widespread upper 60s to lower 80s
are likely.

Longer range guidance favors warmer than normal readings
continuing all the way through the end of next week.

&&

.AVIATION...As of 4:43 AM PDT Wednesday...For 12z TAFs. Satellite
looks more typical this morning for this time of the year than 24
hours ago. A mixed bag of flight categories across the district,
as stratus has pushed into most taf sites under a 1500 ft marine
layer. These cigs are expected to continue through about 16-17z.
Onshore flow will prevail through the afternoon hours, 10-15 kt,
with higher wind speeds likely at KSFO. KSTS will see generally
light to moderate southerly winds today.

Vicinity of KSFO...Borderline IFR-MVFR cigs through about 16-17z,
then VFR. Light to moderate westerly winds by early afternoon,
around 15 kt. Stratus anticipated to return late tonight.

SFO Bridge Approach...Similar to KSFO.

Monterey Bay Terminals...LIFR/IFR cigs through about 17z, with low
confidence on exact timing of clearing for KMRY. Light to moderate
west winds this afternoon, 10-15 kt.

&&

.MARINE...as of 02:54 AM PDT Wednesday...Northerly winds will
increase from north to south beginning later this morning as high
pressure builds in from the west and  interacts with coastal
troughing. Steep fresh northwest swell will occur as a result of
the increasing winds. No significant long  period swell through
the rest of the week.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tday...SCA...Pt Arena to Pt Reyes 0-10 nm from 10 AM
             SCA...Pt Arena to Pigeon Pt 10-60 nm from 10 AM
             SCA...SF Bay from 10 AM

&&

$$

PUBLIC FORECAST: Bell
AVIATION: BAM
MARINE: BAM


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 Tuesday, August 22, 2017

High Temperature

110°F at Palm Springs Rgnl, CA
110°F at Thermal, CA

Low Temperature

30°F at West Yellowstone, MT

High Precipatation

3.10in at Cherry Point/Mcas, 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