Closed enovity closed 6 years ago
Do you happen to know the usaf_id for the station it's failing on? Definitely a bug, I'd like to reproduce it locally.
@philngo Not sure exactly, but if you just go into the metadata database and grab one of the weather stations where the elevation is null and try to instantiate an ISDStation, I think it will trigger the error. I replaced all the null elevations with a very high value as a hacky workaround, so this doesn't work on my machine now.
from eeweather.connections import metadata_db_connection_proxy
from eeweather import ISDStation
conn = metadata_db_connection_proxy.get_connection()
cur = conn.cursor()
cur.execute('''
select
usaf_id
from
isd_station_metadata
where
elevation IS NULL
''')
row = cur.fetchone()
station = ISDStation(row[0])
@enovity I found one - should be fixed now, released as 0.3.6.
The
select_station
function tries to create anISDStation
instance for each weather station in therank_stations
result. When creating each ISDStation instance, the instance creation attempts to call theself._load_medata
function, which attempts to caste numerical metadata values as floats. When they're missing from the metadata database, it causes a type error.Example traceback: