#Metview Macro

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2019 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
# 
#  ***************************** LICENSE END ************************************
# 

#=============================================================================
# Function      : vapour_pressure
#
# Syntax        : number vapour_pressure(q: number, p: number)
#                                          
# Category      : THERMODYNAMICS
#
# OneLineDesc   : Computes the vapour pressure for a given specific humidity and pressure
#
# Description   : Computes the vapour pressure for a given specific humidity and pressure
#
# Parameters    : q - the specific humidity (kg/kg)
#		 		  p - the pressure (Pa)
#           
# Return Value  : the vapour pressure (Pa)
#
# Dependencies  : none
#
#==============================================================================

function vapour_pressure(q: number, p: number)

    c = 1.607766154 # = 1/0.621981    
    return p * q * c /(1 + q*(c -1))

end vapour_pressure