SUBROUTINE CHAVARINAD (YDVAZG)

!**** *CHAVARINAD*    - Change of Variable

!     PURPOSE.
!     --------

!        Change variable :
!              NCNTVAR = 1 : identity
!              NCNTVAR = 2 : X ==> V((X-Xg)/SIGMAg)

!**   INTERFACE.
!     ----------

!        *CALL* *CHAVARINAD*

!        INPUT: YDVAZG and SPA3,SPA2 of YOMSP

!        OUTPUT: YDVAZG

!     METHOD.
!     -------

!     EXTERNALS.
!     ----------
!           CVAR2INAD

!     REFERENCE.
!     ----------
!        ECMWF Research Department documentation of the IFS

!     AUTHOR.
!     -------
!        J.N.THEPAUT and P.COURTIER   *ECMWF*

!     MODIFICATIONS.
!     --------------
!        Bill Heckley 22:09:92 Additional choice of control variable
!        M.Hamrud     15:12:95 Remove NCNTVAR=3
!        Y.Tremolet   05-08-02 Use control_vectors.
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        M.Hamrud      01-Dec-2003 CY28R1 Cleaning
!     ------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
USE YOMCT0 , ONLY: NCNTVAR
USE CONTROL_VECTORS

IMPLICIT NONE
TYPE(CONTROL_VECTOR),INTENT(INOUT) :: YDVAZG 
REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "abor1.intfb.h"
#include "cainad.intfb.h"
#include "cvar2inad.intfb.h"

!     ------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('CHAVARINAD',0,ZHOOK_HANDLE)

IF (NCNTVAR == 1) THEN
  CALL CAINAD(YDVAZG)
ELSEIF (NCNTVAR == 2) THEN
  CALL CVAR2INAD(YDVAZG)
ELSE
  CALL ABOR1(' BAD LUCK, ERROR NCNTVAR IN CHAVARINAD')
ENDIF

!     ------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('CHAVARINAD',1,ZHOOK_HANDLE)
END SUBROUTINE CHAVARINAD
