From ee801726a8ed487a807ca4624c2a5e6175efe795 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Sun, 30 Mar 2025 13:16:56 -0400 Subject: [PATCH] Improve robustness of TTBB parser --- lib/xmet/raob.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/xmet/raob.py b/lib/xmet/raob.py index 542f1d1..119f820 100644 --- a/lib/xmet/raob.py +++ b/lib/xmet/raob.py @@ -407,7 +407,7 @@ class RAOBObs(): } def parse_ttbb_sample(self, tokens: list[str]) -> dict: - if tokens[0] == 'NIL': + if len(tokens) < 2 or tokens[0] == 'NIL': return {} hp = self.parse_pressure(tokens[0]) @@ -430,7 +430,10 @@ class RAOBObs(): station = self.tokens[1] samples = list() - i = 2 + sample = self.parse_ttbb_sample(self.tokens[2:4]) + samples.append(sample) + + i = 4 while i < len(self.tokens): if self.tokens[i] == '21212':