!-------------------------------------- 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 GETVARTYPE(KNUMVAR,CTYPEVAR) 5
#if defined (DOC)
*
************************************************************************
*
***s/r        - TO GET THE TYPE OF VERTICAL LEVEL:
*               THERMODYNAMIC OR MOMENTUM.
*
*ARGUMENTS:
*
*     i-      KNUMVAR  : VARIABLE NUMBER
*
*     o-      CDVAR    : TYPE OF VERTICAL LEVEL
*
*       AUTHOR: N. WAGNEUR(CMC/CMDA TEL. 4779)
*
* Purpose: With a vertically staggered trial field, this routine
*          associates the VARNUM with either of the vertical grid
*          Momentum levels or thermodynamic levels are selected 
*          in accordance with the "forward" model.
*
*Revision:
**
************************************************************************
#endif
*
      IMPLICIT NONE
#include "comlun.cdk"
#include "comnumbr.cdk"
*
      INTEGER,          INTENT(IN)  :: KNUMVAR
      CHARACTER(len=*), INTENT(OUT) :: CTYPEVAR
*
************************************************************************
*
      CTYPEVAR = 'NA'
*
      IF ( KNUMVAR .EQ. NEUU .OR. 
     &     KNUMVAR .EQ. NEVV .OR. 
     &     KNUMVAR .EQ. NEUS .OR.
     &     KNUMVAR .EQ. NEVS .OR.
     &     KNUMVAR .EQ. NEFS .OR.
     &     KNUMVAR .EQ. NEGZ .OR.
     &     KNUMVAR .EQ. NEDS        ) THEN
           CTYPEVAR = 'MM' 
      ELSE IF ( KNUMVAR .EQ. NETT .OR. 
     &     KNUMVAR .EQ. NEES .OR. 
     &     KNUMVAR .EQ. NEHU .OR. 
     &     KNUMVAR .EQ. NEHS .OR. 
     &     KNUMVAR .EQ. NETS .OR. 
     &     KNUMVAR .EQ. NESS .OR.
     &     KNUMVAR .EQ. NERF        ) THEN
           CTYPEVAR = 'TH'
      ELSE IF ( KNUMVAR .EQ. NEPS .OR. 
     &     KNUMVAR .EQ. NEPN        ) THEN
           CTYPEVAR = 'SF'
      ELSE
           WRITE(NULOUT,*) ' '
           WRITE(NULOUT,*) 'VARIABLE NUMBER NOT MOMENTUM OR THERMO TYPE'
           WRITE(NULOUT,FMT='(I8))' )  KNUMVAR
           WRITE(NULOUT,*) ' '
      ENDIF    
*
      RETURN
      END