@mariuspopovici/rho
v0.1.4
Published
Estimate air density (Rho) based on air temperature, pressure and dew point.
Downloads
34
Maintainers
Readme
Rho
A small library which helps estimate air density (rho) based on air temperature, pressure and dew point.
Installation
`npm install @mariuspopovici/rho`
Usage
Parameters
- temperature Air temperature in degrees Celcius (°C) or Fahrenheit (°F) depending on unit type.
- air pressure Air pressure in hPA or inHg depending on units type
- dew point Air temperature in degrees Celcius (°C) or Fahrenheit (°F) depending on
- units of measurement Optional, defaults to metric. Change to imperial to indicate that inputs are in imperial units of measurement.
- altitude Optional, defaults to 0. Specify altitude to if pressure is measured at sea level.
Examples
var rho = require('@mariuspopovici/rho');
// calculate Rho with values expressed in imperial units
var density = rho(68.9, 30.1, 68.9, 'imperial');
Output should be 1.1984
var rho = require('@mariuspopovici/rho');
// calculate Rho adjusted for altitude
var density = rho(29, 1010, 20, 'metric', 2000);
Output should be 0.9402
var rho = require('@mariuspopovici/rho');
// calculate Rho with values expressed in metric units (default)
var density = rho(20.5, 1019.3, 20.5);
Output should be 1.1984
Result is reported in kg/m3 and can be optionally converted to lb/ft3.
var rho = require('@mariuspopovici/rho');
// calculate Rho with values expressed in imperial units
var density = rho(68.9, 30.1, 68.9, 'imperial').toPoundsPerCubicFeet();
Tests
`npm test`
Contributing
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.