Package: aqicalc
A library to convert between AQI value and pollutant concentration
(µg/m³ or ppm) using the following algorithms:United States Environmental Protection Agency (EPA)China Ministry of Environmental Protection (MEP)Central Pollution Control Board (CPCB) IndiaForked from python-aqi libraryChanges from the original libraryAdded CPCB AQI CalculationAdded IEMA Brazil AQI CalculationAdded Kuwait AQIAdded Unit Conversion FunctionsAdded Exception Handling (returns the number or NaN back if it can’t convert)Install$ pip install aqicalcUsageLibraryNOTE: Different standards use different units for calculating AQI, use the appropriate units to get correct results. Examples for getting the units for each standards as well as unit conversion is avaiable (examples soon!)Convert a pollutant to its IAQI (Intermediate Air Quality Index):import aqicalc as aqi
myaqi = aqi.to_iaqi(aqi.POLLUTANT_PM25, '12', algo=aqi.ALGO_EPA)Get an AQI out of several pollutant concentrations, default algorithm is EPA:import aqicalc as aqi
myaqi = aqi.to_aqi([
    (aqi.POLLUTANT_PM25, '12'),
    (aqi.POLLUTANT_PM10, '24'),
    (aqi.POLLUTANT_O3_8H, '0.087')
])Convert an IAQI to its pollutant concentration:import aqicalc as aqi
mycc = aqi.to_cc(aqi.POLLUTANT_PM25, '22', algo=aqi.ALGO_EPA)Command lineList supported algorithms and pollutants:$ aqi -l
aqi.algos.epa: pm10 (µg/m³), o3_8h (ppm), co_8h (ppm), no2_1h (ppb), o3_1h (ppm), so2_1h (ppb), pm25 (µg/m³)
aqi.algos.mep: no2_24h (µg/m³), so2_24h (µg/m³), no2_1h (µg/m³), pm10 (µg/m³), o3_1h (µg/m³), o3_8h (µg/m³), so2_1h (µg/m³), co_1h (mg/m³), pm25 (µg/m³), co_24h (mg/m³)Convert PM2.5 to IAQI using EPA algorithm:$ aqi aqi.algos.epa pm25:12
50Convert PM2.5 to IAQI using EPA algorithm (full length):$ aqi -c aqi aqi.algos.epa pm25:12
50Convert pollutants concentrations to AQI using EPA algorithm:$ aqi aqi.algos.epa pm25:40.9 o3_8h:0.077 co_1h:8.4
114Convert pollutants concentrations to AQI using EPA algorithm, display IAQIs:$ aqi -v aqi.algos.epa pm25:40.9 o3_8h:0.077 co_1h:8.4
pm25:102 o3_8h:104 co_1h:90
114Convert PM2.5 IAQI to concentration using EPA algorithm:$ aqi -c cc aqi.algos.epa pm25:39
pm2.5:9.3DevelopmentTo install the development environment:$ pip install -r dev_requirements.txtTestTest the package:$ python -m unittest discoverAutomatic testing in various environments:$ toxReleaseUsebumprto release the package:$ bumpr -b -mProjectSource code on githubForked from python-aqiResourcesEPA AQI: Technical Assistance Document for the Reporting of Daily Air
Quality – the Air Quality Index (AQI) December 2013) found athttp://www.epa.gov/airnow/aqi-technical-assistance-document-dec2013.pdfNational Ambient Air Quality Standards for Particulate Matter found athttp://www.gpo.gov/fdsys/pkg/FR-2013-01-15/pdf/2012-30946.pdfMEP AQI:GB3095—2012 (2012/02/29) found athttp://www.mep.gov.cn/gkml/hbb/bwj/201203/t20120302_224147.htmHJ633-2012 (2012/02/29) found athttp://www.zzemc.cn/em_aw/Content/HJ633-2012.pdfCPCB AQI:https://app.cpcbccr.com/ccr_docs/About_AQI.pdfIEMA AQI:https://iema.es.gov.br/Media/iema/CQAI/Cartilha/Guia_Qualidade_Ar_ebook.pdfhttps://iema.es.gov.br/qualidadedoar/indicedequalidadedoarKuwait AQI :https://enterprise.emisk.org/eMISKAirQuality/#/KAQICAQI :https://www.airqualitynow.eu/download/CITEAIR-Comparing_Urban_Air_Quality_across_Borders.pdfLicenseaqicalc is published under a BSD 3-clause license, see the LICENSE file
distributed with the project.