Skip to content

Commit 58892c0

Browse files
authored
Merge pull request #248 from akrherz/pirep_afos
feat: add fake_afos support for PIREP
2 parents f84432a + 61c8d03 commit 58892c0

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

pqact.d/pqact_afos.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ IDS|DDPLUS ^UR.... (KNHC|KWBC)
4444
# G-AIRMET (XML) for NTSB
4545
IDS|DDPLUS ^LW(G|H|I)E.. KKCI
4646
PIPE pywwa-parse-fake-afos-dump
47+
# PIREPs
48+
WMO ^UB
49+
PIPE pywwa-parse-fake-afos-dump
4750

4851
IDS|DDPLUS ^CDUS27
4952
PIPE pywwa-parse-dsm2afos

src/pywwa/workflows/fake_afos_dump.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def compute_afos(textprod):
4545
ttaaii = textprod.wmo
4646
if ttaaii[:4] == "NOXX":
4747
afos = f"ADM{textprod.source[1:]}"
48+
elif ttaaii.startswith("UB"):
49+
afos = "PIREP"
4850
elif ttaaii in GMET:
4951
afos = GMET[ttaaii]
5052
elif MIS.match(ttaaii):

tests/workflows/test_fake_afos_dump.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@
55

66
# Local
77
import pywwa
8+
from pyiem.nws.products.pirep import Pirep
89
from pyiem.util import utc
910
from pywwa.testing import get_example_file
1011
from pywwa.workflows import fake_afos_dump
1112

1213

14+
def test_fake_pirep():
15+
"""Test fake PIREP."""
16+
tp = Pirep(get_example_file("PIREP.txt"), utcnow=utc(2024, 7, 9, 0, 0))
17+
assert tp.afos is None
18+
fake_afos_dump.compute_afos(tp)
19+
assert tp.afos == "PIREP"
20+
21+
1322
@pytest.mark.parametrize("database", ["afos"])
1423
def test_processor(cursor):
1524
"""Test basic parsing."""

0 commit comments

Comments
 (0)