!-------------------------------------- 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 stdev_cv_glb2(kulstat,koutfile,ldhelm,ldfplane,ldtb_psi, 1
     &                       ldcoriol_one,pmpp,pmcu,pmtu,pmlq,pmpsu,pmtg)
#if defined (DOC)
*
***s/r stdev_cv_glb2  -  Compute St-deviation of Control Variables for XD-Var analysis.
*
*Author  : L. Fillion - ARMA/EC - 26 May 2009
*Revision: 
*
*
*    -------------------
**    Purpose: As part of the whole computation of Background error statistics computations.
*Arguments
*     kulstat  =
*     koutfile =
#endif
      IMPLICIT NONE
*implicits
#include "taglam4d.cdk"
#include "pardim.cdk"
#include "comdim.cdk"
#include "comct0.cdk"
#include "comlun.cdk"
#include "comgem.cdk"
#include "comcorr.cdk"
#include "comsp.cdk"
#include "comgd0.cdk"
#include "comgdpar.cdk"
#include "comcse1.cdk"
#include "comcva.cdk"
*
      logical ldhelm,ldfplane,ldtb_psi,ldcoriol_one
      INTEGER KULSTAT, koutfile
      real*8 pmpp(ni,nflev,nj)
      real*8 pmcu(ni,nflev,nj)
      real*8 pmtu(ni,nflev,nj)
      real*8 pmlq(ni,nflev,nj)
      real*8 pmpsu(ni,nj)
      real*8 pmtg(ni,nj)
!
      integer jband,ji,jj,jk,icase
      INTEGER jens,iens,jk1,jk2,jla,jn,jm,ila,ierr,jfile
!
      INTEGER FNOM, FSTOUV, FSTFRM, FCLOS, FSTPRM, FSTINF, FSTINL
!
!*    RPN Standard files parameters
!
      INTEGER INI,INJ,INK, INPAS, INBITS, IDATYP, IDEET
     +     ,IP1,IP2,IP3,IG1,IG2,IG3,IG4,ISWA,ILENGTH,IDLTF
     +     ,IUBC,IEXTR1,IEXTR2,IEXTR3
      INTEGER ILISTE(100),IDATE(100), IDATV(100), IDIMAX, INFON, IFSTRUN, IHH
      REAL*8 DHEURES
      CHARACTER*1 CLTYPVAR,CLGRTYP
      CHARACTER*2 CLNOMVAR
      CHARACTER*8 CLETIKET
!
      REAL*8 ZFACT, ZCORIOLIS
      REAL*8 DLFACT, DLFACT2
      EXTERNAL FNOM, FSTOUV, FSTFRM, FCLOS, FSTPRM, FSTINF, FSTINL
!
      INTEGER ICOUNT
!
!!
      WRITE(NULOUT,FMT=9000)
 9000 FORMAT(3(/,3x,80('.')),//
     S     ,4x,' stdev_cv_glb2- Estimation of Global Control Variables ST-DEV',//)
!
!
!     Compute mean and st-dev error in terms of analysis variables
!     ------------------------------------------------------------
!
      idimax = 100
!
!      call meancvgd_glb2(kulstat,koutfile,ldhelm,ldfplane,ldtb_psi, ! out: st-dev of control-variables error on koutfile
!     &          ldcoriol_one,pmpp,pmcu,pmtu,pmlq,pmpsu,pmtg)
!
      write(nulout,*) 'stdev_cv_glb2: END'
!
      return
      end