heatIndex property

double? get heatIndex

Get the NOAA heat index in °Celsius, or null if conditions are outside the valid range (temperature ≥ 27 °C, RH ≥ 40 %).

Reference: Rothfusz (1990) NWS Technical Attachment SR90-23.

Implementation

double? get heatIndex {
  final tC = temperatureInCelsius;
  final rh = relativeHumidity;
  if (tC == null || rh == null) return null;
  if (tC < 27.0 || rh < 40.0) return null;
  final tF = tC * 9 / 5 + 32;
  // Rothfusz regression in °F
  final hi = -42.379 +
      2.04901523 * tF +
      10.14333127 * rh -
      0.22475541 * tF * rh -
      0.00683783 * tF * tF -
      0.05481717 * rh * rh +
      0.00122874 * tF * tF * rh +
      0.00085282 * tF * rh * rh -
      0.00000199 * tF * tF * rh * rh;
  return (hi - 32) * 5 / 9;
}