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 a = start - 1
b = end b = end
return text[a:b] ret = text[a:b]
return None if ret == '' else ret
class IGRAStation(DatabaseTable): class IGRAStation(DatabaseTable):
__table__ = 'xmet_igra_station' __table__ = 'xmet_igra_station'
@ -243,9 +245,6 @@ class IGRAStation(DatabaseTable):
station.elevation = float(cols(line, 32, 37)) station.elevation = float(cols(line, 32, 37))
station.location = shapely.Point(lon, lat) station.location = shapely.Point(lon, lat)
if station.state == '':
station.state = None
return station return station
@staticmethod @staticmethod