include file: comstate.cdk 58
#if defined (DOC)
*
*     . J. Halle    *CMDA/AES Oct 99.
*             - Added ground temperature (TG) to the model state.
*     . Y. Yang   July 2003
*             - Declared nstr, ngtr and notr as vectors to accommodate multiple 
*               species.
*             - Increased JPNVARMAX=10 to 20
*     . Y.J. Rochon Feb. 2005
*             - Increased JPNVARMAX to 30 and added related comments.
C
C     COMDECK: COMSTATE
C     --------------
C     . Control of the different model state of the 3Dvar
C     . -  used by SUDIM  and SUALLO to decide which scalar
C     .    fields are needed and make the allocation accordingly
C     . -  used within some subroutines to verify if a field exists
C     .    or not
C
C     State variable numbers
C     ----------------------
C
C     JPNVARMAX : Max number of state variables
C                 1) JPNVARMAX must be >= NCMTMAX+9  (see comdim.cdk 
C                    and sustate.ftn)
C                 2) CFSTVAR and CFSTVAR2D dimensions in comgdpar.cdk
C                    must be large enough to accomodate number of variables
C                    based on JPNVARMAX. (see also sucva.ftn)
C
C                    JPNVARMAX (comstate.cdk), JPNVARM (comgdpar.cdk),  
C                    INBRVAR3D (and INBRVAR2D; comvarstd.cdk), and 
C                    NCMTMAX (comdim.cdk) must have consistent sizes!!! 
C    
C
C     Spectral model variable numbers
C
C      nsvor       : vorticity
C      nsdiv       : divergence
C      nstt        : temperature
C      nsq         : specific humidity
C      nsgz        : geopotential
C      nstr        : chemical species
C      nsps        : surface pressure
C      nstg        : ground temperature
C
C     Gridpoint  model variable numbers
C      nguu        : zonal wind image
C      ngvv        : meridional wind image
C      ngq         : specific humidity
C      nggz        : geopotential
C      ngtt        : temperature
C      ngtr        : chemical species 
C      ngps        : surface pressure
C      ngtg        : ground temperature
C
C     Model state at the observation locations
C      nouu        : zonal wind
C      novv        : meridional wind
C      noq         : specific humidity
C      nogz        : geopotential
C      nott        : temperature
C      notr        : chemical species
C      noes        : t - td
C      nops        : surface pressure
C      notg        : ground temperature
C
C     Spectral model states
C     ---------------------
C     NSEXIST(JVAR) = 1 spectral field exists
C     .               0 spectral field does not exist
C     NSEXIST(nsvor)    : vorticity
C     .      (nsdiv)    : divergence
C     .      (nstt)    : temperature
C     .      (nsq)    : specific humidity
C     .      (nsgz)    : geopotential
C     .      (nstr)    : species
C     .      (nsps)    : surface pressure
C     .      (nstg)    : ground temperature
C     --------------
C     NSPOSIT       : position within NKSDIM
C     NSPOSIT(nsvor)    : vorticity
C     .      (nsdiv)    : divergence
C     .      (nstt)    : temperature
C     .      (nsq)    : specific humidity
C     .      (nsgz)    : geopotential
C     .      (nstr)    : species
C     .      (nsps)    : surface pressure
C     .      (nstg)    : ground temperature
C     --------------
C
C     Gridpoint  model states
C     ---------------------
C
C     NGEXIST(JVAR) = 1 gridpoint field exists
C     .               0 gridpoint field does not exist
C     NGEXIST(nguu)    : zonal wind image
C     .      (ngvv)    : meridional wind image
C     .      (ngtt)    : temperature
C     .      (ngq)    : specific humidity
C     .      (nggz)    : geopotential
C     .      (ngtr)    : species
C     .      (ngps)    : surface pressure
C     .      (ngtg)    : ground temperature
C     --------------
C     NGPOSIT       : position within NKSDIM
C     NGPOSIT(nguu)    : zonal wind image
C     .      (ngvv)    : meridional wind image
C     .      (ngtt)    : temperature
C     .      (ngq)    : specific humidity
C     .      (nggz)    : geopotential
C     .      (ngtr)    : species
C     .      (ngps)    : surface pressure
C     .      (ngtg)    : ground temperature
C     --------------
C
C     Model state at the observation locations
C     ---------------------
C     NMVOEXIST(JVAR) = 1 gridpoint field exists
C     .                 0 gridpoint field does not exist
C     NMVOEXIST(nouu)    : zonal wind
C     .        (novv)    : meridional wind
C     .        (nott)    : temperature
C     .        (noq)    : specific humidity
C     .        (nogz)    : geopotential
C     .        (notr)    : species
C     .        (noes)    : t - td
C     .        (nops)    : surface pressure
C     .        (notg)    : ground temperature
C     --------------
C     NMVOPOSIT       : position within NKSDIM
C     NMVOPOSIT(nouu)    : zonal wind
C     .        (novv)    : meridional wind
C     .        (nott)    : temperature
C     .        (noq)    : specific humidity
C     .        (nogz)    : geopotential
C     .        (notr)    : species
C     .        (noes)    : t - td
C     .        (nops)    : surface pressure
C     .        (notg)    : ground temperature
C     --------------
C
#endif
      INTEGER JPNVARMAX
      PARAMETER (JPNVARMAX=30)
!
      INTEGER NSEXIST(JPNVARMAX), NSPOSIT(JPNVARMAX)               
      INTEGER NGEXIST(JPNVARMAX), NGPOSIT(JPNVARMAX)
      INTEGER NMVOEXIST(JPNVARMAX), NMVOPOSIT(JPNVARMAX)           
      INTEGER nsvor,nsdiv,nsq,nsgz,nstt,nstr(NCMTMAX),nsps,nstg
      INTEGER nguu,ngvv,ngq,nggz,ngtt,ngtr(NCMTMAX),ngps,ngtg
      INTEGER nouu,novv,noq,nogz,nott,notr(NCMTMAX),noes,nops,notg
!
      CHARACTER*4 CSNEED(JPNVARMAX), CGNEED(JPNVARMAX)             
      CHARACTER*4 CMVONEED(JPNVARMAX)
!
      COMMON /COMNSTATE/ NSEXIST, NSPOSIT                          
      COMMON /COMNSTATE/ NGEXIST, NGPOSIT                                       
      COMMON /COMNSTATE/ NMVOEXIST, NMVOPOSIT,nsvor,nsdiv,nsq,nsgz,nstt,nstr    
      COMMON /COMNSTATE/ nsps,nstg,nguu,ngvv,ngq,nggz,ngtt,ngtr,ngps,ngtg        
      COMMON /COMNSTATE/ nouu,novv,noq,nogz,nott,notr,noes,nops,notg
!
      COMMON /COMCSTATE/CSNEED, CGNEED, CMVONEED
!