Git Product home page Git Product logo

weather-formulas's Introduction

Node.js CI

weather-formulas

A library of weather calculations.

  • Agnostic to input source, hook it up in any project
  • I/O in SI units (International System of Units)
  • Formulas and algorithms off Wikipedia with 1:1 variable naming
  • All algorithms are automatically tested
  • Use provided or custom valuation sets

Features / Currently supported

Install

$ npm install weather-formulas

How to use

const WF = require('weather-formulas');

const TEMPERATURE = 300, HUMIDITY = 60, WINDSPEED = 10; //300 Kelvin, 60% Relative Humidity, 10 M/S

let dewPointMF = WF.dewPointMagnusFormula(TEMPERATURE, HUMIDITY);
let dewPointAF = WF.dewPointArdenBuckEquation(TEMPERATURE, HUMIDITY);
let windChill = WF.windChillIndex(TEMPERATURE, WINDSPEED);
let apparentTemperature = WF.australianAapparentTemperature(TEMPERATURE, HUMIDITY, WINDSPEED);
let heatIndex = WF.heatIndex(TEMPERATURE, HUMIDITY);
let heatIndexText = WF.heatIndexText(heatIndex); //output heat index threshold and warning text

let humidex = WF.humidex(TEMPERATURE, HUMIDITY);
let humidexText = WF.humidexText(humidex); //output humidex threshold and warning text

Advanced examples

Use a provided valuation set

const valuationSet =  temperature.DEW_POINT_VALUATIONS.DAVID_BOLTON;
const actual = temperature.dewPointMagnusFormula(TEMPERATURE, HUMIDITY, valuationSet);

Use a custom valuation set

const valuationSet =  { a: 6, b: 17, c: 250, d: 234.5 }; //these values are made up for the sake of example
const actual = temperature.dewPointArdenBuckEquation(TEMPERATURE, HUMIDITY, valuationSet);

Contribute

Please feel free to contribute by creating a Pull Request with test code.

weather-formulas's People

Contributors

oyve avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

draekko

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.