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.

885
FXUS66 KMTR 160509
AFDMTR

Area Forecast Discussion
National Weather Service San Francisco Bay Area
909 PM PST Fri Dec 15 2017

...Breezy conditions likely late tonight through Sunday
morning...
...Elevated fire danger particularly for higher
elevation locations for the same time...

.SYNOPSIS...Dry weather will continue into next week. A mainly
dry cold front will sweep south over the area late Friday night
and early Saturday morning which then increases N-NE winds along
the ridges and peaks Saturday.

&&

.DISCUSSION...as of 09:01 PM PST Friday...The day shift put forth
a nice forecast package and as such...the forecast remains on
track this evening with the dry cold front sweeping through the
region. Cloud cover has already been on the decline behind the
front across North Bay. Clearing conditions are expected to follow
behind the front, along with increasing northerly winds. Peaks in
North and East Bay are alreay gusting into the 30 mph range, but
humidity levels remain good at this point. The strongest winds are
showing nicely on IR satellite across western Oregon and NW Cal.
These winds will move into the Bay Area Saturday morning with peak
conditions expected in the mid to late AM hours of Saturday. With
the winds will come drying conditions. Expect humidity levels to
drop sharply tomorrow.

&&

.PREV DISCUSSION...as of 2:00 PM PST Friday...Thanks to more clouds
today along with the ridge flattening out, we have seen a drop in
temperatures across the board -- generally 3 to 8 degrees
compared to Thursday. After multiple days of talking about it, we
are finally seeing a substantial pattern change as a system
approaches the West Coast. Satellite clearly shows this feature
that is still expected to move through our region tonight. Still
have high confidence that any associated rainfall will be well to
our north.

The main story will be increasing winds overnight into Saturday as
the pressure gradient ramps up along with cold air advection. With
the overall flow expected to be north-to-south tomorrow, gusty
winds from the north will impact our area especially higher
elevation locations. The wind advisory remains in effect and
highlights local gusts exceeding 50 mph. Valley spots will
generally be 10 to 20 mph with higher gusts. Similar conditions
can be expected into early Sunday. Both the wind advisory and the
red flag warning remain in effect.

High pressure will attempt to rebuild later on Sunday and continue
on Monday before being replaced by another system that will drop
down Tuesday into Wednesday. Models have been having difficulty
with the track of this feature with most previous runs keeping it
too far to the east to bring rainfall into our CWA. However, 12Z
run from both ECMWF and GFS are now trending wetter with it
positioned father to the west. In light of that, slight chance to
chance PoPs were added to the northern half of our region. Any
rainfall should be light -- most likely less than a tenth of an
inch.

After that point, we will enter a period of dry and cool weather
with a highly amplified ridge off the coast with a directly
northerly flow across California. No additional rainfall is
forecast at least through the 24th.

For those looking for some relief, the latest 3 and 4 week outlook
from the CPC does favor wetter than normal conditions. That would
be from December 30th to January 13.

&&

.AVIATION...As of 4:55 PM PST Friday...For 00z TAFs. An
approaching dry cold front will move across the region late
tonight. Anticipate mainly high cloud and smoke to continue to
drift across the region ahead of the front. Light to moderate
northwesterly winds will strengthen and turn gusty overnight.
These strong and gusty northerly winds will persist through the
weekend. Sustained winds in the 15 to 25 kt range with gusts from
20 to 35 kt expected across area terminals. Strongest winds are
anticipated over KSFO after midnight tonight with sustained winds
near 30 kt and gusts to 40 kt possible. Winds over mountain ridges
and through gaps will also be stronger than normal. High clouds
and smoke will continue to drift across the region

High confidence.

Vicinity of KSFO...VFR. Light northerly winds and high clouds will
prevail across the region this evening ahead of an approaching
cold front. Northwesterly winds will strengthen tonight with
FROPA. Sustained winds in the 15 to 25 kt range with gusts from
25 to 35 kt expected. Strongest winds are anticipated over KSFO
after midnight tonight with sustained winds near 30 kt and gusts
to 40 kt possible. An airport weather warning for strong wind
gusts possible for early Saturday morning.

SFO Bridge Approach...Similar to KSFO.

Monterey Bay Terminals...VFR. Light to moderate west winds
expected through late this evening. Winds will strengthen and
become gusty overnight into Saturday morning as the front nears.
Sustained winds in the 10 to 15 kt range with gusts around 20 kt
expected.

&&

.FIRE WEATHER...as of 2:42 AM PST Friday...The Fire Weather Watch
has been upgraded to a Red Flag Warning from 10 PM Friday through
10 AM Sunday. Offshore flow is forecast to develop behind the
front tonight into Saturday. Latest models do show some modest RH
recovery early tonight then dropping through the day and poor
recoveries Saturday night. It`s fairly common to have lower RH on
night number two behind a front with developing offshore flow.
May not technically hit RH criteria for tonight, but decided to
keep fire weather concerns going given gusty winds, lack of recent rain,
very low RH (single digits) the last few nights and near record
values of ERCs for the N Bay Mts and Santa Cruz/Diablo PSAs. Areas
of greatest concern will be above 1000 feet. Winds may be a tad
weaker on Saturday night, but RH recoveries worse. For what it`s
worth, fire weather concerns are not that unusual for this time
of year. December 16, 2013, a wildfire broke out in Big Sur called
the Pfeiffer Fire.

&&

.MARINE...as of 03:57 PM PST Friday...A dry cold front will bring
strong gusty north winds to the  waters, particularly overnight
tonight and into Saturday morning,  with gusty north winds
persisting through Sunday. Gale force winds are likely across all
outer water zones beginning late tomorrow  night through at least
Sunday morning. The strong and gusty winds  will create very steep
wind waves and fresh swell, creating very  rough and hazardous
seas through the majority of the weekend.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tngt...Wind Advisory...
             SCA...Pt Reyes to Pigeon Pt 0-10 nm
             SCA...Pigeon Pt to Pt Pinos 0-10 nm
             SCA...Pt Pinos to Pt Piedras Blancas 0-10 nm
             SCA...Pt Arena to Pigeon Pt 10-60 nm until 12 AM
             SCA...Pigeon Pt to Pt Piedras Blancas 10-60 nm until 12 AM
             GLW...Pt Arena to Pigeon Pt 10-60 nm from 12 AM
             GLW...Pigeon Pt to Pt Piedras Blancas 10-60 nm from 12 AM
             GLW...Pt Arena to Pt Reyes 0-10 nm

&&

$$

PUBLIC FORECAST: Bell/BFG
AVIATION: CW
MARINE: DRP

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 Thursday, December 14, 2017

High Temperature

86°F at Camarillo (awos), CA

Low Temperature

-18°F at Mount Washington, NH

High Precipatation

0.14in at Alamosa Muni(awos), CO
0.14in at Leadville, CO

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