Skip to content

Commit

Permalink
Merge pull request #248 from akrherz/pirep_afos
Browse files Browse the repository at this point in the history
feat: add fake_afos support for PIREP
  • Loading branch information
akrherz authored Jul 31, 2024
2 parents f84432a + 61c8d03 commit 58892c0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pqact.d/pqact_afos.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ IDS|DDPLUS ^UR.... (KNHC|KWBC)
# G-AIRMET (XML) for NTSB
IDS|DDPLUS ^LW(G|H|I)E.. KKCI
PIPE pywwa-parse-fake-afos-dump
# PIREPs
WMO ^UB
PIPE pywwa-parse-fake-afos-dump

IDS|DDPLUS ^CDUS27
PIPE pywwa-parse-dsm2afos
Expand Down
2 changes: 2 additions & 0 deletions src/pywwa/workflows/fake_afos_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def compute_afos(textprod):
ttaaii = textprod.wmo
if ttaaii[:4] == "NOXX":
afos = f"ADM{textprod.source[1:]}"
elif ttaaii.startswith("UB"):
afos = "PIREP"
elif ttaaii in GMET:
afos = GMET[ttaaii]
elif MIS.match(ttaaii):
Expand Down
9 changes: 9 additions & 0 deletions tests/workflows/test_fake_afos_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@

# Local
import pywwa
from pyiem.nws.products.pirep import Pirep
from pyiem.util import utc
from pywwa.testing import get_example_file
from pywwa.workflows import fake_afos_dump


def test_fake_pirep():
"""Test fake PIREP."""
tp = Pirep(get_example_file("PIREP.txt"), utcnow=utc(2024, 7, 9, 0, 0))
assert tp.afos is None
fake_afos_dump.compute_afos(tp)
assert tp.afos == "PIREP"


@pytest.mark.parametrize("database", ["afos"])
def test_processor(cursor):
"""Test basic parsing."""
Expand Down

0 comments on commit 58892c0

Please sign in to comment.