<HTML> <BODY BGCOLOR=#ccccdd LINK=#0000aa VLINK=#0000ff ALINK=#ff0000 ><BASE TARGET="bottom_target"><PRE>
<A NAME='DA_TP_TO_QS'><A href='../../html_code/physics/da_tp_to_qs.inc.html#DA_TP_TO_QS' TARGET='top_target'><IMG SRC="../../gif/bar_red.gif" border=0></A>

subroutine da_tp_to_qs( t, p, es, qs) 34,2

   !---------------------------------------------------------------------------
   ! Purpose: Convert T/p to saturation specific humidity.
   !
   !  Method: qs = es_alpha * es / ( p - ( 1 - rd_over_rv ) * es ).
   !          use Rogers &amp; Yau (1989) formula: es = a exp( bTc / (T_c + c) )
   !--------------------------------------------------------------------------

   implicit none

   real, intent(in)  :: t, p
   real, intent(out) :: es, qs
   
   real              :: t_c              ! T in degreesC.

   if (trace_use_dull) call da_trace_entry("da_tp_to_qs")

   !---------------------------------------------------------------------------
   ! [1.0] initialise:
   !---------------------------------------------------------------------------
   
   t_c = t - t_kelvin
   
   !---------------------------------------------------------------------------
   ! [2.0] Calculate saturation vapour pressure:
   !---------------------------------------------------------------------------

   es = es_alpha * exp( es_beta * t_c / ( t_c + es_gamma ) )
    
   !---------------------------------------------------------------------------
   ! [3.0] Calculate saturation specific humidity:
   !---------------------------------------------------------------------------

   qs = rd_over_rv * es / ( p - rd_over_rv1 * es )

   if (trace_use_dull) call da_trace_exit("da_tp_to_qs")

end subroutine da_tp_to_qs