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.

476
FXUS66 KMTR 201240
AFDMTR

Area Forecast Discussion
National Weather Service San Francisco Bay Area
440 AM PST Sat Jan 20 2018

.SYNOPSIS...Dry and cool weather is forecast for today. The next
system is expected to spread rain across primarily the northern
portion of the forecast area from late Sunday through Sunday night.
Rain could be heavy at times in the North Bay. The weather pattern
will remain active into next week, with more rain likely by midweek.

&&

.DISCUSSION...As of 4:37 AM PST Saturday...A few isolated showers
have passed by south of Point Sur early this morning. Elsewhere
skies have mostly cleared and temperatures are cooling back into
the mid 30s to mid 40s this morning. Air temperatures are within a
few degrees of dewpoint temperatures thus there are a few places
with patchy low clouds, but residual, carry-over mixing from
Friday and no significant return of near surface temperature
inversions should help prevent fog from becoming more than patchy
til a little after sunrise. Very localized frost is a possibility
in the North Bay valleys this morning. With sunny skies we`ll have
dry and cool weather today.

Mid to upper level troughing with 500 mb temps near -33C produced
decent lapse rates, convective towers and showers on Friday, a few
reports came in indicating mainly small hail. A fair amount of
convective overturning took place over the coastal waters and land
Friday. Instability profiles were conducive to isolated echo tops
up to ~ 25 thousand feet (in Friday morning`s discussion I incorrectly
stated tops could reach 50 thousand feet). Helping to propel our weather
toward drier conditions today will be low amplitude short wave ridge
bringing a return to stability today.

We continue to keep a close watch on the next cold front and rain
potential for later Sunday into Monday morning. This front is attached
to a 990 mb low center in the Gulf of Alaska, and based on the 00z
ECMWF theta-e the front is initially moving SE approx 30 mph then
it decelerates to half this velocity prior to reaching the
northern California coast later Sunday. As mentioned previously,
the models do indicate strong warm air advection ahead of this
cold front. This combination will strengthen the thermal gradient
with increasing wind shear and confluence forming a well developed
band of rain and wind. Offsetting some of the stronger winds from
reaching the surface will be strong upward vertical motion along
the frontal boundary thus for the time being it appears this fropa
may just fall short of meeting wind advisory criteria.

Rain arrives in the North Bay Sunday afternoon then tapers off early
Monday morning. Rain will spread north to south with hourly rain
rates in the North Bay near 0.50" per hour (heavy rate) with the
rain band turning into a mainly light to moderate rain band as it
moves southeastward over the remaining Bay Area and north Central
Coast later Sunday night into Monday morning. From a San Francisco
to Livermore line and areas south of this line will likely have
rain, some ponding of rain on roadways perhaps, in the Monday
morning commute. Interesting to note the ECMWF and GFS remain
firmly anchored with comparatively lower rain rates and totals.
After examining the WRF, NAM, and weighing in on the GFS, ECMWF
output it appears for time being highest rain rates/totals will be
confined to coastal Sonoma and Marin counties with moderate to
heavy rain briefly extending over to the North Bay wildfire scars
late Sunday night. A flash flood watch would be based primarily on
the currently wet NAM output while other dynamic model output are
forecasting relatively less qpf; for now it`s best to wait to see
if the NAM turns up or down qpf in later output. Still looks like
the tail end of a weak atmospheric river will be intertwined with
this fropa, but here too the 06z GFS IVT values have fallen lower
to about 300 kg/m/s. The front may just arrive here as a purely
beneficial rain producer with limited hydro (and wind) hazards
which we certainly need.

A more widespread soaking rain event arrives midday Wednesday and
lasts into Thursday morning based on recent GFS output, but here
too the 00z run of the ECMWF is comparatively less with qpf. A
middle of the road approach to qpf may be good for now as there
will be better dynamics, amplification within this system in a
long wave trough over the west coast.

There`s a possible pattern change once again by late next week if
the ECMWF verifies indicating an omega block forming over eastern
Asia to Alaska. Just checking 06z GFS 500 mb pattern during this
time and it looks more disorganized than the ECMWF`s omega block
forecast, which would be good news cause an omega block would put
a ridge back over CA sending the storm track north for 1-2 weeks
if this verifies.

&&

.AVIATION...as of 4:40 AM PST Saturday for 12Z TAFs. As of 12z,
all TAF sites are reporting VFR. Fog product satellite shows
patchy fog/low clouds affecting parts of the Santa Clara Valley,
San Benito County, and areas just south of Monterey. Difficult to
say whether fog will move over KMRY or KSNS before sunrise. This
will have to be monitored closely. For now, have kept VFR in TAF
through the morning for both sites. Otherwise and elsewhere, VFR
will prevail today and into tonight. Westerly winds will increase
and become a tad breezy by the afternoon, between 10-15 kt. The
onshore gradient will weaken by the end of the TAF period as
another upper level storm system approaches from the northwest,
switching winds out of the south/southwest by Sunday morning.

Vicinity of KSFO...VFR conditions will continue today. Westerly
winds increase by late morning or early afternoon, sustained
around 15 kts through the evening.

SFO Bridge Approach...Similar to KSFO.

Monterey Bay Terminals...VFR expected through the forecast period.
Generally westerly winds this afternoon around 10 kts, turning
south/southeast overnight.

&&

.MARINE...as of 2:38 AM PST Saturday...High pressure over the
eastern Pacific will continue to produce moderate northerly winds
today. As swell continues to decrease, hazardous seas will persist
over the coastal waters. High pressure will drift south Sunday
morning as another storm system approaches from the northwest.
This will result in winds increasing and shifting westerly, then
southwesterly by Sunday afternoon. Northwest swell will also
increase Sunday. A cold front will pass over the waters late
Sunday night or early Monday morning.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tday...SCA...Pigeon Pt to Pt Pinos 0-10 nm
             SCA...Pt Pinos to Pt Piedras Blancas 0-10 nm
             SCA...Pigeon Pt to Pt Piedras Blancas 10-60 nm
             SCA...Pt Arena to Pt Reyes 0-10 nm
             SCA...Pt Reyes to Pigeon Pt 0-10 nm
             SCA...Pt Arena to Pigeon Pt 10-60 nm
             SCA...Rough Bar Advisory for SF Bar
             SCA...Mry Bay

&&

$$

PUBLIC FORECAST: Canepa
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 Thursday, January 18, 2018

High Temperature

83°F at San Diego/Miramar Nas, CA

Low Temperature

-9°F at Glens Falls/Warren Co, NY
-9°F at Rome/Griffiss Afb, NY

High Precipatation

1.51in at Arcata, CA

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