anchor.diff:    logical, private, save :: out_tem_atm   = .false.
     logical, private, save :: out_albedo    = .false.
     logical, private, save :: out_slp       = .false.
  +  logical, private, save :: out_850hPa    = .false.
     logical, private, save :: out_cape_cin  = .false.
   
     !-----------------------------------------------------------------------------
  
positive.code:            .OR. item_save(n) == 'sl_v10m'            &
             .OR. item_save(n) == 'sl_ucos10m'         &
             .OR. item_save(n) == 'sl_vcos10m'         ) out_10m_uv    = .true.
  
         if(      item_save(n) == 'sl_slh'             ) out_slh       = .true.
         if(      item_save(n) == 'sl_vap_atm'         ) out_vap_atm   = .true.
  
negative.code:     return
    end subroutine sv_pre_sfc
  
    subroutine sv_plev_uvwt( &   ! [add] 20130705 R.Yoshida
         ijdim,   &
         pre,     &
         u_z,     &
         v_z,     &
         w_z,     &
         t_z,     &
         plev,    &
         u_p,     &
         v_p,     &
         w_p,     &
         t_p      )
      use mod_adm, only :  &
         kdim => ADM_kall,    &
         kmin => ADM_kmin
      implicit none
  
      integer, intent(in)  :: ijdim
      real(8), intent(in)  :: pre  (ijdim,kdim)
      real(8), intent(in)  :: u_z  (ijdim,kdim), v_z(ijdim,kdim)
      real(8), intent(in)  :: w_z  (ijdim,kdim), t_z(ijdim,kdim)
      real(8), intent(in)  :: plev
      real(8), intent(out) :: u_p  (ijdim),      v_p(ijdim)
      real(8), intent(out) :: w_p  (ijdim),      t_p(ijdim)
  
      integer :: ij, kk
      integer, allocatable :: kl(:), ku(:)
      real(8) :: wght_l, wght_u
      !---------------------------------------------------------------------------
  
      allocate( kl(ijdim) )
      allocate( ku(ijdim) )
  
      ! search z-level
      do ij=1, ijdim
         do kk=kmin,kdim
            if (pre(ij,kk)<plev) exit
         end do
         if (kk==kdim) stop "internal error! [sv_uvwp_850/mod_history_vars]"
         ku(ij) = kk
         kl(ij) = kk-1
      end do
  
      ! interpolate
      do ij=1, ijdim
         wght_l =  ( log(plev)           - log(pre(ij,ku(ij))) ) &
                 / ( log(pre(ij,kl(ij))) - log(pre(ij,ku(ij))) )
         wght_u =  ( log(pre(ij,kl(ij))) - log(plev) ) &
                 / ( log(pre(ij,kl(ij))) - log(pre(ij,ku(ij))) )
  
         u_p(ij) = wght_l*u_z(ij,kl(ij)) + wght_u*u_z(ij,ku(ij))
         v_p(ij) = wght_l*v_z(ij,kl(ij)) + wght_u*v_z(ij,ku(ij))
         w_p(ij) = wght_l*w_z(ij,kl(ij)) + wght_u*w_z(ij,ku(ij))
         t_p(ij) = wght_l*t_z(ij,kl(ij)) + wght_u*t_z(ij,ku(ij))
      end do
  
      deallocate( kl, ku )
  
      return
    end subroutine sv_plev_uvwt
  
  end module mod_history_vars
  !-------------------------------------------------------------------------------
  