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 Tuesday, 28-Jul-2020 2:45 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 280437
AFDMTR

Area Forecast Discussion
National Weather Service San Francisco Bay Area
937 PM PDT Tue Jul 27 2021

.SYNOPSIS...Light showers have pushed northward out of our
forecast area this afternoon. Long range forecast is seasonably
warm and dry through the rest of the work week. Slight cooling
starts by Saturday as marine air pushes farther inland over the
weekend.

&&



.DISCUSSION...as of 09:10 PM PDT Tuesday...Currently, stratus is
making its way back inland near the usual spots, including
Monterey Bay and through the Golden Gate gap into the East Bay
hills. Temperatures this evening were warmer in some areas that
saw more sunshine today, including KMRY which hit a daily record
high at 80 degrees around 2:40 PM. Some East Bay locations,
including Concord and Livermore, were a few degrees warmer than
the forecast. A slight warming trend is still forecasted for
tomorrow, with the warmest spots being inland areas which are away
from the marine layers influence. The forecast still looks on
track. With the warmer temperatures in the East Bay today, those
maximum temperatures could be raised by one or two degrees for
tomorrow making for a warm summer day.

With this said, all of our guidance keeps temperatures below any
critical thresholds for dangerous heat. HeatRisk stays in the low
to moderate risk through Friday for most of the area. Cooler air
moving in this weekend should knock the central CA coast and Bay
Area back down to seasonal.




&&

.PREV DISCUSSION...as of 02:53 PM PDT Tuesday...Current radar shows
that the last of the light showers has now pushed north of Sonoma
and Napa counties meaning that "Sprinkle Watch" is over for our
CWA. We had several reports on social media of folks seeing rain
drops in their neighborhoods across the Bay Area this morning into
afternoon. Much of the precipitation was just trace amounts, but
there were a few isolated spots that measured around 0.01-0.03".

The rest of this week puts us in a fairly stagnant synoptic
pattern as a broad and large high pressure cell dominates much of
the CONUS through Friday. With that high pressure stretching into
the west coast, we`ll see warm and dry weather in our region,
particularly for our interior locations. Meanwhile, coastal
locations will have more mild temperatures, but could still be a
bit warmer than normal. The temperature range for coastal areas
will be in the 60s and 70s this week while inland spots range in
the 80s and 90s...could see a few triple digit marks this week in
the hotter areas of our CWA, but nothing widespread. As stated in
prior discussions, the inland spots will generally range about
5-10 degrees above normal. However, at this time, we are not at
risk for this turning into a significant heat event. Folks in
those 90-100 degree locations will still want to make sure they
stay hydrated and avoid strenuous work during the heat of the day,
though.

As we approach the weekend, an upper level low off the
coast of Canada will have a trough extending southward off the CA
coastline. On Saturday and Sunday, that low will nudge inland and
weaken the large CONUS high. As this occurs, we`ll start to cool
into a more seasonable range as the marine layer will build back
and usher in the cooler, moist marine air.

