Skip to content

Instantly share code, notes, and snippets.

@VincentLoy
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VincentLoy/c3a9b3bd97be049bb01f to your computer and use it in GitHub Desktop.
Save VincentLoy/c3a9b3bd97be049bb01f to your computer and use it in GitHub Desktop.
# t is temperature in °C
# d is dew Point Temperature in °C
import math
def get_humidex(t, d):
kelvin = 273.15
temperature = t + kelvin
dewpoint = d + kelvin
# Calculate vapor pressure in mbar.
e = 6.11 * math.exp(5417.7530 * ((1 / kelvin) - (1 / dewpoint)))
# Calculate saturation vapor pressure
h = 0.5555 * (e - 10.0)
humidex = temperature + h - kelvin
return humidex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment