qrt

Air Quality Toolkit

Usage no npm install needed!

<script type="module">
  import qrt from 'https://cdn.skypack.dev/qrt';
</script>

README

qrt Build Status

Air Quality Toolkit

Install

$ npm install qrt

Usage

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>>>
// 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
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>
noiseMean([70, 70, 70]); // => 70

Bounding Box

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
bbox([
    [51.28, 0.236],
    [51.494438, -0.489],
    [51.686, -0.050688],
]); // => [51.28, -0.489, 51.686, 0.236]