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

subroutine da_ref_height(pres, ref_height) 1,2

   !---------------------------------------------------------------------------
   ! Purpose: To calculate the height from the reference pressure
   !---------------------------------------------------------------------------

   implicit none

   real, intent(in)  :: pres
   real, intent(out) :: ref_height

   real              :: aa, bb, cc
   real              :: p0iso, ziso

   real, parameter   :: rovg = gas_constant/gravity

   if (trace_use) call da_trace_entry("da_ref_height")

   aa = 0.5 * rovg * base_lapse
   bb = rovg * t0

   cc = log(pres/base_pres)
   ref_height = -(bb + aa * cc) * cc

   if (base_temp &gt; 0.0) then
      p0iso=base_pres*exp((base_temp-t0)/base_lapse)
      cc=log(p0iso/base_pres)
      ziso=-(aa*cc+bb)*cc

      if (ref_height &gt; ziso) then
         ref_height=ziso+rovg*base_temp*log(p0iso/pres)
      end if
   end if

   if (trace_use) call da_trace_exit("da_ref_height")

end subroutine da_ref_height