Make cols() return None on empty strings
This commit is contained in:
parent
72574b1faf
commit
1b9ea8c1f9
1 changed files with 4 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue