← API Reference

elwood_spatial.air_quality

Domain-specific utilities for air quality monitoring. Provides EPA-compliant AQI bin presets and PM2.5 ↔ AQI conversion functions based on 40 CFR 58 Appendix G breakpoints.

Presets

AQI_BINS

Standard EPA 6-bin AQI categories.

BinRangeCategory
00 – 50Good
151 – 100Moderate
2101 – 150Unhealthy for Sensitive Groups
3151 – 200Unhealthy
4201 – 300Very Unhealthy
5301 – 500Hazardous

AQI_MODIFIED_BINS

Modified 12-bin percentile categories from the paper, with transition zones at category boundaries.

BinRangeLabel
00 – 44.9G
145 – 55.9GM
256 – 95M
395.1 – 105.9MUSG
4106 – 145USG
5145.1 – 155.9USGU
6156 – 195U
7195.1 – 210.9UVU
8211 – 290VU
9290.1 – 320.9VUH
10321 – 500H
11501 – 99999BH

pm25_to_aqi(pm25)

Convert a PM2.5 concentration (µg/m³) to an AQI value using EPA breakpoints.

ParameterTypeDescription
pm25floatPM2.5 concentration

Returns int | None. Returns None for None input, 0 for negative values.

from elwood_spatial.air_quality import pm25_to_aqi

pm25_to_aqi(35.0)   # => 100
pm25_to_aqi(55.4)   # => 150

aqi_to_pm25(aqi)

Inverse conversion — AQI value to PM2.5 concentration.

ParameterTypeDescription
aqifloatAQI value

Returns float | None. Rounded to 1 decimal place.