From 6e13729a8ce049986f2807e5fb19b2e7b7d8f6e1 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial <xan@xantronix.com> Date: Sun, 13 Apr 2025 13:11:41 -0400 Subject: [PATCH] Find observed timestamp of BUFR sounding --- lib/xmet/bufr.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/xmet/bufr.py b/lib/xmet/bufr.py index bd9badd..5b07be7 100644 --- a/lib/xmet/bufr.py +++ b/lib/xmet/bufr.py @@ -1,3 +1,5 @@ +import datetime + from typing import Self from awips.dataaccess import DataAccessLayer @@ -52,6 +54,12 @@ class BUFRSounding(Sounding): sounding = BUFRSounding() + dt = response[0].getDataTime() + epoch = dt.getRefTime().time / 1000.0 + + sounding.timestamp_observed = datetime.datetime.fromtimestamp(epoch, + datetime.UTC) + for item in response: params = item.getParameters()