Created
October 16, 2022 09:12
-
-
Save mastersign/3fdea993c5a720e57a1ab5843a0d3c90 to your computer and use it in GitHub Desktop.
Dewpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dewpoint(tempCelsius, relHumidity) { | |
const a = tempCelsius < 0 ? 7.6 : 7.5 | |
const b = tempCelsius < 0 ? 240.7 : 237.3 | |
const sdd = 6.1078 * Math.pow(10, (a * tempCelsius) / (b + tempCelsius)) | |
const dd = relHumidity / 100 * sdd | |
const v = Math.log10(dd / 6.1078) | |
const dewPointCelsius = b * v / (a - v) | |
return dewPointCelsius | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import log10 | |
def dewpoint(temp_celsius, rel_hum): | |
a = 7.6 if temp_celsius < 0 else 7.5 | |
b = 240.7 if temp_celsius < 0 else 237.3 | |
sdd = 6.1078 * 10**((a * temp_celsius) / (b + temp_celsius)) | |
dd = rel_hum / 100.0 * sdd | |
v = log10(dd / 6.1078) | |
dewpoint_celsius = b * v / (a - v) | |
return dewpoint_celsius |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment