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 IndexError when concentration is outside of EPA range #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andriykorchak
Copy link

Hi @hrbonz

Thanks for this great library.

I've found a minor edge case issue. I currently handle it in the calling code, but it would be nice to take care of it in the library.

Currently If pollutant concentration is outside of the lookup table range iaqi() function will crash with IndexError.

This PR fixes it. If the concentration is lower or higher than the range defined in the look up table, the function will return lowest or highest AQI value from the table accordingly.

Please let me know what you think about these changes.

Thanks.

Andrii

e28eta added a commit to e28eta/pyportal-aqi that referenced this pull request Mar 25, 2021
hrbonz/python-aqi#22

This started happening to me. PurpleAir thinks there's a bug or debris in the sensor
I've chosen to display. 🤷‍♂️

Nothing I can do about the bad sensor, but this is greatly preferable to having the
project crash.
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.

1 participant