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

Area Forecast Discussion
National Weather Service San Francisco Bay Area
1040 AM PDT Mon Jun 25 2018

.SYNOPSIS...Continued cooling trend today with a well established
marine layer and onshore flow in place. Subtle day to day changes
for much of the upcoming work week with temperatures running near
or slightly below normal. By Friday and Saturday another ridge may
build with a warming trend.

&&

.DISCUSSION...as of 8:24 AM PDT Monday...Widespread stratus
continues to blanket the coast and most inland valleys at this
hour. The Fort Ord Profiler shows the marine layer depth around
2,600 feet, about 600 feet deeper than this time yesterday. Fog
and even drizzle have been reported this morning at a couple of
airports, reflected in this morning`s Regional Temperature and
Precipitation Table. Visible satellite shows moderate eroding of
the stratus already occurring. Most of it should mix out by
17-18z/10-11am PDT.

As mentioned in the previous discussion, today`s main story will
be the continued cooling trend through the CWA. Today`s
temperatures will be hovering around or slightly below seasonal
normal. Temperatures will be in the mid 60s along the coast to
upper 80s/lower 90s for some inland spots.

Next forecast discussion will have an update on the warm
temperatures expected by late week and into the weekend,
especially inland.

&&

.PREV DISCUSSION...as of 2:32 AM PDT Monday...The hot temps from
Saturday are old news with the marine layer having returned and
currently around 2500 feet along the coast. Onshore gradients are
hovering around 3 mb from sfo to sac with winds howling through
the Delta, a sure sign of continued cooling for inland areas. The
cooling trend started with some southwest flow as the northerly
gradients eased. Some of the buoys are still showing some light
south winds over the ocean but by this afternoon more typical nw
flow should return along the coast and allow a more typical
stratus pattern to reform under the inversion layer tonight. Highs
today will be seasonable with 60s coast, 70s around the bay and
80s inland with only some lower 90s for the most interior valleys
of the Central Coast and perhaps northern Napa county.

As is often the case as we settle into the summer doldrums it can
be hard to forecast daily temp trends but right now the model
trends suggest perhaps a few degrees of warming on Tuesday
followed by another downward trend on Weds as the next upper level
shortwave trough passes to our north with increasing onshore flow
at the coast.

Temps should begin to gradually rebound by Thursday afternoon
inland as high pressure over the Eastern Pacific begins to nose
its way into the region allowing temps to climb back to near or
slightly above normal. Current model trends on the euro and gfs
along with corresponding mos output suggest more noted warming
for Friday and Saturday as 90s become more common once again. Not
expecting to be as warm as what we just observed this past
Saturday as north winds aren`t expected but just rather building
590 dm heights squishing the marine layer with light onshore
winds.

Similar to our current pattern the models are showing the ridge
weakening by around next Sunday with a trough moving into the
Pacific NW during the July 2nd-4th time frame. Early holiday
forecast would call for onshore flow with an established marine
layer keeping temps on the cool side of normal for the Bay Area.

&&

.AVIATION...As of 10:40 AM PDT Monday for 18Z TAFs. Low clouds
continue to dissipate over inland areas, especially around the San
Franciso Bay terminals at this hour. Meanwhile, burn-off is
occuring much slower around the Monterey Bay region and may
linger through 21Z or potentially later. Onshore winds will
increase this afternoon with locally gusty winds possible through
the evening. Low clouds push back inland overnight, yet are not
likely to be as widespread as this morning given a drier boundary
layer. Will continue to monitor ongoing trends around the Monterey
Bay region through the morning as well as onset of stratus tonight
into Tuesday morning. Overall moderate forecast confidence.

Vicinity of KSFO...VRF conditions through the afternoon and early
evening. Westerly winds will increase to around 15 kt with gusts
in the 20-25 kt range through the afternoon and evening.
Confidence increases for low clouds to return late tonight for
KOAK yet development over KSFO appears less likely.

SFO Bridge Approach...Similar to KSFO.

Monterey Bay Terminals...MVFR to IFR conditions impacting the
region t his morning with stratus holding strong. Do expect some
clearing this afternoon, especially for KSNS. However, cannot rule
out MVFR conditions holding on longer than currently expected
given persistent onshore flow. If clearing does occur, an early
return is likely late this evening.

&&

.MARINE...as of 10:40 AM PDT Monday...Northwest winds will
gradually increase over the coastal waters through the day with
gusty conditions developing near the Golden Gate and the San Pablo
Bay this afternoon. These winds can produce locally steep wind
waves that can be hazardous to smaller vessels. Both the northwest
and southerly swells are generally expected to remain small
through the week.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tday...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 from 3 PM
             SCA...SF Bay from 11 AM
             SCA...Pigeon Pt to Pt Piedras Blancas 10-60 nm from 3 PM

&&

$$

PUBLIC FORECAST: BAM/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 Sunday, June 24, 2018

High Temperature

108°F at Midland/Rgnl, TX
108°F at Lubbock/Intl, TX
108°F at China Lake (naf), CA
108°F at Needles Airport, CA
108°F at Wink/Winkler Co, TX
108°F at Palm Springs Rgnl, CA

Low Temperature

32°F at Yellowstone (ramos), WY

High Precipatation

3.83in at Gage/Muni, OK

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