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
.
const wt = require('@tsmx/weather-tools');
const tempC = wt.fahrenheitToCelsius(tempF);
const dewPoint = wt.dewPoint(tempC, hum);
For details look the API descriptions for:
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
iftemp
is greater than 10.0 degress Celsiustemp
ifspeed
is less than or equal to 4.8 km/h- the calculated wind chill otherwise
Type: number
The current temperature in degrees Celsius.
Type: number
The current wind speed in km/h.
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
iftemp
is greater than 50.0 degress Fahrenheittemp
ifspeed
is less than or equal to 3.0 mph- the calculated wind chill otherwise
Type: number
The current temperature in degrees Fahrenheit.
Type: number
The current wind speed in mph.
Calculates the dew point in degrees Celsius.
Type: number
The current temperature in degrees Celsius.
Type: number
The current humidity in percent (0.0 - 100.0).
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
iftemp
is lower than 27.0 degress Celsius orhumidity
is lower than 40.0- the calculated heat index otherwise
Type: number
The current temperature in degrees Celsius.
Type: number
The current humidity in percent (0.0 - 100.0).
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
iftemp
is lower than 80.0 degress Fahrenheit orhumidity
is lower than 40.0- the calculated heat index otherwise
Type: number
The current temperature in degrees Fahrenheit.
Type: number
The current humidity in percent (0.0 - 100.0).
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 |
22.5 | NNE |
45.0 | NE |
67.5 | ENE |
90.0 | E |
112.5 | ESE |
135.0 | SE |
157.5 | SSE |
180.0 | S |
202.5 | SSW |
225.0 | SW |
247.5 | WSW |
270.0 | W |
292.5 | WNW |
315.0 | NW |
337.5 | NNW |
Type: number
Number of degrees to be converted
Converts Fahrenheit to Celsius.
Type: number
The value to be converted in degrees Fahrenheit
Converts Celsius to Fahrenheit.
Type: number
The value to be converted in degrees Celsius
Converts MPH to KMH.
Type: number
The value to be converted in MPH.
Converts KMH to MPH.
Type: number
The value to be converted in KMH.
Converts inches to millimeters.
Type: number
The value to be converted in millimeters.
Converts millimeters to inches.
Type: number
The value to be converted in inches.
The implementations in this library are based on the following references.