You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an issue while using the WyomingUpperAir class to download and parse upper air observations, specifically when dealing with data from certain stations that have missing or erroneous metadata.
For example, the entire 2022 data for station 95282 has missing or incorrect values for Station latitude , Station elevation and Station longitute. The current implementation of the _get_data method does not handle these cases well, leading to a ValueError when it tries to parse these fields into floats.
Here is a sample traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: could not convert string to float: '******'
This issue could be resolved by adding exception handling to the float conversion process. Here's a proposed solution:
In this solution, a helper function safe_float is used to attempt the float conversion, and if it fails, np.nan is returned instead. This prevents a ValueError from being raised and allows the function to complete successfully, even if some metadata fields cannot be converted to floats.
This issue is particularly important because it affects the usability of the library for any station with missing or erroneous metadata, not just station 95282.
I hope this information is helpful and look forward to your feedback.
Best regards,
Nero Jia
The text was updated successfully, but these errors were encountered:
Body:
Hello,
I encountered an issue while using the
WyomingUpperAir
class to download and parse upper air observations, specifically when dealing with data from certain stations that have missing or erroneous metadata.For example, the entire 2022 data for station 95282 has missing or incorrect values for
Station latitude
,Station elevation
andStation longitute
. The current implementation of the_get_data
method does not handle these cases well, leading to aValueError
when it tries to parse these fields into floats.Here is a sample traceback:
This issue could be resolved by adding exception handling to the float conversion process. Here's a proposed solution:
In this solution, a helper function
safe_float
is used to attempt the float conversion, and if it fails,np.nan
is returned instead. This prevents aValueError
from being raised and allows the function to complete successfully, even if some metadata fields cannot be converted to floats.This issue is particularly important because it affects the usability of the library for any station with missing or erroneous metadata, not just station 95282.
I hope this information is helpful and look forward to your feedback.
Best regards,
Nero Jia
The text was updated successfully, but these errors were encountered: