Make cols() return None on empty strings

This commit is contained in:
XANTRONIX 2025-02-25 16:14:33 -05:00
parent 72574b1faf
commit 1b9ea8c1f9

View file

@ -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