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

Area Forecast Discussion
National Weather Service San Francisco Bay Area
932 AM PST Thu Dec 13 2018

.SYNOPSIS...Dry conditions are forecast to continue across our
region through Thursday night with mild temperatures. A weak
weather system will likely produce light rain later Friday and
Friday night, especially for areas north of the Golden Gate.
Periods of light rain may continue into Saturday, mainly for the
North Bay. A stronger and wetter system is then expected to
produce widespread rain across our entire region Sunday afternoon
and Sunday night.

&&

.DISCUSSION...as of 09:15 AM PST Thursday...Upper level ridge
keeping the area dry and mild today. A few high clouds moved
overhead through the night, and combined with lower dew points
near the surface, prevented fog from becoming widespread or dense.
Have updated the forecast to remove mention of fog this morning
in all but the easternmost part of the East Bay Valleys, and
southern Salinas Valley. The dry atmosphere and mostly clear skies
allowed temperatures overnight to drop to their coolest values in
several nights, with 30s in most inland valley locations and 40s
near the coast. Highs today will be mild under sunny skies, with
low to mid 60s near the SF Bay and mid to upper 60s in the
Central Coast and southern inland valleys. A few of the warmest
locations could hit 70 degrees.

High clouds will increase late tonight in advance of the next
upper level trough. A few prefrontal showers will likely develop
by late Friday morning in the coastal mountains as moist onshore
flow increases. A cold front will move south into the North Bay
on Friday afternoon and stall out and mostly fall apart over the
SF Bay Friday evening. Showers will accompany the front with light
rainfall amounts from the Bay Area north. Lowland areas to the
south will struggle to see any rain from this front. The stalled
front will then lift north into the North Bay on Saturday and will
keep a chance of scattered showers in the forecast across the
north. A stronger storm is still expected to arrive on Sunday with
widespread moderate to locally heavy rainfall. See the previous
discussion for more details.

&&

.PREV DISCUSSION...as of 03:08 AM PST Thursday...Longwave pattern at
500mb shows a ridge of high pressure off the West Coast and over
the Bay Area. A quick look at the satellite imagery confirms this
flow pattern as cloud continue spill over the ridge spreading high
clouds over the Bay Area. At the surface some patchy fog is
forming, but compare to the last few nights it`s having a hard
time. Dew points are lower than 24 hours ago and high clouds are
likely limiting some of the cooling. None the less, a few stations
in the North and East Bay Valleys have reduced visibility less
than 10 miles. A station in King City also has some reduced
visibility. Have not seen any reports of dense fog however.

The ridge of high pressure will keep the region dry and seasonable
today through early Friday. Total side note, some clearing of high
clouds may allow for a glimpse of the Geminid meteor shower
overnight. Saw a few meteors here at the WFO.

By Friday afternoon the ridge exits to the east as a cold front
approaches from the north. Model guidance continues to show the
possibility of a few pre-frontal showers over the coastal
mountains during the day Friday. Rain chances will increase and be
highest north of the Santa Cruz Mountains Friday afternoon. Rain
chances drop off rather quickly south of the Santa Cruz as the
cold front struggles to move south. In fact, it appears the
frontal boundary weakens and stalls over the Bay Area and slowly
lifts northward back over the North Bay. The stalled front will
keep shower chances through Saturday. Rainfall amounts will be a
few hundredths south of the Santa Cruz Mountains, 0.10-0.25" Santa
Cruz Mountains, 0.10-0.50" north of the Santa Cruz Mountains.

The main focus continues to be on a more potent storm system that
will impact the region on Sunday. A stronger cold front will enter
far NorCal early Sunday and then slowly move southward. This front
has a better moisture tap - 1-1.25" PWAT. Atmospheric River
Guidance has IVT values greater than 500 kg/m/s - moderate
strength. The ensemble envelop was rather large with the IVT
values earlier in the week, but the latest GFES has a tighter
envelop increasing confidence. Moderate to possible heavy rain
will develop over the North Bay Sunday afternoon before slowly
moving south Sunday night into Monday. A few post frontal showers
will be possible on Monday, but gradual drying seems likely.
Rainfall will be highest over the North Bay and all coastal
mountains.

The tail end of a system well to the north may bring some showers
to portions of NorCal, but chances to the Bay Area seem small. If
anything, the North Bay would have the best chance on
Tuesday/Wednesday. Farther down the road the GFS/ECMWF both show
another front possible late next week, but details and timing
vary.

Simply put, more beneficial rain is on the way through the next
seven days.

&&

.AVIATION....as of 9:40 AM PST Thursday...Ridge apex over central
California resulting in widespread VFR with generally light
offshore winds and passing high clouds to the north this morning.
Arriving frontal boundary will bring increasing cloud cover from
north to south through the TAF period, with a shift towards wetter
showery pre frontal weather towards the end of the TAF period for
the northern/30-hour TAF sites.

Vicinity of KSFO...VFR today. Increasing clouds through the TAF
period with prefrontal showers possible mid to late Friday
morning.

SFO Bridge Approach...Similar to KSFO.

Monterey Bay Terminals...VFR. Breezy upvalley (SE) winds in the
Salinas valley thru this morning. Increasing clouds towards end of
TAF period ahead of next frontal boundary.

&&

.MARINE...as of 09:29 AM PST Thursday...Northwest swell will
increase across the waters through Friday night creating hazardous
conditions particularly for smaller  vessels. A significant long
period northwest swell is then  expected to arrive late Sunday
into Monday through Tuesday, with  very long period forerunners
arriving Sunday morning.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tday...SCA...Pt Arena to Pt Reyes 0-10 nm
             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
             SCA...Pigeon Pt to Pt Piedras Blancas 10-60 nm
             SCA...Rough Bar Advisory for SF Bar

&&

$$

PUBLIC FORECAST: ST
AVIATION: DRP
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.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 Wednesday, December 12, 2018

High Temperature

84°F at Charlotte Amalie Virgi, IS

Low Temperature

-16°F at Presque Isle (awos), ME

High Precipatation

1.45in at Quillayute/State, WA

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