Author Topic: NWS Alerts Script & Changes to Cold Weather Hazards  (Read 1437 times)

0 Members and 2 Guests are viewing this topic.

Offline K6GKM

  • CamWX.com
  • Contributor
  • ***
  • Posts: 137
    • CamWX
NWS Alerts Script & Changes to Cold Weather Hazards
« on: September 09, 2024, 09:10:06 AM »
Good morning, everyone! 

An SCN was issued back in March addressing the upcoming consolidation and re-naming of Cold Weather Hazards.  It states, in part:

Quote
On or about October 1, 2024, the NWS will implement the following changes to Public Program Text Products:

- Consolidate the following text products:
  • Hard Freeze Watch to Freeze Watch
  • Hard Freeze Warning to Freeze Warning
  • Wind Chill Watch and Extreme Cold Watch consolidated with Extreme Cold Watch
  • Wind Chill Warning and Extreme Cold Warning consolidated with Extreme Cold Warning

- Transition of “Wind Chill Advisory” to “Cold Weather Advisory”.

Freeze Watch/Warning and Extreme Cold Watch/Warning are contained in the Non-Precipitation Weather Message (NPW).  For Freeze Warning and Watch, there will be the option to use the wording “Hard Freeze” within the body of the product (e.g., in the “What” bullet of the text).

The Valid Time Event Code (VTEC) phenomena code “HZ” for Hard Freeze Watch and Warning will be decommissioned and the Freeze Watch and Warning VTEC phenomena code “FZ” will remain.  VTEC enables weather providers and vendors to automate and tailor the product stream delivered to their clients.

The Wind Chill Warning, Watch, and Advisory currently contained within the Winter Weather Message (WSW) product will be consolidated into the Extreme Cold Warning, Extreme Cold Watch, and Cold Weather Advisory in the NonPrecipitation Weather (NPW) product.  The VTEC phenomena code “WC” will be retired. Extreme Cold Watch and Warning will retain its VTEC of “EC” and Cold Weather Advisory will replace Wind Chill Advisory with the VTEC of “CW”.
Full text at https://www.weather.gov/media/notification/pdf_2023_24/scn23-44_public_program_text_products_freeze_cold_aab.pdf.

Another SCN was issued just the other day describing similar changes being made to the Heat Hazard products in March.
https://www.weather.gov/media/notification/pdf_2023_24/scn24-88_heat_haz_simp.pdf

Will we need to make adjustments to NWSAlerts.php to accommodate these changes?
Grant Miles
Camarillo, CA, USA
Owner/Admin - CamWX.com
SKYWARN Spotter
Station Hardware: Davis Vantage Pro2 Plus w/ 24hr FARS
Station Software: Weather Display, Weather Message, FWI Calculator, StartWatch, with social media & messaging automation using Make.com, Twilio, and Brevo.


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9565
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #1 on: September 09, 2024, 12:30:06 PM »
The nws-alerts.php script will continue to work if no changes to the internal lookup table -- the only effect will be more generic icons will be chosen (based on warning/watch/advisory in the text title), so an update isn't urgent.  Curly had already planned for them changing the texts of the alerts in the script.

After they implement, I'll do an update to map the icons used to the new texts.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline tmabell

  • Forecaster
  • *****
  • Posts: 413
    • Mishawaka Weather
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #2 on: September 10, 2024, 08:41:38 AM »
Also happening on October 1st is a change in the priorities of the alerts.  Not sure if the same priorities are used for the script as are used for the Alerts map but if so they would likely need to be adjusted.

https://www.weather.gov/media/notification/pdf_2023_24/scn24-75_wwa_map_priority_changes_aaa.pdf

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9565
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #3 on: September 10, 2024, 12:20:54 PM »
I did a quiick compare of the alert names available at api.weather.gov/alert/types and the built-in $alert_types in nws-alerts.php

Quote
nws-chk-alert-types.php V1.00 - 05-Jul-2024
.. 128 event types in API /alerts/types
.. 140 event type in nws-alerts $alert_types

