sensortoolkit.calculate._aqi.aqi
- aqi(data, column=None)[source]
Calculate US EPA’s air quality index for fine particulate matter.
- Information about EPA’s AQI scale here:
https://aqs.epa.gov/aqsweb/documents/codetables/aqi_breakpoints.html
EPA defines breakpoints for concentrations with a precision of 0.1 µg/m³. Since most PM2.5 concentration datasets tend to have higher reporting precision than 0.1 µg/m³, this introduces some ambiguity regarding how AQI is calculated for concentration values in between breakpoints set at 0.1 µg/m³ precision.
Here, the breakpoints are set so that the concentration values adhere to the AQI catagory at the breakpoints by following rounding conventions (values within the range of category high breakpoint + 0.05 (e.g., ‘Good’ C_h = 12.05) are assigned to the lower category, if high breakpoint + 0.05 < concentration value < high breakpoint + 0.10 then set as upper category AQI value).
Concentration values < 0 and > 99,999 are ignored by this module (both the AQI value and category return null)
- Parameters
data (float, int, numpy array, or pandas dataframe) – PM2.5 concentration value(s). If dataframe, column must be labeled
PM25_Value
.column (str, optional) – If the passed data object is type pandas DataFrame, the name of the column in the dataset corresponding to fine particulate matter concentration data.
- Returns
A pandas dataframe with PM25 concentrations, AQI values, and corresponding AQI category names.
- Return type
data (pandas DataFrame)
- Raises
KeyError – If passed data object is type pandas dataframe and the column argument is null.