def dp2mr(p, t, dp, Tconvert=None): """w = dp2mr(p,t,dp,Tconvert) compute water vapor mixing ratio (g/kg) given total pressure p (mb), air temperature t (K), and dew point temperature (K). if input, Tconvert is used as the AIR temperature to switch from using saturation vapor pressure over water to over ice. dct 3/5/2000 """ if (Tconvert is not None): e = dp2e(t, dp, Tconvert) else: e = dp2e(t, dp) # water vapor mixing ratio w = e2mr(p, e) return w
def dp2mr(p,t,dp,Tconvert=None): """w = dp2mr(p,t,dp,Tconvert) compute water vapor mixing ratio (g/kg) given total pressure p (mb), air temperature t (K), and dew point temperature (K). if input, Tconvert is used as the AIR temperature to switch from using saturation vapor pressure over water to over ice. dct 3/5/2000 """ if ( Tconvert is not None ): e = dp2e(t,dp,Tconvert) else: e = dp2e(t,dp) # water vapor mixing ratio w = e2mr(p,e) return w
print(mr[0]) dp = e2dp(e, t, Tconvert) print(dp[0]) mr = rh2mr(p, t, rh[0], Tconvert) print(mr[0][0]) dp = rh2dp(p, t, rh[0], Tconvert) print(dp[0][0]) e = rh2e(p, t, rh[0], Tconvert) print(e[0][0]) dp = mr2dp(p, t, mr[0], Tconvert) print(dp[0]) e = mr2e(p, mr[0]) print(e[0]) rh = mr2rh(p, t, mr[0], Tconvert) print(rh[0][0]) e = dp2e(t, dp, Tconvert) print(e[0]) rh = dp2rh(p, t, dp, Tconvert) print(rh[0][0]) mr = dp2mr(p, t, dp, Tconvert) print(mr[0]) print('OK') p = num.array((1000.0, )) t = num.array((260.0, )) rh = num.array((50.0, )) print(p[0]) print(t[0]) print(rh[0]) Tconvert = 273.15
if __name__ == '__main__': from dp2e import dp2e print(e2dp.__doc__) t = num.array( (24.54, 23.16, 21.67, 20.23, 18.86, 17.49, 16.10, 14.69, 13.22, 11.52, 9.53, 7.24, 4.80, 2.34, 0.04, -2.29, -4.84, -7.64, -10.66, -13.95, -17.54, -21.45, -25.58, -29.90, -34.33, -38.94, -43.78, -48.80, -53.94, -58.79, -63.27, -67.32, -70.74, -73.62, -75.74, -77.07, -77.43, -76.63, -75.06, -73.14, -71.43)) t = t + 273.15 td = num.array( (295.99569524, 294.88592297, 293.58149854, 292.11729779, 290.51490282, 288.80633219, 287.25337561, 285.56579921, 283.86054795, 281.99074887, 279.96863936, 278.00807838, 276.00353817, 273.74197577, 271.36371593, 268.74827599, 265.5596088, 261.9472149, 258.46973102, 255.00425602, 251.12242488, 247.15405877, 243.22262393, 238.86585074, 233.8823144, 228.4539335, 223.20007008, 217.86176743, 212.95046128, 209.08799585, 203.25047643, 202.6535621, 197.18886555, 196.61856765, 196.0340168, 195.44634221, 194.83729251, 194.21361376, 193.57543455, 192.93607596, 196.90293301)) p = num.array((1012.0, 991.3, 969.1, 945.5, 920.4, 893.8, 865.7, 836.1, 805.1, 772.8, 739.5, 705.2, 670.3, 635.0, 599.7, 564.5, 529.8, 495.7, 462.6, 430.7, 400.0, 370.8, 343.0, 316.7, 292.0, 266.8, 247.2, 227.0, 208.2, 190.8, 174.7, 159.9, 146.2, 133.6, 121.9, 111.3, 101.5, 92.6, 84.4, 76.9, 70.0)) e = dp2e(t, td, 253.15) dp = e2dp(e, t, 253.15) print(dp)
174.7, 159.9, 146.2, 133.6, 121.9, 111.3, 101.5, 92.6, 84.4, 76.9, 70.0 )) t = num.array( ( 24.54, 23.16, 21.67, 20.23, 18.86, 17.49, 16.10, 14.69, 13.22, 11.52, 9.53, 7.24, 4.80, 2.34, 0.04, -2.29, -4.84, -7.64,-10.66,-13.95, -17.54,-21.45,-25.58,-29.90,-34.33,-38.94,-43.78,-48.80,-53.94,-58.79, -63.27,-67.32,-70.74,-73.62,-75.74,-77.07,-77.43,-76.63,-75.06,-73.14, -71.43 )) t = t + 273.15 td = num.array( ( 295.99569524, 294.88592297, 293.58149854, 292.11729779, 290.51490282, 288.80633219, 287.25337561, 285.56579921, 283.86054795, 281.99074887, 279.96863936, 278.00807838, 276.00353817, 273.74197577, 271.36371593, 268.74827599, 265.5596088, 261.9472149, 258.46973102, 255.00425602, 251.12242488, 247.15405877, 243.22262393, 238.86585074, 233.8823144, 228.4539335, 223.20007008, 217.86176743, 212.95046128, 209.08799585, 203.25047643, 202.6535621, 197.18886555, 196.61856765, 196.0340168, 195.44634221, 194.83729251, 194.21361376, 193.57543455, 192.93607596, 196.90293301)) r = num.array( ( 17.78, 16.92, 15.93, 14.87, 13.78, 12.70, 11.84, 10.96, 10.15, 9.31, 8.46, 7.73, 7.05, 6.32, 5.62, 4.91, 4.10, 3.30, 2.67, 2.15, 1.66, 1.26, 0.95, 0.68, 0.45, 0.28, 0.17, 0.10, 0.06, 0.04, 0.02, 0.02, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.02 )) e = dp2e(t,td) (rh1,rh2) = e2rh(p,t,e) h = hypsometric(p,t,r,0.001) imt = imrt(h,t,rh1) print(imt)
print(mr[0]) dp = e2dp(e,t,Tconvert) print(dp[0]) mr = rh2mr(p,t,rh[0],Tconvert) print(mr[0][0]) dp = rh2dp(p,t,rh[0],Tconvert) print(dp[0][0]) e = rh2e(p,t,rh[0],Tconvert) print(e[0][0]) dp = mr2dp(p,t,mr[0],Tconvert) print(dp[0]) e = mr2e(p,mr[0]) print(e[0]) rh = mr2rh(p,t,mr[0],Tconvert) print(rh[0][0]) e = dp2e(t,dp,Tconvert) print(e[0]) rh = dp2rh(p,t,dp,Tconvert) print(rh[0][0]) mr = dp2mr(p,t,dp,Tconvert) print(mr[0]) print('OK') p = num.array((1000.0,)) t = num.array((260.0,)) rh = num.array((50.0,)) print(p[0]) print(t[0]) print(rh[0]) Tconvert = 273.15
if __name__ == '__main__': from dp2e import dp2e print(e2mr.__doc__) t = num.array( ( 24.54, 23.16, 21.67, 20.23, 18.86, 17.49, 16.10, 14.69, 13.22, 11.52, 9.53, 7.24, 4.80, 2.34, 0.04, -2.29, -4.84, -7.64,-10.66,-13.95, -17.54,-21.45,-25.58,-29.90,-34.33,-38.94,-43.78,-48.80,-53.94,-58.79, -63.27,-67.32,-70.74,-73.62,-75.74,-77.07,-77.43,-76.63,-75.06,-73.14, -71.43 )) t = t + 273.15 td = num.array( ( 295.99569524, 294.88592297, 293.58149854, 292.11729779, 290.51490282, 288.80633219, 287.25337561, 285.56579921, 283.86054795, 281.99074887, 279.96863936, 278.00807838, 276.00353817, 273.74197577, 271.36371593, 268.74827599, 265.5596088, 261.9472149, 258.46973102, 255.00425602, 251.12242488, 247.15405877, 243.22262393, 238.86585074, 233.8823144, 228.4539335, 223.20007008, 217.86176743, 212.95046128, 209.08799585, 203.25047643, 202.6535621, 197.18886555, 196.61856765, 196.0340168, 195.44634221, 194.83729251, 194.21361376, 193.57543455, 192.93607596, 196.90293301)) p = num.array( ( 1012.0, 991.3, 969.1, 945.5, 920.4, 893.8, 865.7, 836.1, 805.1, 772.8, 739.5, 705.2, 670.3, 635.0, 599.7, 564.5, 529.8, 495.7, 462.6, 430.7, 400.0, 370.8, 343.0, 316.7, 292.0, 266.8, 247.2, 227.0, 208.2, 190.8, 174.7, 159.9, 146.2, 133.6, 121.9, 111.3, 101.5, 92.6, 84.4, 76.9, 70.0 )) e = dp2e(t,td,253.15) w = e2mr(p,e) print(w)