1- ![ Node.js CI] ( https://github.com/oyve/weather-formulas/workflows/Node.js%20CI/badge.svg?branch=main )
1+ ![ License: GPL v3 ] ( https://img.shields.io/badge/License-GPLv3-blue.svg ) ![ Node.js CI] ( https://github.com/oyve/weather-formulas/workflows/Node.js%20CI/badge.svg?branch=main )
22# weather-formulas
33A library of atmospheric and weather related calculations.
44
5- * Test code for all code/algorithms
6- * Supports custom valuation sets where needed
5+ * Test code for all formulas
6+ * Supports custom valuation sets where supported
77
88## Features
99
@@ -26,6 +26,7 @@ A library of atmospheric and weather related calculations.
2626### Pressure
2727- [ Pressure Altitude] ( https://en.wikipedia.org/wiki/Pressure_altitude )
2828- [ Density Altitude] ( https://en.wikipedia.org/wiki/Density_altitude )
29+ - [ Adjust Pressure To Sea Level] ( https://en.wikipedia.org/wiki/Atmospheric_pressure )
2930
3031## Install
3132```
@@ -34,37 +35,39 @@ $ npm install weather-formulas
3435
3536## How to use
3637```
37- const WF = require('weather-formulas');
38+ //Option #1 - accessing all
39+ const wf = require('weather-formulas');
40+ wf.temperature, wf.humidity, wf.pressure
3841
39- const TEMPERATURE = 300, HUMIDITY = 60, WINDSPEED = 10; //300 Kelvin, 60% Relative Humidity, 10 M/S
40-
41- let dewPointMF = WF.dewPointMagnusFormula(TEMPERATURE, HUMIDITY);
42- let dewPointAF = WF.dewPointArdenBuckEquation(TEMPERATURE, HUMIDITY);
43- let windChill = WF.windChillIndex(TEMPERATURE, WINDSPEED);
44- let apparentTemperature = WF.australianAapparentTemperature(TEMPERATURE, HUMIDITY, WINDSPEED);
45- let heatIndex = WF.heatIndex(TEMPERATURE, HUMIDITY);
46- let heatIndexText = WF.heatIndexText(heatIndex); //output heat index threshold and warning text
42+ //Option #2 - accessing directly
43+ import { temperature, humidity, pressure } from 'weather-formulas'
44+ ```
45+ ```
46+ //With Option #1
47+ let RH = wf.humidity.relativeHumidity(TEMPERATURE, DEW_POINT);
48+ ...
4749
48- let humidex = WF.humidex(TEMPERATURE, HUMIDITY);
49- let humidexText = WF.humidexText(humidex); //output humidex threshold and warning text
50+ //With Option #2
51+ let RH = humidity.relativeHumidity(TEMPERATURE, DEW_POINT);
52+ ...
5053
5154```
5255
5356** Advanced examples**
5457
5558Use a provided valuation set
5659```
57- const valuationSet = temperature.DEW_POINT_VALUATIONS.DAVID_BOLTON;
58- const actual = temperature.dewPointMagnusFormula(TEMPERATURE, HUMIDITY, valuationSet);
60+ const valuationSet = wf. temperature.DEW_POINT_VALUATIONS.DAVID_BOLTON;
61+ const actual = wf. temperature.dewPointMagnusFormula(TEMPERATURE, HUMIDITY, valuationSet);
5962```
6063Use a custom valuation set
6164```
62- const valuationSet = { a: 6, b: 17, c: 250, d: 234.5 }; //these values are made up for the sake of example
63- const actual = temperature.dewPointArdenBuckEquation(TEMPERATURE, HUMIDITY, valuationSet);
65+ const valuationSet = { a: 6, b: 17, c: 250, d: 234.5 };
66+ const actual = wf. temperature.dewPointArdenBuckEquation(TEMPERATURE, HUMIDITY, valuationSet);
6467```
6568
6669## Contribute
67- Please feel free to contribute by creating a Pull Request with test code.
70+ Please feel free to contribute by creating a Pull Request including test code.
6871
6972## Disclaimer
7073Always verify calculations before using in production as edge cases due to floating point errors may exists for large numbers, and that are not covered by tests today. Please report!
0 commit comments