.. Comparing NWS types v.s. $alert_types in nws-alerts.php
.. Done 110 found, 18 missing entries
  Missing event titles:
    'Administrative Message'
    'Arroyo And Small Stream Flood Advisory'
    'Avalanche Advisory'
    'Blowing Dust Warning'
    'Dust Advisory'
    'Evacuation - Immediate'
    'Short Term Forecast'
    'Small Craft Advisory For Hazardous Seas'
    'Small Craft Advisory For Rough Bar'
    'Small Craft Advisory For Winds'
    'Small Stream Flood Advisory'
    'Storm Surge Warning'
    'Storm Surge Watch'
    'Test'
    'Tropical Depression Local Statement'
    'Tropical Storm Local Statement'
    'Typhoon Local Statement'
    'Urban And Small Stream Flood Advisory'
  --------

.. Comparing $alert_types in nws-alerts.php v.s. NWS types
.. Done 110 found, 28 missing entries
  Missing event titles:
    'Heavy Snow Warning'
    'Hurricane Wind Warning'
    'Winter Weather Warning'
    'Areal Flood Warning'
    'River Flood Warning'
    'Sleet Warning'
    'Tropical Storm Wind Warning'
    'Blowing Snow Advisory'
    'Flash Flood Advisory'
    'Freezing Drizzle Advisory'
    'Lake Effect Snow and Blowing Snow Advisory'
    'Sleet Advisory'
    'Snow Advisory'
    'Snow and Blowing Snow Advisory'
    'Hurricane Wind Watch'
    'Tropical Storm Wind Watch'
    'Winter Weather Watch'
    'Hurricane Statement'
    'Public Information Statement'
    'River Flood Statement'
    'River Statement'
    'Tropical Statement'
    'Typhoon Statement'
    'Significant Weather Alert'
    'Coastal Hazard'
    'Short Term'
    '911 Telephone Outage'
    'Evacuation Immediate'
  --------
.. Done.
For all the alerts not mentioned in the $alert_types array, the only effect will be a generic icon will be shown depending on the presence of warning, watch, advisory will be shown.  The $alert_types array does have a 'priority' in it and I'll look at updating both after the NWS implements the changes.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9565
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #4 on: September 13, 2024, 11:42:08 AM »
Ok, I'm ready.. wrote a program (gen-alert-types.php) to load the old $alert_types array, use the new names from the PDF file linked from https://www.weather.gov/help-map/ and some entries to add color/icon to missing ones in the original $alert_types and produce a new $alert_types for the October 1, 2024 list.

I'll release an nws-alerts.php update on October 1, 2024 via the template update tool and on GitHub.

Attached is the results of the gen-alert-types.php run.

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline tmabell

  • Forecaster
  • *****
  • Posts: 413
    • Mishawaka Weather
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #5 on: September 13, 2024, 11:55:44 AM »
 =D> Thank you Ken!

Offline mikeym2m

  • Senior Contributor
  • ****
  • Posts: 156
    • MikeyM's Thornhurst PA Weather
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #6 on: September 13, 2024, 02:16:57 PM »
Thanks Ken for all your hard work as always!

MikeyM

Offline dwhitemv

  • KORJUNCT3
  • Member
  • *
  • Posts: 40
    • My PWS on Weather Underground
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #7 on: September 30, 2024, 09:00:45 PM »
As a reminder,

These changes go live at NWS tomorrow, October 1, 2024.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9565
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #8 on: September 30, 2024, 09:18:12 PM »
Yep, I'm ready.. I'll deploy nws-alerts.php V2.02 on 1-Oct-2024 to the Base-USA template and the GitHub distribution.

This mod includes the ability to use a list of lat,long coordinates in place of a Forecast and County zone (Thanks for reminding me @K6GKM)
« Last Edit: September 30, 2024, 10:20:16 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9565
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #9 on: October 01, 2024, 10:18:58 AM »
All deployed.  Note: their implementation is 01-Oct-2024 at 18:00Z, but the script works before the implementation on their site.
I've updated all my sites, the GitHub distribution and
the template update tool Base-USA, *-plugin, 01-Oct-2024

Regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9565
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #10 on: October 01, 2024, 07:20:28 PM »
Just a note.. the https://www.weather.gov/help-map/ now shows the 111 Alert titles.  The API is still showing the old list (https://api.weather.gov/alerts/types) as of 11:20 UTC on 01-Oct-2024
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 756
    • Lake Huron Weather
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #11 on: October 02, 2024, 01:35:45 PM »
Well I updated and now it appears the alerts are not being updated by my cron job.
I manually ran the file this morning around 10:38, now its 1:34 and they have not been updated.
Ideas welcome and thanks  :grin:

https://www.lakehuronweather.org/wxadvisory.php

Update, now it updated once today at just after 5pm and that is it.  Cron job is set for every 15 minutes.

« Last Edit: October 02, 2024, 05:52:50 PM by Otis »
CW3699

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9565
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #12 on: October 02, 2024, 06:41:10 PM »
I ran nws-alerts.php?mu=1 to force a reload and saw (in a view-source)
Quote
<!-- nws-alerts.php - V2.02 - 01-Oct-2024 -->
<!-- 10 unique Zone entries found. Zones='MIZ017,MIC031,MIZ095,MIC097,MIZ096,MIZ097,MIZ016,MIC047,MIZ018,MIC141' -->
<!-- manual update of cache requested -->
<!-- Cron job enabled -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIZ017 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.016 pxfer=0.040 get=0.128 total=0.168 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIC031 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.018 pxfer=0.045 get=0.145 total=0.190 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIZ095 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.017 pxfer=0.046 get=0.132 total=0.178 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIC097 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.018 pxfer=0.042 get=0.201 total=0.243 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIZ096 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.016 pxfer=0.043 get=0.099 total=0.142 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIC097 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.012 pxfer=0.039 get=0.032 total=0.071 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIZ097 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.016 pxfer=0.039 get=0.167 total=0.206 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIC097 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.012 pxfer=0.034 get=0.031 total=0.065 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIZ016 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.012 pxfer=0.034 get=0.188 total=0.222 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIC047 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.012 pxfer=0.038 get=0.120 total=0.158 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIZ018 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.012 pxfer=0.040 get=0.096 total=0.136 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- XML source: https://api.weather.gov/alerts/active.atom?zone=MIC141 -->
<!-- HTTP stats:  RC=200 dest=23.220.136.14 port=443 (from sce=192.252.156.13)
      Times: dns=0.001 conn=0.012 pxfer=0.037 get=0.307 total=0.344 secs -->
<!-- header type='application/atom+xml' -->
<!-- $zSearch no entry found - generated 'no alert' entry -->
<!-- Cache file updated: Wed 10-2-2024 6:36 pm -->
<!-- Alert box data file updated -->
<!-- Icon data file updated -->
<!-- Total process time: 2.1588 seconds -->
so it is working.  Looking at https://www.weather.gov/apx/ shows only types of
Quote
Gale Warning
Small Craft Advisory
Special Weather Statement
Hazardous Weather Outlook
and Special Weather Statement and Hazardous Weather Outlooks don't appear in the API (all the entries in your zones above returned with no alert data).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 756
    • Lake Huron Weather
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #13 on: October 02, 2024, 06:55:05 PM »
Thanks Ken, I'll keep an eye on it.  Appreciate your time.
CW3699

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 756
    • Lake Huron Weather
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #14 on: October 02, 2024, 08:21:00 PM »
Well it took me awhile but I finally remembered, only so much data storage in the ole brain.
As Ken helped trouble shoot previously my web host ICDSoft, requires a specific line added to the beginning of php scripts run through cron.

I Made the change and ran the file manually and everything seems to be running and updating as should be.

Thanks again Ken, and again  :grin:
CW3699

