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.

Many of these scripts are now available on GitHub at https://github.com/ktrue

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 Sunday, 10-Feb-2019 7:10 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 210532
AFDMTR

Area Forecast Discussion
National Weather Service San Francisco Bay Area
1032 PM PDT Fri Sep 20 2019

.SYNOPSIS...A warming trend will continue through Saturday. A low
pressure system moving southward to our east early next week may
create the potential for continued warming temperatures, dry
offshore flow and increased fire weather concerns. A trough of low
pressure will move through the region late next week resulting in
significantly cooler temperatures.

&&

.DISCUSSION...as of 9:24 PM PDT Friday...Temperatures rose on
average 5 to 8 degrees today as high pressure continues to build
in over the region. Temperatures along the coast warmed in the 70s
to low 80s while inland temperatures reached into the upper 70s
to mid 80s. The warming trend will continue into Saturday as light
offshore flow persists across the district and ushers warmer
inland air toward the coast. Temperatures are forecast to inch up
another 3 to 5 degrees on Saturday with highs expected to warm
into the 70s to low 80s along the coast, 80s across most inland
locations and mid 80s to low 90s over the warmest inland areas.

Cooler temperatures are forecast for Sunday as an upper level
trough slides south across the state bringing with it a cooler and
more humid airmass. The cold front associated with this system is
expected to fall apart before reaching Northern California,
therefore the region will not receive any precipitation from this
system. The trough is progged to move inland Monday allowing high
pressure to build in from the west. The high will ridge across the
Pacific Northwest and into the Great Basin while a thermal trough
develops along the California coast. This pattern will result,
not only in warmer temperatures for Monday and Tuesday, but also
offshore winds across Northern California. Strongest winds are
currently focusing over the North and East Bay hills Monday night
into Tuesday morning. However, current models only show and
offshore gradients of around 7 mb and current fuel moisture
observations remains well below normal. In other words, fuels are
wetter than normal. We will continue to watch this situations
closely as it develops.

Temperatures will be significantly warmer on Monday and Tuesday,
with Tuesday expected to be the warmest day. Highs will reach into
the 70s to near 80 along the coast with areas such as Santa Cruz
that is typically affected by downsloping offshore winds may see
temperatures in the mid to upper 80s. Widespread 80s are
anticipated around the bay with inland temperatures soring into
the 90s and possibly approaching 100 degrees.

From previous discussion...Another significant pattern shift is
then forecast to begin midweek bringing with it a substantial drop
in temperatures. 5-10 degree temperature drop is forecast from
Wednesday to Thursday as the ridge weakens and an upper level
trough approaches from the PacNW. Additional cooling is then
expected Friday and into next weekend along with the possibility
of precipitation.

&&

.AVIATION...As of 10:30 PM PDT Friday...Clear skies this evening
as dry airmass continues over the area. Models not showing any
indication of a marine layer tonight so VFR is forecast through
Saturday.

Vicinity of KSFO...VFR.

SFO Bridge Approach...Similar to KSFO.

Monterey Bay Terminals...VFR.


&&

.FIRE WEATHER...as of 2:55 AM PDT Friday...A quick look at Energy
Release Component (ERC) and 100 hour fuel values are both well
below normal for the region. The below normal readings are likely
in response to the recent rain and cool weather. A warming and
drying trend is on track to develop into the weekend. There is
even a brief period of offshore flow Friday night across the North
and East Bay Hills. Winds will be breezy with moderate to
possibly poor humidity recoveries Friday night. Not strong enough
or long enough to warrant any Red Flag warnings. What it may do is
help chip away at the low ERCs and high 100 hour fuels. The
inside slider mentioned above will bring a more pronounced
offshore flow event Monday into Tuesday with poor overnight
humidity recovery and gusty winds in the hills. One potential
limiting factor is the actual offshore flow gradient. Models put
the WMC-SFO gradient at 7-8 mb, decent but not strong. If this
pattern holds true a Fire Weather Watch may be in order over the
weekend. Climatologically this is the favored time of year for
offshore flow events and Red Flag warnings for Wind/RH in the Bay
Area. Taking a look at the bigger picture - far NorCal has had a
few wetting rain events so fire season may be near the end to the
north. SoCal - not so much and fire season will keep on going.
What about the Bay Area? Fuels have been below normal for much of
the summer and recent cool/wet weather has kept them that way.
That being said, the recent wet weather wasn`t wet enough to end
fire season. Therefore, we`re not out of the woods yet and we
should remain weather/fire aware through the Fall season.

&&

.MARINE...as of 10:29 PM PDT Friday...Winds will generally
decrease Saturday and Sunday as low pressure over the
intermountain region moves east reducing the pressure gradient.
Winds will increase again by Monday as another low pressure trough
drops into the Great Basin. A 10-second northwest swell will be
mixed with a long-period southerly swell.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tngt...SCA...Pt Arena to Pigeon Pt 10-60 nm
             SCA...Pt Pinos to Pt Piedras Blancas 0-10 nm until 3 AM

&&

$$

PUBLIC FORECAST: CW
AVIATION: W Pi
MARINE: W Pi

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, September 19, 2019

High Temperature

104°F at Del Rio/Intl, TX
104°F at San Antonio/Stinson, TX

Low Temperature

25°F at Saranac Lake/Adirondac, NY

High Precipatation

11.18in at Conroe Montgomery Cty, TX

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 = "https://www.cpc.ncep.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.03e - 09-Feb-2019 see history).

deformed-offering