!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer,
!                     version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer
!version 3 or (at your option) any later version that should be found at:
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html
!
!This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
!without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!See the above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software;
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec),
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
!

      subroutine subasic_obs(lcolumng) 1,12
c
      use MathPhysConstants_mod
      use physicsFunctions_mod
      use columnData_mod 
      implicit none
*
***s/r SUBASIC_OBS
*     OBJECT: Initialise background state dependant factors
*             and vectors for use in TLM and adjoint of
*             non-linear operator
*
*     Author  : S. Pellerin *ARMA/AES Sept. 98
*
*
      type(struct_columnData) :: lcolumng
      type(struct_vco), pointer :: vco_anl
      integer jlev,jobs,nlev_T
      real*8 zhu,one,zpresa,zpresb,zpresad,zpresbd

      vco_anl => col_getVco(lcolumng)
      one=1.0D0
      nlev_T = col_getNumLev(lcolumng,'TH')

!$OMP PARALLEL DO PRIVATE(jlev,jobs,zhu,zpresb,zpresbd,zpresa,zpresad)
      do jlev = 1, nlev_T
        do jobs=1,col_getNumCol(lcolumng)
          zhu=exp(col_getElem(lcolumng,jlev,jobs,'HU'))
          lcolumng%oltv(1,jlev,jobs) = fottva(zhu,one)
          lcolumng%oltv(2,jlev,jobs) = folnqva(zhu,col_getElem(lcolumng,jlev,jobs,'TT'),one)

          zpresb = vco_anl%db_M(jlev)
          zpresbd= vco_anl%db_dhyb_M(jlev)
          zpresa = vco_anl%da_M(jlev)
          zpresad= vco_anl%da_dhyb_M(jlev)
          lcolumng%rtapfac(jlev,jobs)= (zpresad+zpresbd*col_getElem(lcolumng,1,jobs,'P0'))
     &                        /(zpresa+zpresb*col_getElem(lcolumng,1,jobs,'P0'))
        enddo
      enddo
!$OMP END PARALLEL DO

      return
      end subroutine subasic_obs