Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ Workaround LSRs with just TRACE #964

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ generating plots of HRRR ptype.

### Bug Fixes

- Accomodate ancient LSRs using `TRACE` as the magnitude field.
- Ensure geometries going into masking helper are CCW, to mask outside of.

## **1.21.0** (6 Sep 2024)
Expand Down
23 changes: 23 additions & 0 deletions data/product_examples/LSR/LSRSEW.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
357
NWUS56 KSEW 141924 CCA
LSRSEW

PRELIMINARY LOCAL STORM REPORT
NATIONAL WEATHER SERVICE SEATTLE WA
1124 AM PST SAT JAN 14 2012

..TIME... ...EVENT... ...CITY LOCATION... ...LAT.LON...
..DATE... ....MAG.... ..COUNTY LOCATION..ST.. ...SOURCE....
..REMARKS..

1050 AM SNOW 4 SW EVERETT 47.92N 122.25W
01/14/2012 TRACE INCH SNOHOMISH WA TRAINED SPOTTER

SLUSH ON ROADWAYS.


&&

$$

GRUB
4 changes: 4 additions & 0 deletions src/pyiem/nws/lsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ def get_lon(self):

def consume_magnitude(self, text):
"""Convert LSR magnitude text into something atomic"""
# Brute force this special case, which trips up the regex
if text.upper().strip().startswith("TRACE"):
self.magnitude_f = TRACE_VALUE
return
self.magnitude_str = text
tokens = MAG_UNITS.findall(text)
if not tokens:
Expand Down
7 changes: 7 additions & 0 deletions tests/nws/products/test_lsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
from pyiem.util import get_test_file


def test_240927_bad_qualifier():
"""Test a product that generates an invalid qualifier."""
prod = parser(get_test_file("LSR/LSRSEW.txt"))
assert prod.lsrs[0].magnitude_qualifier is None
assert abs(TRACE_VALUE - prod.lsrs[0].magnitude_f) < TRACE_VALUE


def test_240926_nolsrs():
"""Test that this processes a LSR!"""
prod = parser(get_test_file("LSR/LSRFWD.txt"))
Expand Down
Loading