Skip to content

Commit

Permalink
add IBW tags to jabber channels
Browse files Browse the repository at this point in the history
refs #11
  • Loading branch information
akrherz committed Jun 28, 2023
1 parent 9f40a6e commit 226c610
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ All notable changes to this library are documented in this file.
### New Features

- Add bling to jabber messages generated from PNS Damage Surveys.
- Add Impact Based Warning tags to jabber channels in the form of
`<phenomena>.<significance>.<tag>` (#11).
- Add parser for Wind/Temps Aloft Forecast product (AWIPSID: FD) (#713).
- Add `twitter_media` for LSR jabber messages.
- Persist Summary LSR product identifier to database (akrherz/pyWWA#150).
Expand Down
13 changes: 6 additions & 7 deletions src/pyiem/nws/products/_vtec_jabber.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

def build_channels(prod, segment, vtec) -> list:
"""Build a list of channels for the given segment/vtec."""
ps = f"{vtec.phenomena}.{vtec.significance}"
channels = []
# Two noisey products that don't default to the main WFO channel
if prod.afos[:3] in ["MWW", "RFW"]:
Expand All @@ -21,20 +22,18 @@ def build_channels(prod, segment, vtec) -> list:
channels.append(prod.source[1:])
# GH604 - Append a -ACTION for CON, EXP, CAN actions
suffix = f"-{vtec.action}" if vtec.action in ["CON", "EXP", "CAN"] else ""
if vtec.action not in ["EXP", "CAN"] and segment.damagetag is not None:
channels.append(f"{ps}.{segment.damagetag}")
channels.append(f"{vtec.s2()}{suffix}")
channels.append(prod.afos)
channels.append(f"{prod.afos[:3]}...")
channels.append(
f"{vtec.phenomena}.{vtec.significance}.{vtec.office}{suffix}"
)
channels.append(f"{ps}.{vtec.office}{suffix}")
for ugc in segment.ugcs:
# per state channels
candidate = f"{vtec.phenomena}.{vtec.significance}.{ugc.state}{suffix}"
candidate = f"{ps}.{ugc.state}{suffix}"
if candidate not in channels:
channels.append(candidate)
channels.append(
f"{vtec.phenomena}.{vtec.significance}.{str(ugc)}{suffix}"
)
channels.append(f"{ps}.{str(ugc)}{suffix}")
channels.append(str(ugc))
return channels

Expand Down
8 changes: 8 additions & 0 deletions tests/nws/products/test_products_vtec.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ def filter_warnings(ar, startswith="get_gid"):
return [a for a in ar if not a.startswith(startswith)]


def test_230628_ibwthunderstorm():
"""Test the tags created with this SVR."""
data = get_test_file("SVR/SVRPSR_IBW1.txt")
prod = vtecparser(data.replace("CONSIDERABLE", "DESTRUCTIVE"))
j = prod.get_jabbers("")
assert j[0][2]["channels"].find("SV.W.DESTRUCTIVE") > -1


@pytest.mark.parametrize("database", ["postgis"])
def test_230418_index_error(dbcursor):
"""Test this product for not generating an index error."""
Expand Down

0 comments on commit 226c610

Please sign in to comment.