From 8787a3777377dd626ee0b6ed1d5b49f9165c4b82 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Sun, 2 Mar 2025 13:13:31 -0500 Subject: [PATCH] Fix IGRA release timestamp --- lib/xmet/igra.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/xmet/igra.py b/lib/xmet/igra.py index 8196cf1..0450863 100644 --- a/lib/xmet/igra.py +++ b/lib/xmet/igra.py @@ -131,6 +131,13 @@ class IGRAReader(): if match['relmin'] != '99': timestamp_release += datetime.timedelta(minutes=int(match['relmin'])) + # + # Ensure the release timestamp always comes before the observation + # (valid) timestamp. + # + if timestamp_release > timestamp: + timestamp_release -= datetime.timedelta(days = 1) + lat = int(match['lat']) / 1000.0 lon = int(match['lon']) / 1000.0