Coverage for mlair/helpers/meteo.py: 25%

8 statements  

« prev     ^ index     » next       coverage.py v6.4.2, created at 2023-12-18 17:51 +0000

1 

2import numpy as np 

3 

4 

5def relative_humidity_from_dewpoint(dew, temp): 

6 return np.clip(100 * e_sat(dew) / e_sat(temp), 0, 100) 

7 

8 

9def e_sat(temperature): 

10 a1 = 611.21 # Pa 

11 a3 = 17.502 

12 a4 = 32.19 # K 

13 T0 = 273.16 # K 

14 return a1 * np.exp(a3 * (temperature - T0) / (temperature - a4))