Zero-dependency Standard ML library for apparent temperature indices: NWS wind chill, NOAA heat index (Rothfusz polynomial), Canadian humidex, Steadman apparent temperature, Magnus dew point, and unit-conversion helpers.
signature WINDCHILL =
sig
val windChillF : {tF:real, windMph:real} -> real (* NWS formula *)
val windChillC : {tC:real, windKmh:real} -> real
val heatIndexF : {tF:real, rh:real} -> real (* rh 0..100 % *)
val heatIndexC : {tC:real, rh:real} -> real
val humidexC : {tC:real, dewC:real} -> real
val apparentTempC : {tC:real, rh:real, windMs:real} -> real (* rh 0..1 *)
val dewPointC : {tC:real, rh:real} -> real (* rh 0..1 *)
val cToF : real -> real val fToC : real -> real
val kmhToMph : real -> real val mphToKmh : real -> real
endval wc = Windchill.windChillF {tF=0.0, windMph=15.0} (* ~-19 F *)
val hi = Windchill.heatIndexF {tF=90.0, rh=70.0} (* ~105 F *)
val hx = Windchill.humidexC {tC=30.0, dewC=25.0} (* ~42 *)
val dp = Windchill.dewPointC {tC=20.0, rh=0.5} (* ~9.3 C *)make example builds and runs examples/demo.sml, which
computes wind chill, heat index, humidex, Steadman apparent temperature, dew
point, and unit conversions across representative inputs (output is
byte-identical under MLton and Poly/ML):
Wind chill (NWS formula, Fahrenheit/mph):
0F, 15mph -> ~19.40 F
32F, 10mph -> 23.73 F
60F, 20mph -> 60.00 F (out of range: T > 50F, returns input)
Wind chill (Celsius/km-h):
-10C, 30km/h -> ~19.49 C
Heat index (Rothfusz polynomial):
90F, 70% rh -> 105.92 F
32C, 60% rh -> 37.07 C
Humidex (Canada):
30C air, 25C dew point -> 42.34
Steadman apparent temperature:
25C, 60% rh, 5m/s wind -> 23.75 C
Magnus dew point:
20C, 50% rh -> 9.26 C
Unit conversions:
0C -> 32.00 F, 100C -> 212.00 F
32F -> 0.00 C
100km/h -> 62.14 mph, 60mph -> 96.56 km/h
- Wind chill: NWS 2001 formula; returns input temperature when T > 50 °F or wind < 3 mph.
- Heat index: Rothfusz polynomial;
rhis a percentage (0..100); returns input temperature below 80 °F. - Humidex: Canadian formula using Buck vapour-pressure approximation.
- apparentTempC / dewPointC:
rhis a fraction (0..1). - No solar radiation or clothing corrections.
make all-tests # MLton + Poly/ML
make test # MLton only
make test-poly # Poly/ML only