skalnik / aqi-wtf

😷 WTF is the AQI near me right now?!
https://aqi.wtf
MIT License
44 stars 12 forks source link

AQI calculations don't match PurpleAir (For good reason) #7

Closed obra closed 3 years ago

obra commented 3 years ago

It looks like you might not be filtering out indoor sensors - the nearest purpleair sensor to me is an indoor one and aqiwtf seems to show values from it, rather than the outdoor sensor 100 meters further away.

skalnik commented 3 years ago

Hm possibly the cause of #6 too. I am attending to filter indoor sensors, but the API isn’t great so probably doing it wrong. I’ll check it out. Thanks!

obra commented 3 years ago

Indeed, it looks like it's easy with their thingspeak API - the device gets tagged with DEVICE_LOCATIONTYPE: "outside"

But with the other JSON API...not so much?

https://docs.google.com/document/d/15ijz94dXJ-YAZLi9iZ_RaBwrZ4KtYeCy08goGBwnbCU/edit

is reported to be their official API docs and I'm not seeing anything.

On Sun, Sep 06, 2020 at 09:34:45AM -0700, Mike Skalnik wrote:

Hm possibly the cause of #6 too. I am attending to filter indoor sensors, but the API isn’t great so probably doing it wrong. I’ll check it out. Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.*

--

obra commented 3 years ago

No, this is something else wrong. Because I'm seeing that the sensor aqiwtf is geocoding me to is an outside sensor.

Specifcally, I'm getting sensor 39051 "Golden Gate District" in North Oakland. There's a closer sensor to me, but that's not all that far off.

AQIWTF reports the current AQI as 66. Current purpleair AQI for that same sensor is 110 with their default 10-minute-average US EPA PM2.5 calculations.

On Sun, Sep 06, 2020 at 09:34:45AM -0700, Mike Skalnik wrote:

Hm possibly the cause of #6 too. I am attending to filter indoor sensors, but the API isn’t great so probably doing it wrong. I’ll check it out. Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.*

--

skalnik commented 3 years ago

Maybe this is due to using the LRAPA adjustment as per https://thebolditalic.com/understanding-purpleair-vs-airnow-gov-measurements-of-wood-smoke-pollution-562923a55226? Additionally, it uses the immediate value, not the average.

I'll be moving to the AQandU adjustment 🔜 since that seems more recommended now.

obra commented 3 years ago

That explanation makes sense.

Out of curiosity, why use the AQandU adjustment rather than the new EPA one that PurpleAir will be adding?

It's mentioned at the bottom of that article:

The EPA has its own correction factor that iwll be more accurate than LRAPA or AQandU across a wider variety of smoke concentrations. From the EPA:“EPA’s Office of Research and Development researchers found that PurpleAir overestimate PM2.5 concentration most of the time during typical U.S. conditions (e.g. 0–50 ug/m3 typical ambient aerosol), not just during smoke impacts. The work of EPA researchers has looked at data from PurpleAir sensors operating alongside permanent monitors at 39 sites across the U.S. to develop a correction equation that reduces the high bias of the PurpleAir sensors so that they are more comparable with permanent AirNow monitors. The correction equation was also tested for performance during smoke impacted periods where concentrations are higher (tested through 250 ug/m3).” You can read about the development of this correct factor at PurpleAir PM2.5 U.S. Correction and Performance During Smoke Events 4/2020. This new formula was developed for PurpleAir concentration measurements between 0–250 ug/m3 range (>250 PurpleAir may underestimate true PM2.5), which corresponds to an AQI of 300 or less. The formula is “PM2.5 (µg/m³) = 0.524PA(cf_1) — 0.0852RH + 5.71”. To be honest, I’m not sure what this means, but if you’ve looked at the PurpleAir data closely, you might know what RH and PA(cf_1) mean.

And it's documented at:

https://cfpub.epa.gov/si/si_public_record_report.cfm?dirEntryId=349513&Lab=CEMM&simplesearch=0&showcriteria=2&sortby=pubDate&timstype=&datebeginpublishedpresented=08/25/2018

skalnik commented 3 years ago

That's a good question! A few reasons I didn't hop straight to that one:

  1. Due to the confusion between this and #6 I'm hesitant to add something I can't link to in PurpleAir.
  2. PurpleAir, as they added AQandU and LRAPA adjustments, provided a pretty simple formula to follow. The formula described here seems to include a few extra values, so I want to wait for their boiled down version.
  3. It appears we'll need to start pulling a bit more data from the sensor to do the calculation, so I want to be able to compare to their values to make sure I didn't mess it up.
obra commented 3 years ago

Those are good reasons!

Given the confusion, I wonder if it would make sense to display all the AQI measurements it's easy to calculate on the one page. That's drifting from "one number, one color", but seems like it'd help answer the "WTF" part of the question.

skalnik commented 3 years ago

Yeah I was contemplating adding an FAQ or something to help explain stuff. However I think the link is pretty helpful right now in clarification. Maybe if more folks are confused it'd make sense but I think we can hold off for now. What do you think?

obra commented 3 years ago

That's not unreasonable. (Though I do think there's some value in stating what metric you're using for the calculation)