function GetRelHumFromHumRatio(TDryBulb, HumRatio, Pressure) result(RelHum)
!+ Return relative humidity given dry-bulb temperature, humidity ratio, and pressure.
!+ Reference:
!+ ASHRAE Handbook - Fundamentals (2017) ch. 1
real, intent(in) :: TDryBulb
!+ Dry-bulb temperature in °F [IP] or °C [SI]
real, intent(in) :: HumRatio
!+ Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
real, intent(in) :: Pressure
!+ Atmospheric pressure in Psi [IP] or Pa [SI]
real :: RelHum
!+ Relative humidity in range [0, 1]
real :: VapPres
!+ Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]
if (HumRatio < 0.0) then
error stop "Error: humidity ratio cannot be negative"
end if
VapPres = GetVapPresFromHumRatio(HumRatio, Pressure)
RelHum = GetRelHumFromVapPres(TDryBulb, VapPres)
end function GetRelHumFromHumRatio