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

Area Forecast Discussion
National Weather Service San Francisco Bay Area
920 AM PST Sat Feb 23 2019

.SYNOPSIS...Dry and seasonably cool conditions will prevail across
most of the region through the weekend. The exception may be the
North Bay where there is a chance of light rain late in the
weekend. A plume of moisture will bring moderate to heavy rain to
the majority of the region for the first half of next week,
though the exact positioning of the heaviest rains continues to
vary. Another potentially wet system may bring more rain to the
region late next week and into the following weekend.

&&

.DISCUSSION...As of 9:20 AM PST Saturday...Water vapor imagery
shows northwesterly flow aloft over Northern California this
morning, with plenty of high cloud cover beginning to filter
across the region ahead of the next system. This system is trying
to dig south across the Pacific Northwest, but running into the
ridge off the West Coast. Therefore, expect this system to stall
today, with the main moisture plume primarily focused on the
Oregon and California border and the far Northern California
Coast. However, cannot rule out some light rain maybe sagging
south of Point Arena late this afternoon or evening. Otherwise,
expect another seasonably cool day to prevail across the region
today, with just a few more high clouds expected than yesterday.

The models continue to show that this moisture plume will remain
focused on the area just to our north through Sunday, with just
some light rain possible across our North Bay Counties. Our
current forecast seems to be handling this trend well, so no
updates are planned at this time.

The primary focus of this afternoon forecast package will be what
happens with this moisture plume early next week. At this point in
time, most of the models are keeping all the rainfall north of the
Golden Gate through Monday morning. However, the 12z GFS is
slightly faster than the other models, showing that the Bay Area
could have a bit of a rainy and messy commute Monday morning. It
looks like the rain should spread as far south as Santa Cruz
during the day on Monday, but the heaviest rainfall appears to be
focused on the North Bay and up into the Mendocino Coast. At this
point in time, it will be a waiting game to see how the rest of
the 12z models trend. Palmer

&&

.DISCUSSION...As of 3:30 AM PST Saturday...Overnight temperatures
are 5 to 15 degrees cooler versus 24 hours ago despite dew points
running 10 to 15 degrees warmer. Both nights featured clear skies
but differ in that last night featured light to breezy winds for
the majority of the night, where as winds early this morning are
mostly calm across the region. The lack of winds this morning
means the relatively warmer layers aloft decoupled from the
surface layer, allowing it to radiational cool down towards the
dew point. Latest observations suggest temperatures are now
approaching their dew point readings, meaning the cooling rate
will decrease significantly. Sunrise temperatures will be slightly
warmer this morning due to the higher overall dew points versus
24 hours ago despite being significantly cooler at this hour.

The synoptic scale pattern currently features a benign
northwesterly flow aloft with a much deeper 534dm 500mb open wave
farther northward. Forecast models suggest this open wave/trough
will descend southward along the British Columbia coastline
through the next 24 hours before stalling out near Seattle. This
upper low stalls out due to the presence of a broad low amplitude
ridge blocking its southward progression into California.
Satellite imagery/model data show the presence of a 0.80-0.90"
precipitable water plume straddling the border of the weak ridge
to the south and the aforementioned trough to the north. The
stalling upper low will tap into this moisture plume through the
weekend, but given the synoptic setup, will keep the bulk of any
rain confined to the northern extremes of Sonoma/Napa counties
and farther northward. Previous model runs have steadily slowed
and shunted northward the precipitation this weekend with the
latest runs continue that line of thinking.

A secondary vorticity pulse will round the base of the trough
later Sunday into early Monday and reinvigorate the broader
trough. The trough deepens and expands southward Sunday night into
Monday, which finally allows precipitation to expand southward
through the North Bay and into the immediate San Francisco Bay
Area by Monday morning.

At the same time Monday, a secondary closed low that developed
north of Hawaii will steadily move eastward towards Northern
California. This secondary feature will drive a deeper
precipitable water plume (1.15-1.25") towards California, which
the strengthening/deepening low near Seattle will be able to
interact with. This moisture plume looks significant enough to be
classified as a weak to moderate atmospheric river plume and is
expected to bring wet conditions to much of Northern California
from Monday through midweek. Forecast confidence remains on the
very low end regarding the positioning of this atmospheric
moisture plume, given that the GFS focuses the bulk of the plume
over the immediate San Francisco Bay Area and the latest run of
the EURO has pushed the bulk of the moisture much farther
northward, from Ukiah up to central Oregon. This is a significant
change, especially when contrasted with previous runs and other
models. Usually we can count on the GFS coming into alignment with
the EURO when the EURO has high run to run consistency, but the
latest run of the EURO removes that possibility. For now, will
treat the last run of the EURO as somewhat of an outlier and focus
more on consistency of previous EURO runs, with a slight blend
towards the GFS solution in the current forecast package.

Assuming the current forecast package is correct (it will change
in the coming days), the heaviest rain is expected to fall across
the North Bay between Monday and Tuesday afternoons. The North
Bay mountains and coastal ranges could pick up 4-6" storm total,
with 2.5-3.5" for the inland valleys. Farther southward, 1.25-2.0"
are possible for San Francisco, San Mateo, Alameda and Contra
Costa counties, plus the Santa Cruz mountains. Increasingly lesser
amounts are expected farther southward across the South Bay and
Monterey Bay regions as the main moisture plume remains locked in
place farther northward. These numbers will most likely change
given the very low run to run and model to model data consistency.
Southerly winds will be breezy to occasionally gusty with this
storm system but are not expected to be nearly as strong as the
other recent storms that have battered the region since the new
year. Temperatures will be warmer, with highs in the 60s and
overnight lows in the low 50s.

Models agree that we will see a brief period of drying out later
Thursday into early Friday as a weak ridge develops in the buffer
space between the aforementioned storm system and a second storm
system. This second storm system is expected to bring another
round of unsettled wet, windy weather to the region late next week
through next weekend.

&&

.AVIATION...As of 03:37 AM PST Saturday...For 12z tafs. VFR
through tonight with increasing high clouds today. Expect cigs to
gradually lower into this evening and overnight. Guidance shows
development of patchy low clouds into tomorrow morning. Generally
light winds this morning turning onshore this afternoon.

Vicinity of KSFO...VFR. Light winds this morning turning onshore
in the afternoon, but expected to remain generally light (~10 kt).
Increasing high clouds today lowering into this evening.

SFO Bridge Approach...Similar to SFO.

Monterey Bay Terminals...VFR. Light winds around 10 kt becoming
onshore this afternoon. Increasing high clouds throughout the day
with patchy low cloud development overnight.

&&

.MARINE...as of 02:14 AM PST Saturday...Generally light west to
northwest winds will continue overnight and tomorrow. Winds will
turn southerly late this weekend and continue into mid-week. Light
to moderate northwest swell will persist into next week.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tday...None.

$$

PUBLIC FORECAST: Palmer / DRP
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 Friday, February 22, 2019

High Temperature

88°F at Brooksville, FL
88°F at Bartow Municipal, FL
88°F at Winter Haven, FL
88°F at Gainesville/Muni, FL
88°F at Lakeland Regional, FL
88°F at Marathon Airport, FL
88°F at Ocala Muni (awos), FL

Low Temperature

-36°F at West Yellowstone, MT

High Precipatation

4.87in at Tupelo, MS

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