Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Force convert into float (np.nan if fails) #126

Merged
merged 3 commits into from
Apr 23, 2022

Conversation

lahdjirayhan
Copy link
Contributor

@lahdjirayhan lahdjirayhan commented Apr 23, 2022

This PR tries to solve the problem previously written up in #120 (comment) (point no 2)

It introduces a helper method that tries to convert its input into float, and if that fails, gives out numpy.nan.

In light of the fact that WAQI backend sometimes sends invalid AQI value (e.g. - as noted above), I've also modified the _AQI_meaning method to return an "invalid" description rather than raising exception, to allow values such as np.nan to be given as its input without raising exceptions,

This will allow for invalid AQIs (e.g., np.nan) to be passed without
raising exception. This can better handle cases where WAQI data is out of bound.
I've personally seen cases of AQI values '999' and '-'.
@Milind220 Milind220 added this to the Make Ozone pass tests pt.1 milestone Apr 23, 2022
Milind220
Milind220 previously approved these changes Apr 23, 2022
src/ozone/ozone.py Outdated Show resolved Hide resolved
src/ozone/ozone.py Show resolved Hide resolved
src/ozone/ozone.py Show resolved Hide resolved
@Milind220 Milind220 dismissed their stale review April 23, 2022 03:07

Need to request changes, approved by accident

@Milind220 Milind220 merged commit 5f48942 into Ozon3Org:dev Apr 23, 2022
@lahdjirayhan lahdjirayhan deleted the fix-float-unable branch April 23, 2022 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants