Skip to content

Commit

Permalink
Merge pull request #627 from akrherz/timestamp
Browse files Browse the repository at this point in the history
correct decoding of 12 UTC timestamp
  • Loading branch information
akrherz authored Jun 27, 2022
2 parents 0364e69 + a56241b commit 651ce25
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@

All notable changes to this library are documented in this file.

## Unreleased Version

### API Changes

### New Features

### Bug Fixes

- Correct decoding of 12 UTC timestamp in MND header.

## **1.13.0** (24 Jun 2022)


### API Changes

- Added `sqlalchemy` as a hard package requirement.
Expand Down
44 changes: 44 additions & 0 deletions data/product_examples/TPTLAT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
949
ABXX07 KWBC 271200
TPTLAT

LATIN AMERICAN TEMP AND WEATHER TABLE
NWS TELECOMMUNICATION OPERATIONS CENTER SILVER SPRING MD
1200 UTC MON JUN 27 2022

PRESENT LOCAL TEMPS
CITY WEATHER TIME F C

ANTIGUA FAIR 8AM 82 28
ASUNCION 8AM 61 16
BELIZE CITY FAIR 6AM 79 26
BOGOTA FOG 7AM 50 10
BRIDGETOWN FAIR 8AM 82 28
BUENOS AIRES FAIR 9AM 48 9
CARACAS PTCLDY 8AM 81 27
CAYENNE CLDY 9AM 77 25
GEORGETOWN HAZE 8AM 79 26
GUATEMALA CITY CLDY 6AM 63 17
HAVANA CLDY 7AM 73 23
KINGSTON FAIR 7AM 81 27
LA PAZ 8AM 37 3
LIMA MIST 7AM 59 15
MANAGUA FAIR 6AM 75 24
MEXICO CITY CLDY 6AM 59 15
MONTEVIDEO CLDY 9AM 48 9
PANAMA CITY PTCLDY 6AM 77 25
PARAMARIBO PTCLDY 8AM 75 24
PORT AU PRINCE FAIR 8AM 81 27
PORT OF SPAIN RAIN 8AM 82 28
QUITO 7AM NO DATA
RIO DE JANEIRO CLDY 9AM 64 18
SAINT THOMAS PTCLDY 8AM 82 28
SAN JOSE FAIR 6AM 66 19
SAN JUAN PTCLDY 8AM 81 27
SAN SALVADOR 6AM NO DATA
SANTIAGO MISTY 8AM 32 0
SANTO DOMINGO FAIR 7AM 79 26
SAO PAULO CLDY 9AM 57 14
TEGUCIGALPA CLDY 6AM 63 17

$$
2 changes: 1 addition & 1 deletion src/pyiem/nws/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def date_tokens2datetime(tokens):
hh = hhmi[:-2]
mi = hhmi[-2:]
# Workaround 24 hour clock abuse
if int(hh) > 12 and (
if int(hh) >= 12 and (
tokens[1].upper() == "PM" or tokens[2] in ["UTC", "GMT"]
):
# this is a hack to ensure this is PM when we are in UTC
Expand Down
6 changes: 6 additions & 0 deletions tests/nws/test_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
from pyiem.util import utc, get_test_file


def test_220627_timestamp():
"""Test that the right timestamp is parsed."""
prod = productparser(get_test_file("TPTLAT.txt"))
assert prod.valid == utc(2022, 6, 27, 12)


def test_frwoun_jabber():
"""Test that we get a special twitter media out of this."""
prod = productparser(get_test_file("FRW/FRWOUN.txt"))
Expand Down

0 comments on commit 651ce25

Please sign in to comment.