chaunceygardiner / weewx-nws

A WeeWX extension for NWS forecasts.
GNU General Public License v3.0
5 stars 1 forks source link

[Feature Request]: add new field NWSheadline for use in Alerts #6

Closed N1OTX closed 4 months ago

N1OTX commented 8 months ago

The National Weather Service API includes the field NWSheadline NWSheadline is conditional, it may or may not contain data. If present it normally contains a brief status description of a single alert. It sometimes contains a brief status description of multiple alerts separated by "... ..."

1. Example description of a single alert

                "NWSheadline": [
                    "FLOOD WARNING NOW IN EFFECT UNTIL EARLY WEDNESDAY MORNING"
                ],

Possible use in a template such as forecast_alerts.inc could be: Get tag

try

    #set $NWSheadline = $alert.NWSheadline.replace("\n", " ").replace('... ...','<br>')+"<br>"
  #except
    ## Calling replace has failed because of malformed alerts.
    ## alert.NWSheadline is probably None
    #set $NWSheadline = ""

Displayed as HTML

$NWSheadline $headline

FLOOD WARNING NOW IN EFFECT UNTIL EARLY WEDNESDAY MORNING Flood Warning issued March 22 at 5:21PM CDT until March 27 at 2:00AM CDT by NWS Tallahassee FL

2. Example description of multiple alerts

                "NWSheadline": [
                    "HIGH RIP CURRENT RISK REMAINS IN EFFECT THROUGH LATE SATURDAY NIGHT... ...COASTAL FLOOD ADVISORY REMAINS IN EFFECT UNTIL 7 AM EDT SATURDAY"
                ],

Displayed as HTML

$NWSheadline $headline

HIGH RIP CURRENT RISK REMAINS IN EFFECT THROUGH LATE SATURDAY NIGHT COASTAL FLOOD ADVISORY REMAINS IN EFFECT UNTIL 7 AM EDT SATURDAY Rip Current Statement issued March 22 at 9:52PM EDT until March 24 at 3:00AM EDT by NWS Tallahassee FL

Attached patch file (PatchFile_Nwsheadline) against nws.py from v2.3 release adds NWSheadline to Schema for nws database (nws.sdb) PatchFile_Nwsheadline.txt

Thoughts: I find the NWSheadline tag useful and have been using the patched nws.py for about 6 months, without noticing any issues. However implementation cost is somewhat high: New nws database schema will require deletion of users existing nws database Also if it's required to breakup long lines in $NWSheadline, similar to $headline additional refactoring will be required in forecast_alerts.inc Not sure if this small feature justifies the implementation cost.

chaunceygardiner commented 4 months ago

I’ve implemented nwsHeadline (note the spelling) in release v4.1. It is odd that it is an array and I couldn’t find any case where there is more than one element. For now, if more than one is encountered, I concatenate them (comma separated). I also don’t know if the headline can include more than one alert (as you suggest). If that is so; perhaps, when there are multiple alerts, all the nwsHeadlines contain the same value (headline for each and every alert). I’ll see how this pans out when I encounter the situation and adjust the sample report accordingly.

N1OTX commented 4 months ago

Thanks for implementing this ,I appreciate it. NWSheadline can include mentions of multiple alerts Such as: "NWSheadline": [ "EXCESSIVE HEAT WARNING REMAINS IN EFFECT UNTIL 9 PM CDT THIS EVENING... ...HEAT ADVISORY IN EFFECT FROM NOON TO 9 PM CDT SATURDAY" ],

Notice how the text reference is separated by "... ..." this is consistent , always seems to be included when multiple alerts are mentioned. This separator makes it convenient to parse all active NWS alerts to get a good idea of what form they take, way easier than me trying to explain it :). This yielded 175 examples as I'am typing. curl -s "https://api.weather.gov/alerts/active"|grep -C 1 "... ..." In alert A NWSheadline might make reference to alert B. In alert B NWSheadline might make reference to alert A. Some times NWSheadline is exactly the same in A and B. Some times NWSheadline A mentions A first then B. Some times NWSheadline B mentions B first then A. Seems to vary how it's done by each Weather Forecast Office. And seemingly some WFO are more consistent than others.

Paul

On Thu, Jun 27, 2024 at 5:46 PM John Kline @.***> wrote:

I’ve implemented nwsHeadline (note the spelling) in release v4.1. It is odd that it is an array and I couldn’t find any case where there is more than one element. For now, if more than one is encountered, I concatenate them (comma separated). I also don’t know if the headline can include more than one alert (as you suggest). If that is so; perhaps, when there are multiple alerts, all the nwsHeadlines contain the same value (headline for each and every alert). I’ll see how this pans out when I encounter the situation and adjust the sample report accordingly.

— Reply to this email directly, view it on GitHub https://github.com/chaunceygardiner/weewx-nws/issues/6#issuecomment-2195712344, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARDJT4V56ZWCM22SRA4DFYDZJSBZZAVCNFSM6AAAAABFEWYVIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJVG4YTEMZUGQ . You are receiving this because you authored the thread.Message ID: @.***>

chaunceygardiner commented 4 months ago

I took another look at all the current alerts, the first one I came across with “…” in NWSHeadline is below. It does not appear that the “…” is used to separate distinct alerts.

