def vp2dp(vp,p=[],temp=[],enhance=False):
"""
Convert a volume mixing ratio to a dew point ( and vapour pressure )
Using ITS-90 correction of Wexler's formula
Optional enhancement factors for non ideal
"""
vp=np.atleast_1d(vp)
c=np.array([-9.2288067e-06, 0.46778925, -20.156028, 207.98233],dtype='f8')
d=np.array([-7.5172865e-05, 0.0056577518, -0.13319669, 1],dtype='f8')
lnes=np.log(vp*1e2)
dp=np.polyval(c,lnes)/np.polyval(d,lnes)
if(enhance and len(p)>0) :
if(len(temp)==0):
temp=dp
A=np.array([8.5813609e-09, -6.7703064e-06, 0.001807157, -0.16302041],dtype='f8')
B=np.array([6.3405286e-07, -0.00077326396, 0.34378043, -59.890467],dtype='f8')
alpha=np.polyval(A,temp)
beta=np.exp(np.polyval(B,temp))
ef=np.exp(alpha*(1-vp/p)+beta*(p/vp-1))
vp=vp/ef
lnes=np.log(vp*1e2)
dp=np.polyval(c,lnes)/np.polyval(d,lnes)
return dp
评论列表
文章目录