!-------------------------------------- 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_u2v(da_v,na_vdim,da_u,na_udim) 1,10
  use mod4dv, only : l4dvar
  use modstag, only : lstagwinds
  implicit none
  ! Argument declarations
  integer :: na_vdim ! Dimension of the control vector in forecast error coraviances space
  integer :: na_udim ! Dimension of the control vector in observation error covariances space
  real*8, dimension(na_udim) :: da_u ! Control variable in observation error covariances space
  real*8, dimension(na_vdim) :: da_v ! Control variable in forecast error covariances space
  ! Purpose:
  ! Projection of the solution of control variable in observation error covariances space to
  ! forecast error covariances space.\
  ! See Courtier, 1997, Dual formulation of four-dimentional variational assimilation,
  ! Q.J.R., pp2449-2461.
  !
  ! Author : Simon Pellerin *ARMA/MSC January 2005
  ! Revisions:

#include "comdim.cdk"
#include "comcva.cdk"
#include "comoabdy.cdk"
  ! Local declaration

  integer :: nl_ilev, nl_err

  ! HT(R-1/2 u)

  nsim3d = nsim3d + 1
  call tmg_start(2,'OBS-OPER') !
  call oda_u2cma(ncmomi,da_u,na_udim)

  call oda_sqrtRm1(ncmomi,ncmomi)

  CALL TRANSFER('ZOB0')
  call oda_HT

  call tmg_stop(2)

  CALL TRANSFER('ZGD0')
  call oda_LT

  CALL TRANSFER('ZSP0')

  da_v = 0.d0
  call oda_sqrtBT(da_v,na_vdim) ! GD -> da_v

end subroutine oda_u2v