From 1b9ea8c1f929a993b97be8948abd02a869d40e4f Mon Sep 17 00:00:00 2001
From: XANTRONIX Industrial <xan@xantronix.com>
Date: Tue, 25 Feb 2025 16:14:33 -0500
Subject: [PATCH] Make cols() return None on empty strings

---
 lib/xmet/igra.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/xmet/igra.py b/lib/xmet/igra.py
index bdc9cd8..9c1372c 100644
--- a/lib/xmet/igra.py
+++ b/lib/xmet/igra.py
@@ -184,7 +184,9 @@ def cols(text: str, start: int, end: int):
     a = start - 1
     b = end
 
-    return text[a:b]
+    ret = text[a:b]
+
+    return None if ret == '' else ret
 
 class IGRAStation(DatabaseTable):
     __table__ = 'xmet_igra_station'
@@ -221,7 +223,7 @@ class IGRAStation(DatabaseTable):
 
     def __init__(self):
         super().__init__()
-        self.code = None
+        self.code       = None
         self.year_start = None
         self.year_end   = None
         self.name       = None
@@ -243,9 +245,6 @@ class IGRAStation(DatabaseTable):
         station.elevation  = float(cols(line, 32, 37))
         station.location   = shapely.Point(lon, lat)
 
-        if station.state == '':
-            station.state = None
-
         return station
 
     @staticmethod