humidity_formulae.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:faampy 作者: ncasuk 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号