Last change
on this file since 183 was
183,
checked in by aslmd, 14 years ago
|
MESOSCALE: PYTHON: added pywrf r39 to act as a reference for futher developments
|
File size:
1.0 KB
|
Line | |
---|
1 | ''' |
---|
2 | Useful met formulas |
---|
3 | ''' |
---|
4 | import numpy as n |
---|
5 | import constants as c |
---|
6 | |
---|
7 | def goff_gratch(temperature): |
---|
8 | ''' |
---|
9 | computes saturation water pressure from temperature (in Kelvin) |
---|
10 | ref Smithsonian Tables 1984, after Goff and Gratch 1946 |
---|
11 | usage: |
---|
12 | goff_gratch(temperature) |
---|
13 | ''' |
---|
14 | exponent = \ |
---|
15 | - 7.90298 * (373.16/temperature - 1) \ |
---|
16 | + 5.02808 * n.log10(373.16 / temperature) \ |
---|
17 | - 1.3816e-7 * (10**(11.344 * (1-temperature/373.16)) -1) \ |
---|
18 | + 8.1328e-3 * (10**(-3.49149 * (373.16/temperature-1)) -1) \ |
---|
19 | + n.log10(1013.246) |
---|
20 | return 10**exponent |
---|
21 | |
---|
22 | def water_vapour_pressure_to_mix_ratio(pressure, water_vapour_pressure): |
---|
23 | ''' |
---|
24 | computes the mixing ratio given the total pressure and the water vapour |
---|
25 | partial pressure |
---|
26 | usage: |
---|
27 | water_vapour_pressure_to_mix_ratio(pressure, water_vapour_pressure) |
---|
28 | ''' |
---|
29 | coeff = c.water_molecular_weight / c.air_molecular_weight |
---|
30 | dry_air_pressure = pressure - water_vapour_pressure |
---|
31 | return coeff * water_vapour_pressure / dry_air_pressure |
---|
Note: See
TracBrowser
for help on using the repository browser.