Offline tmabell

  • Forecaster
  • *****
  • Posts: 413
    • Mishawaka Weather
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #15 on: Yesterday at 10:36:33 AM »
This is a question for Ken.  If a guy wanted to get extravagant and specify a unique color for the alert box background depending on the actual alert, is there an easier way that than the way I'm thinking (which would entail hours of time and the addition of hundreds of lines of code)?

I'm wondering how it might look to take the NOAA Alert Map color of the highest priority, currently valid product and use that color as the alert box background.  Am I crazy?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9565
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #16 on: Yesterday at 01:00:26 PM »
So, looking into the nws-alerts.php code from curly, I found two areas that haven't been (yet) adjusted for the new NWS priorities on alerts.
Quote
// FUNCTION - set background color (severity color code)
function get_scc($scc) {
  global $tc, $bc;                        // make colors global
  $tc = 'color: #000;';
  if($scc >= 0 and $scc <= 49) {          // warning background
    $bc = 'background-color:#CC0000;';
    $tc = 'color: white;';
  }
  if($scc >= 50 and $scc <= 89) {         // advisory background
    $bc = 'background-color:#FFCC00;';
  }
  if($scc >= 90 and $scc <= 119) {        // watch background
    $bc = 'background-color:#FF9900;';
  }
  if($scc >= 120 and $scc <= 149) {       // other background
    $bc = 'background-color:#E6E6E3;';
  }
  if($scc >= 150) {                       // none background
     $bc = 'background-color:#E6E6E3;';
  }
}// end background color function

and
Quote
// FUNCTION - convert big icons
function create_bi($a,$b,$c,$d,$e,$g,$h,$i) {
  if($h >= 0 and $h <= 49) { $bi = "A-warn.png"; }
  if($h >= 50 and $h <= 89) { $bi = "A-advisory.png";   }
  if($h >= 90 and $h <= 119) { $bi = "A-watch.png"; }   
  if($h >= 120 and $h <= 139) { $bi = "A-statement.png"; }   
  if($h == 140) { $bi = "A-air.png"; }   
  if($h >= 141 and $h <= 149) { $bi = "A-alert.png"; }
  if($h == 150) { $bi = "A-none.png"; }
  if($i < 2) {$i = '';}
  if($i >= 2) {$i = $i - 1;}
  ($i == 1) ? $alrts = 'alert' : $alrts = 'alerts';
  if($i >= 1) {$i = '&nbsp; +'.$i.' additional '.$alrts;}
  $bico =  ' <a href="'.$b.'?a='.$c.'#WA'.$d.'" title=" &nbsp;Details for '.$a
           .'&nbsp;'.$e.$i.'" style="width:99%; text-decoration:none; padding-top:3px">'.$a.'<br /><img src="'.$g
           .'/'.$bi.'" alt=" &nbsp;Details for '.$a.'&nbsp;'.$e.$i
           .'" width="74" height="18" style="border:none; padding-bottom:3px" /><br /></a>
';
  return $bico;
}// end convert big icons function
so it looks like I should do an update reflecting the new NWS alert priorities.

So, to answer your question, the script automatically determines the alert-box background/text color based on just statement/advisory/watch/warning types, and not on the NWS specific background/text color for the most-severe one found.. I'll look into how that might be accomplished, but no promises.  I will update nws-alerts.php two areas cited above to align with the current NWS alert priority list.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline tmabell

  • Forecaster
  • *****
  • Posts: 413
    • Mishawaka Weather
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #17 on: Yesterday at 01:36:21 PM »
I appreciate your efforts very much Ken.  Thank you.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9565
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: NWS Alerts Script & Changes to Cold Weather Hazards
« Reply #18 on: Yesterday at 09:28:30 PM »
I've done a quick update to nws-alerts.php to pick background/color and summary icon based on type of alert (Warning, Watch, Advisory, Statement etc).

Now on the GitHub distribution and the update tool for the template set (Base-USA,*-Plugin,15-Oct-2024).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything