/aqipy

AQI calculation library

Primary LanguagePythonApache License 2.0Apache-2.0

AQI calculation library (python)

PyPI version pypi supported versions

The library calculates the following indexes:

  • AQI (US)
  • AQHI (Canada)
  • CAQI (Europe)
  • DAQI (UK)
  • AQI (Australia)
  • CAI (South Korea)
  • PSI (Singapore)
  • AQHI (Hong Kong)
  • AQI (Mainland China)
  • AQI (India)

Installation

From source:

git clone --recursive https://github.com/atmotube/aqipy.git
cd python
python setup.py install

From PyPI directly:

pip3 install aqipy-atmotech

Examples

calculate US AQI:

from aqipy import aqi_us

aqi, aqi_data = aqi_us.get_aqi(o3_8h=0.07853333, co_8h=5)
print('AQI:', aqi)
print('AQI O3:', aqi_data['o3_8h'][0])
print('Effects O3:', aqi_data['o3_8h'][1])
print('Cautions O3:', aqi_data['o3_8h'][2])
print('AQI CO:', aqi_data['co_8h'][0])
print('Effects CO:', aqi_data['co_8h'][1])
print('Cautions CO:', aqi_data['co_8h'][2])

output will be:

AQI: 126
AQI O3: 126
Effects O3: Increasing likelihood of respiratory symptoms and breathing discomfort in people with lung disease (such as asthma), children, older adults, people who are active outdoors (including outdoor workers), people with certain genetic variants, and people with diets limited in certain nutrients.
Cautions O3: People with lung disease (such as asthma), children, older adults, people who are active outdoors (including outdoor workers), people with certain genetic variants, and people with diets limited in certain nutrients should reduce prolonged or heavy outdoor exertion.
AQI CO: 56
Effects CO:
Cautions CO:

Units

Pollutant Units
CO ppm
O3 ppm
NO2 ppm
SO2 ppm
NH3 ppm
Pb ppm
PM2.5 μg/m3
PM10 μg/m3

Summary (averages)

Index PM2.5 PM10 O3 NO2 CO SO2 NH3 Pb
AQI (US) 24h 24h 8h/1h 1h 8h 1h - -
AQHI (Canada) 3h 3h 3h 3h - - - -
CAQI (Europe) 1h/24h 1h/24h max in 1h max in 1h 8h max in 1h - -
DAQI (UK) 24h 24h 8h 1h - 15m - -
AQI (Australia) 24h 24h 1h/4h 1h 8h 1h - -
CAI (South Korea) 24h 24h 1h 1h 1h 1h - -
PSI (Singapore) 24h 24h 8h 1h 8h 24h - -
AQHI (Hong Kong) 3h 3h 3h 3h 3h 3h - -
AQI (Mainland China) 24h 24h 1h/8h 24h 24h 24h - -
AQI (India) 24h 24h 8h 24h 8h 24h 24h 24h