function GetTDewPointFromHumRatio(TDryBulb, HumRatio, Pressure) result(TDewPoint)
!+ Return dew-point temperature 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 :: TDewPoint
!+ Dew-point temperature in °F [IP] or °C [SI]
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)
TDewPoint = GetTDewPointFromVapPres(TDryBulb, VapPres)
end function GetTDewPointFromHumRatio