qrt
Version:
Air Quality Toolkit
80 lines (55 loc) • 1.74 kB
Markdown
# qrt [](https://travis-ci.com/github/portothree/qrt)
> Air Quality Toolkit
## Install
```
$ npm install qrt
```
## Usage
```js
const { windDirectionMean } = require('qrt');
windDirectionMean([360, 45, 90]);
//=> 45
```
## API
### windDirectionMean(...args)
- args
- Wind direction only: `Array<number>`
- Wind direction and speed: `Array<number>, Array<number>`
- Wind direction and speed in a '2d' array: `<Array<Array<number>>>`
```js
// Wind directions only
windDirectionMean([360, 45, 90]); // => 45
// Wind directions and speeds
windDirectionMean([360, 45, 90], [1.48, 1.78, 3.44]); // => 59.76
// Wind directions and speeds in '2d' format
windDirectionMean([
[360, 1.48],
[45, 1.78],
[90, 3.44],
]); // => 59.76
```
### airQualityIndex(PM10, PM25, NO2, O3, SO2)
- PM10 - Average hourly as `Number`
- PM25 - Average hourly as `Number`
- NO2 - Average hourly as `Number`
- O3 - Average hourly as `Number`
- SO2 - Average hourly as `Number`
```js
airQualityIndex(5, 0, 0, 0, 0); // => { AQI_POL: 'PM10', AQI_GLOBAL: 5 }
```
### noiseMean(samples)
Calculates noise using logarithic average of the values
- samples - Array of noise measurements, `Array<number>`
```js
noiseMean([70, 70, 70]); // => 70
```
### bbox(coordinates)
Get an area defined by two longitudes and two latitudes of the maximum extents of a list of coordinates, in other words min(Latitude), min(Longitude), max(Latitude), max(Longitude)
- coordinates - Two-dimensional array with latitude and longitude points
```js
bbox([
[51.28, 0.236],
[51.494438, -0.489],
[51.686, -0.050688],
]); // => [51.28, -0.489, 51.686, 0.236]
```