"NWSheadline": [ "A SEVERE THUNDERSTORM WARNING REMAINS IN EFFECT UNTIL 745 PM CDT FOR NORTHEASTERN POTTAWATOMIE...SOUTHWESTERN NEMAHA...NORTHWESTERN JACKSON AND SOUTHEASTERN MARSHALL COUNTIES" ],

N1OTX commented 4 months ago

Normally three periods + space plus three periods separate "... ..." SOMETHING, normally the two parts are descriptions of 2 active events. However sometimes it's used in different ways such as this made up example: EXCESSIVE HEAT WARNING REMAINS IN EFFECT UNTIL 9 PM CDT THIS EVENING... ....BE SURE TO STAY HYDRATED" I Set up a test system today with WEEWX-NWS 4.1 and captured real data from an area that had 2 active alerts. Alerts page template as released. Also captured the same alerts with the alert template I have used for a long time, fed with data from WEEWX-NWS 4.1 as well. Mine is a little hard to follow because it's a HTML

Tag which is fully open so you can see it all, normally it would be collapsed and shown as an old school type banner with the highest priority alert name, and alert count.

My subjective opinion is that the WEEWX alerts template looks OK, but might be better if the separator was removed, then each half could be longline checked separately. One man's opinion, you're the boss, do as you see fit :)

P.S. OMG what a rabbit hole so sorry I started you on this journey !

Paul

On Fri, Jun 28, 2024 at 8:27 PM John Kline @.***> wrote:

I took another look at all the current alerts, the first one I came across with “…” in NWSHeadline is below. It does not appear that the “…” is used to separate distinct alerts.

"NWSheadline": [ "A SEVERE THUNDERSTORM WARNING REMAINS IN EFFECT UNTIL 745 PM CDT FOR NORTHEASTERN POTTAWATOMIE...SOUTHWESTERN NEMAHA...NORTHWESTERN JACKSON AND SOUTHEASTERN MARSHALL COUNTIES" ],

— Reply to this email directly, view it on GitHub https://github.com/chaunceygardiner/weewx-nws/issues/6#issuecomment-2197795122, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARDJT4RELLRBIA6SLSFF3D3ZJX5ODAVCNFSM6AAAAABFEWYVIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXG44TKMJSGI . You are receiving this because you authored the thread.Message ID: @.***>

N1OTX commented 4 months ago

Changing my mind about removing the separator and treating each portion separately . Played around some more with different areas that had multiple active alerts with nwsHeadline . Splitting them first would automatically create 2 lines of text, some of them are longer than 80 characters , so another line for each that's over 80 , quickly gets crazy with 4 or more lines of headlines. Visual aesthetics of that is too busy. Leaving as it has grown on me as I tested various alerts.

This is how it is now, starting to look great to me:

              EXCESSIVE HEAT WARNING REMAINS IN EFFECT FROM 10 AM THIS

MORNING TO 7 PM CDT THIS EVENING... ...EXCESSIVE HEAT WATCH IN EFFECT FROM TUESDAY MORNING THROUGH TUESDAY EVENING Done my mindless rambling of this seemingly trivial subject :)

Paul

On Sat, Jun 29, 2024 at 11:47 PM Paul R Anderson @.***> wrote:

Normally three periods + space plus three periods separate "... ..." SOMETHING, normally the two parts are descriptions of 2 active events. However sometimes it's used in different ways such as this made up example: EXCESSIVE HEAT WARNING REMAINS IN EFFECT UNTIL 9 PM CDT THIS EVENING... ....BE SURE TO STAY HYDRATED" I Set up a test system today with WEEWX-NWS 4.1 and captured real data from an area that had 2 active alerts. Alerts page template as released. Also captured the same alerts with the alert template I have used for a long time, fed with data from WEEWX-NWS 4.1 as well. Mine is a little hard to follow because it's a HTML

Tag which is fully open so you can see it all, normally it would be collapsed and shown as an old school type banner with the highest priority alert name, and alert count.

My subjective opinion is that the WEEWX alerts template looks OK, but might be better if the separator was removed, then each half could be longline checked separately. One man's opinion, you're the boss, do as you see fit :)

P.S. OMG what a rabbit hole so sorry I started you on this journey !

Paul

On Fri, Jun 28, 2024 at 8:27 PM John Kline @.***> wrote:

I took another look at all the current alerts, the first one I came across with “…” in NWSHeadline is below. It does not appear that the “…” is used to separate distinct alerts.

"NWSheadline": [ "A SEVERE THUNDERSTORM WARNING REMAINS IN EFFECT UNTIL 745 PM CDT FOR NORTHEASTERN POTTAWATOMIE...SOUTHWESTERN NEMAHA...NORTHWESTERN JACKSON AND SOUTHEASTERN MARSHALL COUNTIES" ],

— Reply to this email directly, view it on GitHub https://github.com/chaunceygardiner/weewx-nws/issues/6#issuecomment-2197795122, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARDJT4RELLRBIA6SLSFF3D3ZJX5ODAVCNFSM6AAAAABFEWYVIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXG44TKMJSGI . You are receiving this because you authored the thread.Message ID: @.***>