c-------------------------------------------------------------------------------
c  vk 06/08 There are 3 options of carry over states treatment
c  1. irdco = 0: there is no need to input snow states from input deck or grids,
c                zero snow states will be assumed; this is default option.
c                User should provide another IRDCO value if
c                grids or input deck states are available and should be used.
c  2. irdco = 1: all snow state are available from grids or input deck.
c  3. irdco = 2: only 7 snow states (we,neghs,liqw,tindex,accmax,sndpt,sntmp)
c                are available from grids or input deck; other snow states will 
c                be generated by program. Use this option with caushion because 
c                it will not guaranty time consistent states.
c-------------------------------------------------------------------------------
c 
C MEMBER CKCO19
C  (from old member FCPIN19)
C
      SUBROUTINE CKCO19(IRDCO,DTHR,PLWHC,SI,ADC,WE,NEGHS,LIQW,
     +                  TINDEX,ACCMAX,SB,SBAESC,SBWS,STORGE,AEADJ,
     +                  NEXLAG,EXLAG,SNDPT,SNTMP)
C.......................................
C     THIS SUBROUTINE CHECKS CARRYOVER VALUES FOR THE 'SNOW-17 '
C        OPERATION.
C.......................................
C     INITIALLY WRITTEN BY... ERIC ANDERSON - HRL   MAY |980
CVK   MODIFIED 4/00 BY V. KOREN TO ADD TWO MORE STATES
C.......................................

      REAL NEGHS,LIQW
      DIMENSION ADC(11), EXLAG(7)
C
C.......................................
C     CHECK IF A SNOW COVER EXISTS.
      IF(IRDCO.EQ.0) GO TO 100
      IF(WE.EQ.0.0) GO TO 100
      GO TO 110
C.......................................
C     SET TO NO SNOW CONDITIONS.
  100 WE=0.0
      NEGHS=0.0
      LIQW=0.0
      TINDEX=0.0
      ACCMAX=0.0
      SB=0.0
      SBAESC=0.0
      SBWS=0.0

CVK  TWO MORE STATES
      SNDPT=0.0
      SNTMP=0.0
      
  105 STORGE=0.0
      AEADJ=0.0
      DO 101 N=1,NEXLAG
  101 EXLAG(N)=0.0
      RETURN
C.......................................
C     SNOW COVER EXISTS -- MAKE CHECKS
  110 IF(NEGHS.LT.0.0) NEGHS=0.0
      xxs=PLWHC*WE 
      IF(LIQW.GT.xxs) LIQW=xxs
cck      IF(LIQW.GT.PLWHC*WE) LIQW=PLWHC*WE
c      IF(TINDEX.GT.0.0) TINDEX=0.0
      xxs=WE+LIQW
      IF(ACCMAX.LT.xxs) ACCMAX=xxs
cck      IF(ACCMAX.LT.(WE+LIQW)) ACCMAX=WE+LIQW

CVK    IF NO SNDPT & SNTMP STATES ENTERED, CALCULATE
CVK    THEM BASED ON OTHER AVAILABLE STATES
      IF(SNDPT .LE. 0.0) SNDPT=0.1*WE/0.2
      IF(SNTMP .EQ. 0. .AND. NEGHS .GT. 0.) SNTMP=TINDEX
      IF(SNTMP .GT. 0.0 .OR. SNTMP .EQ. -999.) SNTMP=TINDEX

c vk 06/08      IF(IRDCO.EQ.2) GO TO 120
      IF(IRDCO.EQ.1) GO TO 120
C
C     COMPUTE CARD 10 VALUES.
      TWE=WE+LIQW
      SBWS=TWE
      AI=ACCMAX
      IF(ACCMAX.GT.SI) AI=SI
      IF(TWE.LT.AI) GO TO 111
      SB=TWE
      SBAESC=1.0
      GO TO 105
  111 R=(TWE/AI)*10.0+1.0
      N=R
      FN=N
      R=R-FN
      SBAESC=ADC(N)+(ADC(N+1)-ADC(N))*R
      IF(SBAESC.GT.1.0) SBAESC=1.0
      SB=TWE+0.2*DTHR
      GO TO 105
C
C     CARD 10 VALUES READ IN - NO CHECKS
  120 CONTINUE
      RETURN
      END
