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

[Suggestion] Add AQI (Air Quality Index) #105

Closed
Rayrsn opened this issue Aug 12, 2022 · 7 comments · Fixed by #171
Closed

[Suggestion] Add AQI (Air Quality Index) #105

Rayrsn opened this issue Aug 12, 2022 · 7 comments · Fixed by #171
Labels
enhancement New feature or request

Comments

@Rayrsn
Copy link
Contributor

Rayrsn commented Aug 12, 2022

It would be awesome if you could provide AQI information too. (or at least help me calculate it myself with the current information provided by the API)

@patrick-zippenfenig patrick-zippenfenig added the enhancement New feature or request label Aug 15, 2022
@patrick-zippenfenig
Copy link
Member

I already wanted to do it, but one threshold is an 8 hour rolling average of CO (irrc). Currently it is not easy to get data from different time ranges. I have to do some refactoring first.

Thanks for the suggestion and the CLI utility!

@drmrbrewer
Copy link
Contributor

A value for AQI would be a really nice addition! +1

@patrick-zippenfenig patrick-zippenfenig linked a pull request Dec 5, 2022 that will close this issue
@patrick-zippenfenig
Copy link
Member

First draft on localhost... Wdyt?

Based on https://www.eea.europa.eu/themes/air/air-quality-index Thresholds are explained after clicking "About the European Air Quality Index". The only annoyance is that the index range from 0 to 100 is not well defined in the specification and I had to "invent" it. It is similar however to the old common air quality index

Screenshot 2022-12-06 at 10 26 46

Screenshot 2022-12-06 at 10 26 57

@drmrbrewer
Copy link
Contributor

drmrbrewer commented Dec 6, 2022

Looks promising!

I agree that the info doesn't make it completely clear. My understanding from a quick read is that the following is key:

The index corresponds to the poorest level for any of five pollutants, according to the table shown below.

(though a subset of the "five" pollutants is used in different scenarios)

So the index is not some sort of amalgamation/combination of all five (or subset of five) values but rather it's just based on the value for the worst one.

Just thinking aloud, let's say the poorest level for a particular location is a value of 125 for O3, based on a scale of 0 to 800 (because "Air quality measurements that exceed the maximum values in the ‘extremely poor’ category are not taken into account for the index calculation, since these values are typically found to be erroneous"). So the Index would be 100 * 125 / 800 = 15.6?

@patrick-zippenfenig
Copy link
Member

PR merged! Final version now contains European and U.S. AQI

The tables now only show thresholds in ug/m3 or ppm. Each threshold is evaluated as a piecewise linear function as explained on wikipedia. So 125 ugm3 ozone would be in the range of 100-130 (moderate) and result in an index value of ~56 (index 40-60 is moderate).

Both EU and US indices use different scales

Screenshot 2022-12-09 at 15 33 04

Screenshot 2022-12-09 at 15 33 18

@drmrbrewer
Copy link
Contributor

@patrick-zippenfenig great work! It would be nice to add the MEP index for China too... if I have a moment to try and figure out how you've done it for the others, I could attempt a PR... wouldn't completely trust myself though!

@papjul
Copy link

papjul commented Jun 7, 2023

Based on https://www.eea.europa.eu/themes/air/air-quality-index Thresholds are explained after clicking "About the European Air Quality Index". The only annoyance is that the index range from 0 to 100 is not well defined in the specification and I had to "invent" it. It is similar however to the old common air quality index

The official website uses a scale from 1.00 to 6.00+. See API calls:
image

I believe the app uses the same API to be able to render a progressive circle:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants