Created
August 20, 2022 10:09
-
-
Save mschwld/2850fbb8b41517e5aff57396ada6c595 to your computer and use it in GitHub Desktop.
Python Dewpoint from Temperature and Humidty, Celcius
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
#!/usr/bin/env python | |
import math | |
def dewpoint(r,T): | |
if(T<=0): | |
raise ValueError('Algorithm not suitable for the given temperature') | |
return (b * (math.log( (r/100)*6.1078*(10**((a*T)/(b+T))) /6.1078,10) ) / | |
(a - (math.log( (r/100)*6.1078*(10**((a*T)/(b+T))) /6.1078,10) ))) | |
# Relative humidity, 0-100 % | |
relhum = 50 | |
# Temperature in Degree Celcius, only > 0 | |
temp = 20 | |
print("Dewpoint: " + str(round(dewpoint(relhum,temp),1)) + "° Celcius") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment