GithubHelp home page GithubHelp logo

rheehot / air-conc-aqi-converter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mogulist/air-conc-aqi-converter

0.0 1.0 0.0 105 KB

A converter for air pollutants' concentration value and AQIs.

JavaScript 100.00%

air-conc-aqi-converter's Introduction

air-conc-aqi-converter

A converter for air pollutants' concentration value and AQIs.

Although official AQI's max value is 500, this module supports over the limit AQI value. For emxample, PM2.5's 500 µg/m³ corresponds to US AQI 500. If 1000 µg/m³ is given, AQI value 832 is returned.

Installation

$ npm i git+https://github.com/HerbertLim/air-conc-aqi-converter -S
import {getAqiFromConc, getIaqiFromConcs, } from 'air-conc-aqi-converter';

APIs

getAqiFromConc (aqiName, pollutant, conc)

Parameters

  • aqiName: name of AQI type. Currently supports only three AQI types: 'misebig', 'us', 'kr'
  • pollutant: 'pm25', 'pm10', 'no2', 'o3', 'so2', 'co'
  • conc: concentration value,
    • For PM2.5 and PM10, concentration value's unit is µg/m³.
    • For NO2, O3, SO2, and CO, concentration value's unit is ppm, not ppb or µg/m³.

Returns

AQI values for specified AQI type

getIaqiFromConcs (aqiName, concs)

Parameters

  • aqiName: name of AQI type. Currently supports only three AQI types: 'misebig', 'us', 'kr'
  • concs: is an object containing following fields:
{pm25Value, pm10Value, no2Value, o3Value, coValue, so2Value}

Returns

Highest AQI value among six pollutants. Or AQI value of dominent pollutant. IAQI stands for Integrated AQI.

getLevelFromConc (aqiName, pollutant, conc)

Parameters

  • aqiName: name of AQI type. Currently supports only three AQI types: 'misebig', 'us', 'kr'
  • pollutant: 'pm25', 'pm10', 'no2', 'o3', 'so2', 'co'
  • conc: concentration value,
    • For PM2.5 and PM10, concentration value's unit is µg/m³.
    • For NO2, O3, SO2, and CO, concentration value's unit is ppm, not ppb or µg/m³.

Returns

Level of given AQI. In case of Misebig AQI and US AQI, which consists of 6 levels, returns integer from 0 to 6. 6 means given concentration value is over the official AQI limit. In case of KR AQI, which consists of 4 levels, returns integer from 0 to 4. 4 means the same.

-1 if any error.

getLevelByAqi (aqiName, aqiValue)

Parameters

  • aqiName: name of AQI type. Currently supports only three AQI types: 'misebig', 'us', 'kr'
  • aqiValue: AQI value

Returns

Level of given AQI. In case of Misebig AQI and US AQI, which consists of 6 levels, returns integer from 0 to 6. 6 means given concentration value is over the official AQI limit. In case of KR AQI, which consists of 4 levels, returns integer from 0 to 4. 4 means the same.

-1 if any error.

getPosInLevel (aqiName, aqiValue)

Find position of AQI.

Parameters

  • aqiName: name of AQI type. Currently supports only three AQI types: 'misebig', 'us', 'kr'
  • aqiValue: AQI value

Returns

Returns exact position floating point number within AQI level.

For example, if AQI value is 75, AQI level is 1, and its position is 1.5. If AQI value is 125, AQI level is 2 and its position is 2.5.

-1 if any error.

getAqiBreakpoint (aqiName, pollutant, level)

Find breakpoint of pollutant's AQI level

Parameters

  • aqiName: name of AQI type. Currently supports only three AQI types: 'misebig', 'us', 'kr'
  • pollutant: 'pm25', 'pm10', 'no2', 'o3', 'so2', 'co'
  • level: starting from 0 to 3 or 5 depending on AQI. Korean AQI has only 4 levels(or grades) whereas Misebig(Airy) and US AQI has 6 levels.

Returns

Returns upper breakpoint in concentration.

For example, if AQI is misebig, pollutant is pm25, and level is 2, this function will return 55, because level 2 of PM2.5 in Misebig(Airy) AQI ranges from 26 to 55.

-1 if any error.


What is Misebig AQI?

It is a 6-levels AQI similar to US AQI but much tighter. Based on WHO guidelines, US AQI, and Korean AQI, each level is set with tightest one among those three guideline/AQIs. Misebig AQI is invented for Misebig App.

air-conc-aqi-converter's People

Contributors

herbertlim avatar

Watchers

 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.