Have taken a look at long range models and there seems to be a
hint of another round of monsoon moisture making it`s way into CA
again. The main difference is that the moisture will likely stay
east of our forecast area and be more of an impact for the Sierra.

&&

.AVIATION..as of 5:23 PM PDT Tuesday...For the 00z TAFs. VFR
across Bay Area terminals but stratus is encroaching on coastal
Monterey Bay terminals. GOES-17 shows monsoonal moisture has
pushed to the north, leaving FEW high clouds across North Bay.
Coastal stratus is present from the San Mateo coastline, down
through SoCal. However, it appears to be dissipating on the
northern fringe, as drier air works its way into the area. With a
mixed out marine layer from the SF Peninsula northward, expecting
VFR conditions for most Bay Area terminals overnight, though
models hint at possible low cloud development around the Golden
Gate and eastern SF Bay. Monterey Bay terminals will have IFR/LIFR
conditions through the morning as the marine layer remains in
place. Wednesday brings mostly clear skies with a light to
moderate sea breeze returning.

Vicinity of KSFO...VFR conditions through the period. Stratus
offshore is retreating to the south. FEW to SCT low clouds
possible over the bay in the early morning hours. Breezy WNW winds
15-20 kt settle down this evening and overnight. Wednesday
continues VFR with sea breezes returning in the afternoon 15-20
kt.

KSFO Bridge Approach...Similar to KSFO.

Monterey Bay...VFR transitioning to IFR/LIFR this evening as a
compressed marine layer remains in place. OVC003 reported at
KOAR, with stratus in the vicinity of KMRY/KSNS/KWVI. Clearing
to VFR late morning to early afternoon Wednesday. Light to
moderate sea breeze returns.

&&

.MARINE...as of 09:10 PM PDT Tuesday...A line of scattered showers
remains over the far northern outer  waters along with breezy
northerly winds. Showers will exit the  area overnight and winds
will weaken. Light northwest winds  prevail through the end of the
week and continue to be the  influence on the sea state at around
7 to 9 seconds, along with a weak southerly swell. Winds and gusts
look to increase Wednesday  afternoon and into the evening through
the Golden Gate gap into  the San Francisco Bay. Locally generated
steep wind waves may be  hazardous for smaller vessels.

&&

.MTR WATCHES/WARNINGS/ADVISORIES...
     .Tday...SCA...SF Bay from 3 PM

&&

$$

PUBLIC FORECAST: Dhuyvetter
AVIATION: Lorber
MARINE: DK

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 World Extremes

This script was originated by Michael of Relayweather.com and has been rewritten to use the NWS Climate Prediction Center's CSV file for world observations. 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 variables:

$omittedCountry (text list of countries excluded from $world high/low/precip scans)
Note: the setting $ignoreCountrys is the array of country names to to exclude
$worldhigh
$worldlow
$worldprecip

$selectedCountry (setting: country name for selected country high/low/precip)
Note: run http://your.site.com/worldextremes.php?list to see the list of country names to use
$countryhigh
$countrylow
$countryprecip

$usahigh (Note: for lower-48 USA states)
$usalow (Note: for lower-48 USA states)
$usaprecip (Note: for lower-48 USA states)

$selectedState (setting: USA state 2-character name abbreviation in settings area)
$selectState (a copy of $selectedState for compatibility with old stateextremes.php)
$statehigh
$statelow
$stateprecip

$reportDate (nicely formatted date of the report)
$stateReportDate (a copy of $reportDate for compatibility with old stateextremes.php)

You can run the script by using:

<?php
include_once("worldextremes.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 courtesy of <a href=\"";
print "https://www.cpc.ncep.noaa.gov/products/cadb/";
print "\">NWS-CPC</a></small></p>\n";

?>

which produces this result (with live data):

USA Extremes for Monday, July 26, 2021

High Temperature

105°F at Chadron Municipal Ap, NE
105°F at Mountain Home Afb, ID
105°F at Philip Airport, SD

Low Temperature

37°F at West Yellowstone, MT

High Precipatation

3.68in at Grnvl Spart Intl Ap, SC

Data courtesy 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.

$cacheFileDir = './'; // directory to store cache file in.
$cacheFile2 = "worldextremesCache.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 (display in C is default)
$rUOM = 'in';     // or ='' for no rain unit display (display in mm is default)
#
$ignoreCountrys = array('Antarctica','Greenland');     // for world extremes - exclude these country(s)
$ignoreStations = array('99KLRJ');     // list of stn_id (field 0) to ignore for bogus data
$tempDiffAllowed = 40; // max difference Tmax-Tmin (C) for valid data
$selectedCountry = 'Canada'; // for country max/min/precip in $country* variables
// note: the $usa* variables will have the min/max/precip for the lower-48 states
$selectedState   = 'CA';  // for USA state max/min/precip in $state* variables

Note that $cacheFileDir, $tUOM, $rUOM will use the Saratoga template Settings.php values if used in a Saratoga template.

NWS CPC One Day Extremes PHP script Download (5.04 - 28-Jul-2020 see history).

deformed-offering