!-------------------------------------- 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 oda_L 5,9
  use mod4dv, only : l4dvar
  USE procs_topo,only   : myid 
  implicit none
  !
  !Purpose: Localisation (3D) / Tangent Linear Model (4D) operator
  !Compute profiled increments from grided increments
  !  ->In 3D mode : Call a bilinear interpolator
  !  ->In 4D mode : Send dx to the TLM and wait for the profiled increments
  !  ->Results are saved in COMMVO
  !Author  : S. Pellerin *ARMA/MRB January 2009
  !
  !Revision:
  !
  ! Luc Fillion - ARMA/EC - Upgrade 3dvar in LU/GU mode to v_10_2_2.
  ! Luc Fillion - ARMA/EC - 17 Jul 2009 - Introduce lcva_3db for 3dvar-fgat-TL-INMI.
  ! Luc Fillion - ARMA/EC - 18 Nov 2009 - Introduce rotated Gaussian grid option and gd2mvogenad...
  !
#include "comdim.cdk"
#include "comcva.cdk"
#include "comgrd_param.cdk"
  ! Local declarations
  integer :: nl_ilev, nl_err
  integer :: ierr
  !
  call tmg_start (76, 'GD<->PROF')                          !
  IF(L4DVAR.and.(.not.lcva_3db)) THEN
     if(myid == 0) CALL PUTDX2('P')
     call rpn_comm_barrier("GRID",ierr) 
     CALL GETPROF
     nl_ilev = 1
     if(.not.grd_roule.and.grd_typ.eq.'GU') then
       CALL GD2MVO('TG',nl_ilev)
     else
       call gd2mvogen('TG',nl_ilev)
     endif
     if(grd_roule) then
  !    Rotate tangential wind components to real sphere tangential components
       call uvrot2uv
     endif
  else
     CALL NEWBILIN
  endif
  call tmg_stop(76)
  
  !     TL of variable conversions
  !------------------------------
  call tmg_start(51,'VAR_CH') !
  call lpreobs
  call tmg_stop(51)
 
end subroutine oda_L