Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
2
midnightlightning avatar

I believe this function stops one step short of returning the actual "AQI" value. The last step of this function is to calculate the weightedValuesSum / weightFactorSum which in the referenced Observable notebook is the nowCastConcentration value (a weighted average pm25 concentration value).

To turn it into an "AQI" number, there's one more step needed: mapping that to bands of what levels of concentration are safe or not (the concentrationToAqi function in the Observable notebook). Which this function seems to be missing?

Also note, the concentrationBreakpoints used in the notebook [0,12.0,35.4,150,200,300,500] are from a previous standard. In May 2024, the guidelines were updated and should now be [0,9.0,35.4,55.4,125.4,225.4]

russbiggs avatar

You are absolutely right. I have forgotten to add the final step of converting from the concentration to the actual AQI, even though i based its off the notebook... Ill update accordingly and with the updated EPA breakpoints

Updated: October 23, 2023