GithubHelp home page GithubHelp logo

epcervantes7 / python-aqi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hrbonz/python-aqi

0.0 0.0 0.0 43 KB

A library to convert between AQI value and pollutant concentration (µg/m³ or ppm)

License: BSD 3-Clause "New" or "Revised" License

Python 98.75% Makefile 1.25%

python-aqi's Introduction

python-aqi - AQI conversion

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)
Testing Status Documentation Status license BSD 3-Clause

Install

$ pip install python-aqi

Usage

Library

Convert a pollutant to its IAQI (Intermediate Air Quality Index):

import 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 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 aqi
mycc = aqi.to_cc(aqi.POLLUTANT_PM25, '22', algo=aqi.ALGO_EPA)

Command line

List 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
50

Convert PM2.5 to IAQI using EPA algorithm (full length):

$ aqi -c aqi aqi.algos.epa pm25:12
50

Convert pollutants concentrations to AQI using EPA algorithm:

$ aqi aqi.algos.epa pm25:40.9 o3_8h:0.077 co_1h:8.4
114

Convert 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
114

Convert PM2.5 IAQI to concentration using EPA algorithm:

$ aqi -c cc aqi.algos.epa pm25:39
pm2.5:9.3

Development

To install the development environment:

$ pip install -r dev_requirements.txt

Test

Test the package:

$ python -m unittest discover

Automatic testing in various environments:

$ tox

Release

Use bumpr to release the package:

$ bumpr -b -m

Project

Resources

License

python-aqi is published under a BSD 3-clause license, see the LICENSE file distributed with the project.

python-aqi's People

Contributors

hrbonz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.