import math def dewPoint(humidity, celsius): RATIO = 373.15 / (273.15 + celsius) RHS = -7.90298 * (RATIO - 1) RHS += 5.02808 * math.log(RATIO, 10) RHS += -1.3816e-7 * (math.pow(10, (11.344 * (1 - 1/RATIO ))) - 1) RHS += 8.1328e-3 * (math.pow(10, (-3.49149 * (RATIO - 1))) - 1) RHS += math.log(1013.246, 10) # factor -3 is to adjust units - Vapor Pressure SVP * humidity VP = math.pow(10, RHS - 3) * humidity # (2) DEWPOINT = F(Vapor Pressure) T = math.log(VP/0.61078) # temp var return (241.88 * T) / (17.558 - T)