      SUBROUTINE HYDTABL (PVEG,SVEG,SOIL,GC,WCAP,ESLP,SMSK,LEN) 
C 
C     * M.LAZARE. - DEC  05/88. WCAP NOW SET TO SCAP INSTEAD OF FCAP TO 
C     *                         ENSURE LOWER GROUND TEMPERATURES OVER 
C     *                         LAND. 
C     * M.LAZARE. - JUNE 30/88. 
C 
C     * OBTAINS LOOK-UP TABLE HYDROLOGICAL FIELDS OF LENGTH LEN, DERIVED
C     * FROM INPUT FIELDS OF PRIMARY AND SECONDARY VEGETATION, SOIL 
C     * CLASS AND GROUND COVER. 
C     ********************* NOTE ***************************************
C     * THIS ROUTINE IS USED FOR BOTH THE MODEL AND DIAGNOSTIC DECK 
C     * HYDFLDS. ANY CHANGES TO EITHER MUST BE MUTUALLY INCLUSIVE!!!!!! 
C     ******************************************************************
C 
C     *      PVEG = PRIMARY VEGETATION CLASS. 
C     *      SVEG = SECONDARY VEGETATION CLASS. 
C     *      SOIL = SOIL CLASS. 
C     *      GC   = GROUND COVER. 
C     *      WCAP = RESULTING FIELD CAPACITY (KG/M2). 
C     *      ESLP = RESULTING EVAPOTRANSPIRATION SLOPE. 
C     *      SMSK = RESULTING SNOW-MASKING DEPTH (M). 
C     *      LEN  = LENGTH OF ALL FIELDS. 
C 
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      REAL PVEG(LEN),SVEG(LEN),SOIL(LEN),GC(LEN)
      REAL WCAP(LEN),ESLP(LEN),SMSK(LEN)
C 
C     * LOOK-UP ARRAY FOR HYDROLOGY FACTORS.
C     * EACH COLUMN REPRESENTS A PARTICULAR VEGETATION CLASS FOR
C     * PRIMARY AND SECONDARY VEGETATION. 
C     * THE THREE ROWS IN EACH COLUMN REPRESENT THE SOIL DEPTH (IN MM), 
C     * EVAPOTRANSPIRATION SLOPE AND SNOW MASKING DEPTH FOR THAT
C     * PARTICULAR VEGETATION CLASS.
C 
      COMMON /HYD/ HYDFACT(3,24)
  
      DATA HYDFACT /
     1  1000.E0,   0.25E0,   0.01E0,          0.E0,     0.E0,     0.E0, 
     2     0.E0,     0.E0,     0.E0,       1500.E0,   0.25E0,   12.0E0, 
     3  1500.E0,   0.25E0,    8.0E0,       1500.E0,   0.25E0,    8.0E0, 
     4  2000.E0,   0.25E0,    8.0E0,       2000.E0,   0.25E0,    8.0E0, 
     5  1000.E0,   0.75E0,    4.0E0,       1000.E0,   0.50E0,    2.0E0, 
     6  1000.E0,   0.50E0,    1.0E0,       1000.E0,   0.75E0,    1.0E0, 
     7  1000.E0,   0.75E0,    0.1E0,       1000.E0,   0.50E0,   0.15E0, 
     8  1000.E0,   0.50E0,    0.1E0,       1000.E0,   0.50E0,    0.1E0, 
     9  1000.E0,   0.50E0,    0.1E0,       1000.E0,   0.50E0,    0.1E0, 
     A  1000.E0,   0.50E0,    0.1E0,        750.E0,   0.25E0,    0.1E0, 
     B   500.E0,   0.75E0,    4.0E0,        750.E0,   0.50E0,   0.15E0, 
     C  1000.E0,   0.25E0,   0.01E0,        500.E0,   0.75E0,   0.01E0/ 
C 
C     * WEIGHTS FOR PRIMARY/SECONDARY VEGETATION FOR USE IN EVALUATING
C     * SOIL DEPTH, SNOWMASKING DEPTH AND EVAPOTRANSPIRATION SLOPE. 
C     * THESE VALUES MUST BE CONSISTENT WITH THOSE USED TO OBTAIN 
C     * THE ORIGINAL HIGH-RESOLUTION PRIMARY AND SECONDARY VEGETATION 
C     * CLASSES AND THOSE USED IN THE MODEL.
C 
      COMMON /WEIGHTV/ WEIGHTP,WEIGHTS 
C 
      DATA WEIGHTP,WEIGHTS /0.67E0,0.33E0/
C-----------------------------------------------------------------------
C 
C     * USE THE DESIRED LOOK-UP TABLE TO PRODUCE THE FIELDS.
C     * DEFINE SOIL DEPTH IN MILLIMETRES FROM LOOK-UP TABLE HYDFACT,
C     * ALSO THE EVAPOTRANSPIRATION SLOPE AND SNOW-MASKING DEPTH. 
C 
C     * CALCULATE SOIL VOLUME POROSITY AFTER DECOMPOSING SOIL FIELD INTO
C     * COLOUR, TEXTURE AND DRAINAGE. 
C     * DISTINGUISH BETWEEN SOIL "SATURATION" AND "FIELD" CAPACITY AS FOLLOWS:  
C     * SCAP = (DENSITY OF WATER) * (DEPTH OF SOIL) * (SOIL VOLUME POROSITY). 
C     * FCAP = (SCAP) * (XFCAP), WHERE SCAP IS SATURATION FIELD CAPACITY AND
C     * XFCAP IS THE RATIO OF FIELD CAPACITY (WHERE DRAINAGE BEGINS TO DEEPER 
C     * SOIL DUE TO GRAVITATIONAL EFFECTS) TO SATURATION FIELD CAPACITY (SCAP). 
C     * IT IS THEN ASSUMED THAT SOIL WITH FREE DRAINAGE DRAINS
C     * "INSTANTANEOUSLY", WHILE SOIL WITH POOR DRAINAGE DRAINS AT A
C     * VERY LONG TIME SCALE. 
C     * HENCE, WCAP RANGES FROM FCAP FOR FINE SOIL WITH FREE DRAINAGE 
C     * TO SCAP FOR COARSE SOIL WITH POOR DRAINAGE (28 TO 1200).
C     * OVER GLACIER ICE, USE PREDEFINED VALUE OF 200.
C 
C     * FOR WATER POINTS, USE EXPLICITLY-DEFINED VALUES TO AVOID HAVING AN
C     * ARRAY INDEX OF 0. 
C 
      DO 210 I=1,LEN
          IF(GC(I).EQ.-1.E0) THEN 
            DSOIL = (WEIGHTP*HYDFACT(1,(NINT(PVEG(I)))))+ 
     1              (WEIGHTS*HYDFACT(1,(NINT(SVEG(I)))))
            IC    = INT(SOIL(I))/100
            ICLR  = IC/100
            ITEX  = (IC-100*ICLR)/10
            IDRN  = IC-100*ICLR-10*ITEX 
            XVOID = 0.3E0+0.03E0*(ITEX+1) 
            XFCAP = 0.1E0+0.071E0*(ITEX+1)
            SCAP  = DSOIL*XVOID 
C           FCAP  = SCAP*XFCAP
            WCAP(I) = SCAP
            IF(PVEG(I).EQ.1.E0) WCAP(I)=200.E0
C 
            ESLP(I) = (WEIGHTP*HYDFACT(2,(NINT(PVEG(I)))))+ 
     1                (WEIGHTS*HYDFACT(2,(NINT(SVEG(I)))))
C 
            SMSK(I) = (WEIGHTP*HYDFACT(3,(NINT(PVEG(I)))))+ 
     1                (WEIGHTS*HYDFACT(3,(NINT(SVEG(I)))))
          ELSE
            WCAP(I) = 1000.E0 
            ESLP(I) =  1.E-6
            SMSK(I) =  0.E0 
          ENDIF 
  210 CONTINUE
C 
      RETURN
      END
