Toolset for calculating wind chill, dew point, heat index and more.
npm install @tsmx/weather-tools
!npm (scoped)
!node-current (scoped)


> Toolset for weather data calculations and conversions.
Provides the following functionalities:
- Wind chill calculation (Celsius and Fahrenheit)
- Dew point calculation (Celsius)
- Heat index calculation (Celsius and Fahrenheit)
- Degree to compass direction conversion
- Fahrenheit <> Celsius conversion
- MPH <> KMH conversion
- Inch <> Millimeter conversion
Example: calculating the dew point in Celsius from given humidity hum and temperature in Fahrenheit tempF.
``js
const wt = require('@tsmx/weather-tools');
const tempC = wt.fahrenheitToCelsius(tempF);
const dewPoint = wt.dewPoint(tempC, hum);
`
For details look the API descriptions for:
- Wind Chill
- Dew Point
- Heat Index
- Unit conversions
#### windchillCelsius(temp, speed)
Calculates the wind chill temperature in degrees Celsius.
Note: Wind chill calculation is only feasible for low temperatures <= 10 degrees Celsius and a minimum wind speed > 4.8 km/h.
Returns:
- NaN if temp is greater than 10.0 degress Celsiustemp
- if speed is less than or equal to 4.8 km/h
- the calculated wind chill otherwise
##### temp
Type: number
The current temperature in degrees Celsius.
##### speed
Type: number
The current wind speed in km/h.
#### windchillFahrenheit(temp, speed)
Calculates the wind chill temperature in degrees Fahrenheit.
Note: Wind chill calculation is only feasible for low temperatures <= 50 degrees Fahrenheit and a minimum wind speed > 3.0 mph.
Returns:
- NaN if temp is greater than 50.0 degress Fahrenheittemp
- if speed is less than or equal to 3.0 mph
- the calculated wind chill otherwise
##### temp
Type: number
The current temperature in degrees Fahrenheit.
##### speed
Type: number
The current wind speed in mph.
#### dewPoint(temp, humidity)
Calculates the dew point in degrees Celsius.
##### temp
Type: number
The current temperature in degrees Celsius.
##### humidity
Type: number
The current humidity in percent (0.0 - 100.0).
#### heatIndexCelsius(temp, humidity)
Calculates the heat index in degrees Celsius.
Note: Heat index calculation is only feasible for high temperatures >= 27 degrees Celsius and a minimum humidity >= 40%.
Returns:
- NaN if temp is lower than 27.0 degress Celsius or humidity is lower than 40.0
- the calculated heat index otherwise
##### temp
Type: number
The current temperature in degrees Celsius.
##### humidity
Type: number
The current humidity in percent (0.0 - 100.0).
#### heatIndexFahrenheit(temp, humidity)
Calculates the heat index in degrees Fahrenheit.
Note: Heat index calculation is only feasible for high temperatures >= 80 degrees Fahrenheit and a minimum humidity >= 40%.
Returns:
- NaN if temp is lower than 80.0 degress Fahrenheit or humidity is lower than 40.0
- the calculated heat index otherwise
##### temp
Type: number
The current temperature in degrees Fahrenheit.
##### humidity
Type: number
The current humidity in percent (0.0 - 100.0).
#### degreesToDirection(deg)
Converts degrees to the closest matching compass direction, e.g. 0 to N, 35 to NE, 301 to WNW and so on.
A 32-point compass rose is used for the conversion.
| Degree | Direction / returned value|
|--------|---------------------------|
| 0.0 | N |NNE
| 22.5 | |NE
| 45.0 | |ENE
| 67.5 | |E
| 90.0 | |ESE
| 112.5 | |SE
| 135.0 | |SSE
| 157.5 | |S
| 180.0 | |SSW
| 202.5 | |SW
| 225.0 | |WSW
| 247.5 | |W
| 270.0 | |WNW
| 292.5 | |NW
| 315.0 | |NNW
| 337.5 | |
##### deg
Type: number
Number of degrees to be converted
#### fahrenheitToCelsius(fahrenheit)
Converts Fahrenheit to Celsius.
##### fahrenheit
Type: number
The value to be converted in degrees Fahrenheit
#### celsiusToFahrenheit(celsius)
Converts Celsius to Fahrenheit.
##### ceslsius
Type: number
The value to be converted in degrees Celsius
#### mphToKmh(mph)
Converts MPH to KMH.
##### mph
Type: number
The value to be converted in MPH.
#### kmhToMph(kmh)
Converts KMH to MPH.
##### kmh
Type: number
The value to be converted in KMH.
#### inchToMillimeter(inch)
Converts inches to millimeters.
##### inch
Type: number
The value to be converted in millimeters.
#### millimeterToInch(millimeter)
Converts millimeters to inches.
##### millimeter
Type: number`
The value to be converted in inches.
The implementations in this library are based on the following references.