      SUBROUTINE PRDHIR(SFCTYP,TERHGT,TCLEAR,XLAT,T45678,UPRLAT,LOWLAT,
     +                  AMSU4,AMSU5,AMSU6,HIRSPT,METOP)
      IMPLICIT NONE
C
C**********************************************************************
C
C   NAME- PRDHIR
C
C   LANGUAGE- VS FORTRAN  TYPE- MAIN
C
C   VERSION- 1.0    DATE- 02/06/91   PROGRAMMER- ZHOU SISONG
C   VERSION- 1.1    DATE- 10/31/91   PROGRAMMER- TIM GARDNER (HSTX)
C   VERSION- 2.0    DATE- 09/27/95   PROGRAMMER- LEAH CASEY (HSTX)
C   VERSION- 2.1    DATE- 06/03/96   PROGRAMMER- LEAH CASEY (HSTX)
C   VERSION- 3.0    DATE- 11/13/97   PROGRAMMER- BRIAN BARIL (HSTX)
C   VERSION- 3.1    DATE- 01/08/99   PROGRAMMER- BRIAN BARIL (RITS)
C   VERSION- 3.2    DATE- 11/22/99   PROGRAMMER- A. ALLEGRINO (RAYTHEON)
C   VERSION- 3.3    DATE- 12/01/99   PROGRAMMER- A. ALLEGRINO (RAYTHEON)
C   VERSION- 3.4    DATE- 02/10/00   PROGRAMMER- A. ALLEGRINO (RAYTHEON)
C   VERSION- 3.5    DATE- 10/22/01   PROGRAMMER- A. ALLEGRINO (RAYTHEON)
C   VERSION- 3.6    DATE- 09/17/03   PROGRAMMER- F. TILLEY (RAYTHEON)
C   VERSION- 3.7    DATE- 01/20/04   PROGRAMMER- F. TILLEY (RAYTHEON)
C   VERSION- 3.8    DATE- 05/20/04   PROGRAMMER- F. TILLEY (RAYTHEON)
C   VERSION- 4.0    DATE- 08/03/06   PROGRAMMER- FRANK TILLEY (IMSG)
C
C   FUNCTION-*$ED23TG* PREDICTS HIRS 2-8 TEMPS. USING HIRS 1-3 AND
C       AMSUA 5,7,& 9 VALUES.
C   VERSION- 2.0 INCLUSION INTO RTOVS CLDTOP ROUTINE.
C   VERSION- 2.1 MODS FOR ATTENUATION ABOVE THE CLOUDS.
C   VERSION- 3.0 MODIFICATIONS FOR INCLUSIONS INTO ATOVS.
C   VERSION- 3.1 ADDED A CONDITION IN WHICH IF OVER LAND FOR ZONE
C                ONE, USE ZONE 2 COEFS. OTHERWISE USE ZONE 1.
C   VERSION- 3.2 CHANGED THE TEST OVER LAND FOR ZONE 1 TO INCLUDE
C                SNOW COVERED LAND (TERRAIN TYPE = SNOW)
C   VERSION- 3.3 CHANGED THE CODE TO USE ZONE 2 COEFFICIENTS FOR ZONE 1
C                FOR ALL TERRAIN TYPES.
C   VERSION- 3.4 CHANGED THE CODE TO USE ZONE 1 COEFFICIENTS FOR ZONE 1
C                FOR ALL TERRAIN TYPES.
C   VERSION- 3.5 CHANGED THE CODE TO USE COMPUTED COEFFICIENTS WITHIN 
C                CERTAIN LATITUDE TRANSITION ZONES AS DEFINED VIA THE
C                SOFTFLAGS FILE. (WR#176)
C   VERSION- 3.6 ADDED 'TERHGT' TO CALLING ARGUMENTS AND MADE THE USE
C                OF AMSU-A CHANNEL COMBINATIONS DEPENDENT UPON SURFACE
C                TYPE AND TERRAIN HEIGHT.
C                  AMSU-A 4, 5, 6    OCEAN
C                  AMSU-A 5, 6, 7    NON-SEA BELOW 1600 METERS
C                  AMSU-A 6, 7, 8    NON-SEA ABOVE 1600 METERS 
C   VERSION- 3.7 ADDED ANOTHER SET OF CHANNEL COMBINATIONS FOR 
C                ELEVATIONS ABOVE 2900 METERS. 
C                  AMSU-A 4, 5, 6    OCEAN
C                  AMSU-A 5, 6, 7    NON-SEA BELOW 1600 METERS
C                  AMSU-A 6, 7, 8    NON-SEA BETWEEN 1600-2900 METERS
C                  AMSU-A 7, 8, 9    NON-SEA ABOVE 2900 METERS
C                ADDING AMSU-A CHANNEL 9 REQUIRED INCREASING THE
C                SIZE OF THE TCLEAR ARRAY.
C   VERSION- 3.8 ADDED CODE TO COMPUTE INTERPOLATION SLOPES AND
C                INTERCEPTS LOCALLY INSTEAD OF HAVING THEM PASSED
C                IN FROM THE CALLING ROUTINE. (WR #257)
C   VERSION- 4.0 ADDED CODE TO PREDICT HIRS CHANNELS 2 AND 3.
C                CHANGED DIMENSIONS OF T45678 FROM (7,5,5) TO
C                (4,7,5). CHANGED PREDICTORS BASED ON HIRS CHANNELS,
C                TERRAIN, AND TERRAIN HEIGHT.
C   
C
C   PARAMETERS-
C      VARIABLE                TYPE I/O FUNCTION
C      --------                ---- --- --------
C      SFCTYP                  INT   I   SURFACE TYPE
C      TERHGT                  INT   I   TERRAIN HEIGHT
C      TCLEAR(27)              REAL  I/O HIRS AND AMSU-A CLEAR 
C                                        BRIGHTNESS TEMPERATURES
C      XLAT                    REAL  I   LATITUDE OF SPOT.
C      T45678                  REAL  I   COEFFICIENTS FOR PREDICTING
C                                        HIRS CHANNELS 2-8.
C      UPRLAT(4)               REAL  I   NORTHERNMOST LATITUDE LIMIT FOR
C                                        INTERPOLATION
C      LOWLAT(4)               REAL  I   SOUTHERNMOST LATITUDE LIMIT FOR
C                                        INTERPOLATION
C      AMSU4                   REAL  I   PRECIP ADJUSTED AMSU-A CHANNEL 4
C                                        BRIGHTNESS TEMP.
C      AMSU5                   REAL  I   PRECIP ADJUSTED AMSU-A CHANNEL 5
C                                        BRIGHTNESS TEMP.
C      AMSU6                   REAL  I   PRECIP ADJUSTED AMSU-A CHANNEL 6
C                                        BRIGHTNESS TEMP.
C      COEFA,COEFB,COEFC       REAL      THE INTERPOLATED COEFFICIENTS USED
C                                        IN THE LATITUDE TRANSITION AREAS.
C      ZONIDX                   INT      A FLAG WHICH DECLARES IF THE LATITUDE
C                                        IS WITHIN THE INTERPOLATION ZONES.
C      SLOPEA,SLOPEB,SLOPEC    REAL      LOCALLY COMPUTED SLOPES FOR GENERATING
C                                        COEFA, COEFB, AND COEFC
C      INTRCA,INTRCB,INTRCC    REAL      LOCALLY COMPUTED INTERCEPTS FOR
C                                        GENERATING COEFA, COEFB, AND COEFC
C
C     COMMON AREAS- 
C
C     SUBROUTINES CALLED- NONE
C
C**********************************************************************
C
C
      REAL   TCLEAR(28), XLAT, SUM2, SUM3, SUM4, SUM5, SUM6, SUM7, SUM8
      REAL   T45678(4,7,5), COEFA,COEFB,COEFC
      REAL   SLOPEA, SLOPEB, SLOPEC, INTRCA, INTRCB, INTRCC
      REAL   UPRLAT(4),LOWLAT(4), AMSU4, AMSU5, AMSU6
      REAL   SLOPE(4,7,4), INTRC(4,7,4), DELTA6, DELTA7, DELTA8
      REAL   DELTA3, DELTA4, DELTA5, RTEMP6, RTEMP7, RTEMP8
      REAL   DWARM6(56),DWARM7(56),DWARM8(56),DCOOL6(56),DCOOL7(56)
      REAL   DCOOL8(56),TWMAX6,TWMAX7,TWMAX8,TCMAX6,TCMAX7,TCMAX8
      REAL   D9WARM6(56),D9WARM7(56),D9WARM8(56),D9COOL6(56),D9COOL7(56)
      REAL   D9COOL8(56),T9WMAX6,T9WMAX7,T9WMAX8,T9CMAX6,T9CMAX7,T9CMAX8
      REAL   D9BIAS6(56),D9BIAS7(56),D9BIAS8(56),TCLROBS(8)
      REAL   DEL6, DEL7, DEL8, DIFF6, DIFF7, DIFF8
      PARAMETER (TWMAX6=2.28,TWMAX7=3.85,TWMAX8=11.2,TCMAX6=0.8,TCMAX7=1.0,
     +           TCMAX8=1.0,T9WMAX6=-0.3,T9WMAX7=-1.6,T9WMAX8=-4.0,
     +           T9CMAX6=-0.90,T9CMAX7=-2.50,T9CMAX8=-8.10)
      INTEGER SFCTYP, TERHGT, NZ, STATUS,I,J,L,ZONIDX 
      INTEGER AMSUCH, INZ, CHN, ICOEF, HIRSPT
      LOGICAL FIRSTCALL, METOP
      DATA FIRSTCALL/.TRUE./
      DATA DWARM6/56*0.0/
      DATA DWARM7/56*0.0/
      DATA DWARM8/56*0.0/
      DATA DCOOL6/56*0.0/
      DATA DCOOL7/56*0.0/
      DATA DCOOL8/56*0.0/
      DATA D9WARM6/56*0.0/
      DATA D9WARM7/56*0.0/
      DATA D9WARM8/56*0.0/
      DATA D9COOL6/56*0.0/
      DATA D9COOL7/56*0.0/
      DATA D9COOL8/56*0.0/
      DATA D9BIAS6/0.36,0.37,0.34,0.36,0.39,0.43,0.44,0.41,0.41,0.29,
     +             0.26,0.19,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
     +             0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
     +             0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
     +             0.00,0.00,0.00,0.00,0.00,0.11,0.12,0.13,0.18,0.28,
     +             0.39,0.39,0.45,0.58,0.71,0.86/
      DATA D9BIAS7/1.83,1.16,1.12,0.95,0.96,0.94,0.92,0.82,0.68,0.51,
     +             0.38,0.33,0.24,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
     +             0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
     +             0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
     +             0.00,0.00,0.00,0.00,0.00,0.00,0.08,0.32,0.50,0.70,
     +             0.92,1.07,1.31,1.54,1.71,1.85/
      DATA D9BIAS8/7.51,7.11,5.54,5.43,5.00,4.97,4.71,3.64,2.92,2.68,
     +             2.26,1.40,1.31,1.04,0.00,0.00,0.00,0.00,0.00,0.00,
     +             0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
     +             0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,
     +             0.00,0.00,0.00,0.00,0.82,1.48,2.17,3.73,4.35,4.96,
     +             5.57,6.12,6.82,7.48,8.24,9.21/
      SAVE FIRSTCALL, DWARM6, DWARM7, DWARM8, DCOOL6, DCOOL7, DCOOL8,
     +     D9WARM6, D9WARM7, D9WARM8, D9COOL6, D9COOL7, D9COOL8
C
C-- THE FIRST TIME THE SUBROUTINE IS CALLED, GENERATE THE DELTAS FOR
C   56 SPOTS FOR CHANNELS 6 THROUGH 8.
C
      IF (FIRSTCALL) THEN
         DWARM6(1)  = TWMAX6
         DWARM6(56) = TWMAX6
         DWARM7(1)  = TWMAX7
         DWARM7(56) = TWMAX7
         DWARM8(1)  = TWMAX8
         DWARM8(56) = TWMAX8
         DCOOL6(1)  = TCMAX6
         DCOOL6(56) = TCMAX6
         DCOOL7(1)  = TCMAX7
         DCOOL7(56) = TCMAX7
         DCOOL8(1)  = TCMAX8
         DCOOL8(56) = TCMAX8
         D9WARM6(1)  = T9WMAX6
         D9WARM6(56) = T9WMAX6
         D9WARM7(1)  = T9WMAX7
         D9WARM7(56) = T9WMAX7
         D9WARM8(1)  = T9WMAX8
         D9WARM8(56) = T9WMAX8
         D9COOL6(1)  = T9CMAX6
         D9COOL6(56) = T9CMAX6
         D9COOL7(1)  = T9CMAX7
         D9COOL7(56) = T9CMAX7
         D9COOL8(1)  = T9CMAX8
         D9COOL8(56) = T9CMAX8
C
C-- THE ADJUSTMENT FOR METOP SPOTS WHERE AMSU-A CHANNEL 6 EXCEEDS 243.0 IS
C   CALCULATED FOR SPOTS 1-25 AND 32-56.
C
         J = 55
         DO I = 2, 25
            DWARM6(I) = DWARM6(I-1) - (TWMAX6 / 24.0)
            DWARM6(J) = DWARM6(I)
            DWARM7(I) = DWARM7(I-1) - (TWMAX7 / 24.0)
            DWARM7(J) = DWARM7(I)
            DWARM8(I) = DWARM8(I-1) - (TWMAX8 / 24.0)
            DWARM8(J) = DWARM8(I)
            J = J - 1
         END DO
C
C-- THE ADJUSTMENT FOR METOP SPOTS WHERE AMSU-A CHANNEL 6 IS 243.0 OR LESS
C   IS CALCULATED FOR SPOTS 1-8 AND 49-56.
C
         J = 55
         DO I = 2,8
            DCOOL6(I) = DCOOL6(I-1) - (TCMAX6 / 7.0)
            DCOOL6(J) = DCOOL6(I)
            DCOOL7(I) = DCOOL7(I-1) - (TCMAX7 / 7.0)
            DCOOL7(J) = DCOOL7(I)
            DCOOL8(I) = DCOOL8(I-1) - (TCMAX8 / 7.0)
            DCOOL8(J) = DCOOL8(I)
            J = J - 1
         END DO
C
C-- THE ADJUSTMENT FOR NOAA-19 SPOTS WHERE AMSU-A CHANNEL 6 EXCEEDS 243.0 IS
C   CALCULATED FOR SPOTS 1-15  AND 42-56.
C
         J = 55
         DO I = 2, 15
            D9WARM6(I) = D9WARM6(I-1) - (T9WMAX6 / 14.0)
            D9WARM6(J) = D9WARM6(I)
            D9WARM7(I) = D9WARM7(I-1) - (T9WMAX7 / 14.0)
            D9WARM7(J) = D9WARM7(I)
            D9WARM8(I) = D9WARM8(I-1) - (T9WMAX8 / 14.0)
            D9WARM8(J) = D9WARM8(I)
            J = J - 1
         END DO
C
C-- THE ADJUSTMENT FOR NOAA-19 METOP SPOTS WHERE AMSU-A CHANNEL 6 IS 243.0 OR LESS
C   IS CALCULATED FOR SPOTS 1-15 AND 42-56.
C
         J = 55
         DO I = 2,15
            D9COOL6(I) = D9COOL6(I-1) - (T9CMAX6 / 14.0)
            D9COOL6(J) = D9COOL6(I)
            D9COOL7(I) = D9COOL7(I-1) - (T9CMAX7 / 14.0)
            D9COOL7(J) = D9COOL7(I)
            D9COOL8(I) = D9COOL8(I-1) - (T9CMAX8 / 14.0)
            D9COOL8(J) = D9COOL8(I)
            J = J - 1
         END DO
         FIRSTCALL = .FALSE.
      END IF

C-- DETERMINE THE LATITUDE ZONE BASED ON THE LATITUDE OF THE SPOT.
            
      IF(XLAT.GT.60.0) THEN
         NZ=1
      ELSEIF(XLAT.GT.30.0) THEN
         NZ=2
      ELSEIF(XLAT.GT.-30.0) THEN
         NZ=3
      ELSEIF(XLAT.GT.-60.0) THEN
         NZ=4
      ELSE
         NZ=5
      END IF
C
C-- SAVE A LOCAL COPY OF OBSERVED TEMPERATURES FOR CHANNELS 2
C   THROUGH 8
C
      DO I = 2, 8
         TCLROBS(I) = TCLEAR(I)
      END DO
C
C ============================>
C  PREDICT HIRS CH. 2,3,4,5,6,7 & 8 BRIGHTNESS TEMPERATURES FROM
C  AMSUA CHANNELS BETWEEN 4 AND 9 (3 CHANNELS)
C  9/17/03 BASE THE AMSU-A CHANNELS TO USE BASED ON TERRAIN TYPE
C  AND TERRAIN HEIGHT.
C
      SUM2=0.0
      SUM3=0.0
      SUM4=0.0
      SUM5=0.0
      SUM6=0.0
      SUM7=0.0
      SUM8=0.0
C
      DEL6 = 0.0
      DEL7 = 0.0
      DEL8 = 0.0
C
C SET THE STARTING POINT IN THE TCLEAR ARRAY FOR EXTRACTING 
C AMSU-A CHANNEL BRIGHTNESS TEMPERATURES.
C  
C   OVER OCEAN USE AMSU-A CHANNELS 4, 5, AND 6
C
      IF (SFCTYP.EQ.0) THEN
         AMSUCH = 21
      END IF
C
C   OVER NON-SEA BELOW 1600 METERS USE AMSU-A CHANNELS 5, 6, 
C   AND 7.
C   BETWEEN 1600 AND 2900 METERS USE AMSU-A CHANNELS, 6, 7, AND 8.
C   ABOVE 2900 METERS USE AMSU-A CHANNELS 7, 8, AND 9
C
      IF (SFCTYP.NE.0) THEN
         IF (TERHGT.LT.1600) 
     +      AMSUCH = 22
         IF (TERHGT.GE.1600.AND.TERHGT.LE.2900)
     +      AMSUCH = 23
         IF (TERHGT.GT.2900)
     +      AMSUCH = 24
      END IF
C
C  COMPUTE SLOPES AND INTERCEPTS FOR INTERPOLATION WITHIN TRANSITION
C  ZONES
C
      DO INZ=1,4
         DO CHN = 1,7
            DO ICOEF= 1,4
               SLOPE(ICOEF,CHN,INZ) = (T45678(ICOEF,CHN,INZ) -
     +                                T45678(ICOEF,CHN,INZ+1)) /
     +                                (UPRLAT(INZ) - LOWLAT(INZ))
               INTRC(ICOEF,CHN,INZ) = T45678(ICOEF,CHN,INZ) -
     +                                (SLOPE(ICOEF,CHN,INZ)*UPRLAT(INZ)) 
            END DO
         END DO
      END DO
C
C  CHECK THE LATITUDE FOR EACH SPOT AND IF IT FALLS WITHIN THE
C  TRANSITION ZONES COMPUTE COEFA AND COEFB AND APPLY THESE TO THE 
C   TEMPERATURES. (ASA,10/22/01)
C
      ZONIDX = 0
c     DO I = 1, 4
      DO I = 1, 3
         IF (XLAT.LT.UPRLAT(I) .AND. XLAT.GT.LOWLAT(I)) THEN
            ZONIDX = I
         END IF
      END DO

      DO L=1,3
      
         IF(ZONIDX.GT.0) THEN
C
C  USE AMSU-A CHANNELS 7, 8, AND 9 TO PREDICT HIRS CHANNELS 2 AND 3
C  OVER ALL TERRAIN TYPES AND TERRAIN HEIGHTS 
C
C    HIRS CHANNEL 2
C
            COEFB = SLOPE(L+1,1,ZONIDX)*XLAT + INTRC(L+1,1,ZONIDX)
            SUM2=SUM2+COEFB*TCLEAR(L+24)
C
C    HIRS CHANNEL 3
C
            COEFB = SLOPE(L+1,2,ZONIDX)*XLAT + INTRC(L+1,2,ZONIDX)
            SUM3=SUM3+COEFB*TCLEAR(L+24)
C
C  FOR HIRS CHANNEL 4 USE AMSU-A CHANNELS 6, 7, AND 8 FOR TERRAIN
C  <= 2900 METERS AND AMSU-A CHANNELS 7, 8, AND 9 FOR TERRAIN
C  HIGHER THAN 2900 METERS.
C
C    HIRS CHANNEL 4
C
            COEFB = SLOPE(L+1,3,ZONIDX)*XLAT + INTRC(L+1,3,ZONIDX)
            IF (TERHGT.LE.2900) THEN
               SUM4=SUM4+COEFB*TCLEAR(L+23)
            ELSE
               SUM4=SUM4+COEFB*TCLEAR(L+24)
            END IF
C
C  FOR HIRS CHANNEL 5 USE AMSU-A CHANNELS 5, 6, AND 7 OVER SEA AND
C  OVER LAND WITH TERRAIN HEIGHT <= 1600 METERS, CHANNELS 6, 7, AND
C  8 FOR TERRAIN HEIGHT BETWEEN 1600 AND 2900 METERS, AND CHANNELS
C  7, 8, AND 9 FOR TERRAIN HIGHER THAN 2900 METERS.
C
C    HIRS CHANNEL 5
C
            COEFB = SLOPE(L+1,4,ZONIDX)*XLAT + INTRC(L+1,4,ZONIDX)
            IF (SFCTYP.EQ.0) THEN
               SUM5=SUM5+COEFB*TCLEAR(L+22)
            ELSE
               IF (TERHGT.LE.2900) THEN
                  SUM5=SUM5+COEFB*TCLEAR(L+23)
               ELSE
                  SUM5=SUM5+COEFB*TCLEAR(L+24)
               END IF
            END IF
C
C  FOR HIRS CHANNELS 6, 7, AND 8, USE AMSU-A CHANNELS 4, 5, AND
C  6 OVER SEA, 5, 6, AND 7 OVER LAND WITH TERRAIN HEIGHT <= 1600
C  METERS, 6, 7, AND 8 WITH TERRAIN HEIGHTS BETWEEN 1600 AND 2900
C  METERS, AND 7, 8, AND 9 ABOVE 2900 METERS.
C
            IF (SFCTYP.EQ.0) THEN
               COEFB = SLOPE(L+1,5,ZONIDX)*XLAT + INTRC(L+1,5,ZONIDX)
               SUM6=SUM6+COEFB*TCLEAR(L+21)
C
               COEFB = SLOPE(L+1,6,ZONIDX)*XLAT + INTRC(L+1,6,ZONIDX)
               SUM7=SUM7+COEFB*TCLEAR(L+21)
C
               COEFB = SLOPE(L+1,7,ZONIDX)*XLAT + INTRC(L+1,7,ZONIDX)
               SUM8=SUM8+COEFB*TCLEAR(L+21)
            ELSE
               IF (TERHGT.LE.2900) THEN
                  COEFB = SLOPE(L+1,5,ZONIDX)*XLAT + INTRC(L+1,5,ZONIDX)
                  SUM6=SUM6+COEFB*TCLEAR(L+23)
C
                  COEFB = SLOPE(L+1,6,ZONIDX)*XLAT + INTRC(L+1,6,ZONIDX)
                  SUM7=SUM7+COEFB*TCLEAR(L+23)
C
                  COEFB = SLOPE(L+1,7,ZONIDX)*XLAT + INTRC(L+1,7,ZONIDX)
                  SUM8=SUM8+COEFB*TCLEAR(L+23)
               ELSE
                  COEFB = SLOPE(L+1,5,ZONIDX)*XLAT + INTRC(L+1,5,ZONIDX)
                  SUM6=SUM6+COEFB*TCLEAR(L+24)
C
                  COEFB = SLOPE(L+1,6,ZONIDX)*XLAT + INTRC(L+1,6,ZONIDX)
                  SUM7=SUM7+COEFB*TCLEAR(L+24)
C
                  COEFB = SLOPE(L+1,7,ZONIDX)*XLAT + INTRC(L+1,7,ZONIDX)
                  SUM8=SUM8+COEFB*TCLEAR(L+24)
               END IF
            END IF
         ELSE
C
C  HIRS CHANNEL 2
C
            IF (NZ.NE.5) THEN
               SUM2 = SUM2+T45678(L+1,1,NZ)*TCLEAR(L+24)
C
C  HIRS CHANNEL 3
C

               SUM3 = SUM3+T45678(L+1,2,NZ)*TCLEAR(L+24)
C
C  HIRS CHANNEL 4
C

               IF (TERHGT.LE.2900) THEN
                  SUM4 = SUM4+T45678(L+1,3,NZ)*TCLEAR(L+23)
               ELSE
                  SUM4 = SUM4+T45678(L+1,3,NZ)*TCLEAR(L+24)
               END IF
C
C  HIRS CHANNEL 5
C
               IF (SFCTYP.EQ.0) THEN
                  SUM5 = SUM5+T45678(L+1,4,NZ)*TCLEAR(L+22)
               ELSE
                  IF (TERHGT.LE.2900) THEN
                     SUM5 = SUM5+T45678(L+1,4,NZ)*TCLEAR(L+23)
                  ELSE
                     SUM5 = SUM5+T45678(L+1,4,NZ)*TCLEAR(L+24)
                  END IF
               END IF
C
C  HIRS CHANNEL 6, 7, 8
C
               IF (SFCTYP.EQ.0) THEN
                  SUM6 = SUM6+T45678(L+1,5,NZ)*TCLEAR(L+21)
C

                  SUM7 = SUM7+T45678(L+1,6,NZ)*TCLEAR(L+21)
C

                  SUM8 = SUM8+T45678(L+1,7,NZ)*TCLEAR(L+21)
C
               ELSE
                  IF (TERHGT.LE.2900) THEN
                     SUM6 = SUM6+T45678(L+1,5,NZ)*TCLEAR(L+23)
                     SUM7 = SUM7+T45678(L+1,6,NZ)*TCLEAR(L+23)
                     SUM8 = SUM8+T45678(L+1,7,NZ)*TCLEAR(L+23)
                  ELSE
                     SUM6 = SUM6+T45678(L+1,5,NZ)*TCLEAR(L+24)
                     SUM7 = SUM7+T45678(L+1,6,NZ)*TCLEAR(L+24)
                     SUM8 = SUM8+T45678(L+1,7,NZ)*TCLEAR(L+24)
                  END IF
               END IF
            ELSE
               IF (SFCTYP.EQ.0) THEN
C-- USE ZONE 4 COEFFICIENTS OVER OCEAN IN ZONE 5
                  SUM2 = SUM2+T45678(L+1,1,NZ-1)*TCLEAR(L+24)
                  SUM3 = SUM3+T45678(L+1,2,NZ-1)*TCLEAR(L+24)
                  SUM4 = SUM4+T45678(L+1,3,NZ-1)*TCLEAR(L+23)
                  SUM5 = SUM5+T45678(L+1,4,NZ-1)*TCLEAR(L+22)
                  SUM6 = SUM6+T45678(L+1,5,NZ-1)*TCLEAR(L+21)
                  SUM7 = SUM7+T45678(L+1,6,NZ-1)*TCLEAR(L+21)
                  SUM8 = SUM8+T45678(L+1,7,NZ-1)*TCLEAR(L+21)
               ELSE
                  SUM2 = SUM2+T45678(L+1,1,NZ)*TCLEAR(L+24)
                  SUM3 = SUM3+T45678(L+1,2,NZ)*TCLEAR(L+24)
                  IF (TERHGT.LE.2900) THEN
                     SUM4 = SUM4+T45678(L+1,3,NZ)*TCLEAR(L+23)
                  ELSE
                     SUM4 = SUM4+T45678(L+1,3,NZ)*TCLEAR(L+24)
                  END IF
                  IF (TERHGT.LE.2900) THEN
                     SUM5 = SUM5+T45678(L+1,4,NZ)*TCLEAR(L+23)
                  ELSE
                     SUM5 = SUM5+T45678(L+1,4,NZ)*TCLEAR(L+24)
                  END IF
                  IF (TERHGT.LE.2900) THEN
                     SUM6 = SUM6+T45678(L+1,5,NZ)*TCLEAR(L+23)
                     SUM7 = SUM7+T45678(L+1,6,NZ)*TCLEAR(L+23)
                     SUM8 = SUM8+T45678(L+1,7,NZ)*TCLEAR(L+23)
                  ELSE
                     SUM6 = SUM6+T45678(L+1,5,NZ)*TCLEAR(L+24)
                     SUM7 = SUM7+T45678(L+1,6,NZ)*TCLEAR(L+24)
                     SUM8 = SUM8+T45678(L+1,7,NZ)*TCLEAR(L+24)
                  END IF
               END IF
            END IF
         END IF
C
      END DO
C
C INCLUDE THE INTERCEPTS INTO THE SUMS AND FINALIZE THE PREDICTED
C TEMPERATURES
C
      IF(ZONIDX.GT.0) THEN
         COEFC = SLOPE(1,1,ZONIDX)*XLAT + INTRC(1,1,ZONIDX)
         TCLEAR(2) = COEFC + SUM2
C
         COEFC = SLOPE(1,2,ZONIDX)*XLAT + INTRC(1,2,ZONIDX)
         TCLEAR(3) = COEFC + SUM3
C
         COEFC = SLOPE(1,3,ZONIDX)*XLAT + INTRC(1,3,ZONIDX)
         TCLEAR(4) = COEFC + SUM4
C
         COEFC = SLOPE(1,4,ZONIDX)*XLAT + INTRC(1,4,ZONIDX)
         TCLEAR(5) = COEFC + SUM5
C
         COEFC = SLOPE(1,5,ZONIDX)*XLAT + INTRC(1,5,ZONIDX)
         TCLEAR(6) = COEFC + SUM6
C
         COEFC = SLOPE(1,6,ZONIDX)*XLAT + INTRC(1,6,ZONIDX)
         TCLEAR(7) = COEFC + SUM7
C
         COEFC = SLOPE(1,7,ZONIDX)*XLAT + INTRC(1,7,ZONIDX)
         TCLEAR(8) = COEFC + SUM8
C
      ELSE
C
         IF (NZ.NE.5) THEN
            TCLEAR(2) = T45678(1,1,NZ) + SUM2
            TCLEAR(3) = T45678(1,2,NZ) + SUM3
            TCLEAR(4) = T45678(1,3,NZ) + SUM4
            TCLEAR(5) = T45678(1,4,NZ) + SUM5
            TCLEAR(6) = T45678(1,5,NZ) + SUM6
            TCLEAR(7) = T45678(1,6,NZ) + SUM7
            TCLEAR(8) = T45678(1,7,NZ) + SUM8
         ELSE
            IF (SFCTYP.NE.0) THEN
               TCLEAR(2) = T45678(1,1,NZ) + SUM2
               TCLEAR(3) = T45678(1,2,NZ) + SUM3
               TCLEAR(4) = T45678(1,3,NZ) + SUM4
               TCLEAR(5) = T45678(1,4,NZ) + SUM5
               TCLEAR(6) = T45678(1,5,NZ) + SUM6
               TCLEAR(7) = T45678(1,6,NZ) + SUM7
               TCLEAR(8) = T45678(1,7,NZ) + SUM8
            ELSE
               TCLEAR(2) = T45678(1,1,NZ-1) + SUM2
               TCLEAR(3) = T45678(1,2,NZ-1) + SUM3
               TCLEAR(4) = T45678(1,3,NZ-1) + SUM4
               TCLEAR(5) = T45678(1,4,NZ-1) + SUM5
               TCLEAR(6) = T45678(1,5,NZ-1) + SUM6
               TCLEAR(7) = T45678(1,6,NZ-1) + SUM7
               TCLEAR(8) = T45678(1,7,NZ-1) + SUM8
            END IF
         END IF
      END IF

C
C-- DO SEPARATE TEMPERATURE ADJUSTMENTS FOR METOP-A
C   AND NOAA-19
C
      IF (METOP) THEN
C
C-- DO A TEMPERATURE ADJUSTMENT FOR CHANNELS 4, 5, 6, 7, AND 8 OVER 
C   HIGH TERRAIN IN ANTARCTICA.
C
         IF (XLAT.LT.-60.0.AND.TERHGT.GE.2900) THEN
            DELTA8 = +4.5 + (0.0010 * FLOAT(TERHGT-2900))
            DELTA7 = +2.5 - (0.0010 * FLOAT(TERHGT-2900))
            DELTA6 = +2.0 - (0.001000 * FLOAT(TERHGT-2900))
            DELTA5 = +1.5 - (0.000800 * FLOAT(TERHGT-2900))
            DELTA4 = -4.1 - (0.000800 * FLOAT(TERHGT-2900))
            TCLEAR(8) = TCLEAR(8) - DELTA8
            TCLEAR(7) = TCLEAR(7) - DELTA7
            TCLEAR(6) = TCLEAR(6) - DELTA6
            TCLEAR(5) = TCLEAR(5) - DELTA5
            TCLEAR(4) = TCLEAR(4) - DELTA4
         END IF
C
C-- DO A SECONDARY TEMPERATURE ADJUSTMENT FOR CHANNELS 3 THROUGH 8
C   STARTING AT SOMEWHAT LOWER HEIGHT FOR LAND OR SNOW.
C
         IF (XLAT.LT.-60.0.AND.TERHGT.GE.1265) THEN
            DELTA8 = 0.0138752 * FLOAT(TERHGT - 1265)
            DELTA7 = 0.0100291 * FLOAT(TERHGT - 1265)
            DELTA6 = 0.0052186 * FLOAT(TERHGT - 1265)
            DELTA5 = 0.0020852 * FLOAT(TERHGT - 1265)
            DELTA4 = 0.0022669 * FLOAT(TERHGT - 1265)
            DELTA3 = 0.0022653 * FLOAT(TERHGT - 1265)
            TCLEAR(8) = TCLEAR(8) - DELTA8
            TCLEAR(7) = TCLEAR(7) - DELTA7
            TCLEAR(6) = TCLEAR(6) - DELTA6
            TCLEAR(5) = TCLEAR(5) - DELTA5
c           TCLEAR(4) = TCLROBS(4)
c           TCLEAR(3) = TCLROBS(3)
         END IF
C
C-- DO A BIAS CORRECTION FOR CHANNELS 6, 7, AND 8 OVER LAND AND
C   COAST NORTH OF ANTARCTICA.

         IF ((SFCTYP.EQ.1.OR.SFCTYP.EQ.2).AND.XLAT.GE.(-60.0).AND.
     +        TERHGT.LE.2610) THEN
            DELTA8 = (-27.0000 + (0.000482  * (TCLEAR(8)**2)))
            DELTA7 = (-32.4361 + (0.000492  * (TCLEAR(7)**2)))
            DELTA6 = (-37.8723 + (0.000613  * (TCLEAR(6)**2)))
            IF (DELTA8.LT.0.0) DELTA8 = 0.0
            IF (DELTA7.LT.0.0) DELTA7 = 0.0
            IF (DELTA6.LT.0.0) DELTA6 = 0.0
            TCLEAR(8) = TCLEAR(8) - DELTA8
            TCLEAR(7) = TCLEAR(7) - DELTA7
            TCLEAR(6) = TCLEAR(6) - DELTA6
         END IF
C
C-- DO A BIAS CORRECTION FOR CHANNELS 6, 7, AND 8 OVER HIGH
C   TERRAIN NORTH OF THE ANTARCTIC REGION.

         IF (TERHGT.GT.2610.AND.XLAT.GT.(-60.0)) THEN
            DELTA8 = (-16.0000 + (0.000371  * (TCLEAR(8)**2)))
            DELTA7 = (-21.0000 + (0.000380  * (TCLEAR(7)**2)))
            DELTA6 = (-23.0000 + (0.000410  * (TCLEAR(6)**2)))
            IF (DELTA8.LT.0.0) DELTA8 = 0.0
            IF (DELTA7.LT.0.0) DELTA7 = 0.0
            IF (DELTA6.LT.0.0) DELTA6 = 0.0
            TCLEAR(8) = TCLEAR(8) - DELTA8
            TCLEAR(7) = TCLEAR(7) - DELTA7
            TCLEAR(6) = TCLEAR(6) - DELTA6
         END IF
         
C
C-- DO A SECONDARY BIAS CORRECTION FOR PREDICTED CLEAR CHANNELS
C   6, 7, AND 8 OVER LAND AND COAST.
C
         IF ((SFCTYP.EQ.1.OR.SFCTYP.EQ.2).AND.AMSU6.GT.232.0.AND.
     +        TERHGT.LE.2610) THEN
            IF (AMSU4.GT.278.5) THEN
               TCLEAR(6) = TCLEAR(6) - DWARM6(HIRSPT)
               TCLEAR(7) = TCLEAR(7) - DWARM7(HIRSPT)
               TCLEAR(8) = TCLEAR(8) - DWARM8(HIRSPT)
            ELSE
               TCLEAR(6) = TCLEAR(6) - DCOOL6(HIRSPT)
               TCLEAR(7) = TCLEAR(7) - DCOOL7(HIRSPT)
               TCLEAR(8) = TCLEAR(8) - DCOOL8(HIRSPT)
            END IF
         END IF
C
C-- DO A LAND AND COAST CORRECTION FOR PREDICTED CLEAR CHANNELS
C   6, 7, 8 OVER RELATIVELY LOW TERRAIN NORTH OF THE ANTARCTIC CIRCLE.
C
         IF ((SFCTYP.EQ.1.OR.SFCTYP.EQ.2) .AND. TERHGT .LT. 2610) THEN
            IF (XLAT.GT.(-60.0)) THEN
               TCLEAR(8) = TCLEAR(8) - 142.5 + (0.60 * AMSU5) 
               TCLEAR(7) = TCLEAR(7) - 143.2 + (0.57 * AMSU5) 
               TCLEAR(6) = TCLEAR(6) -  74.1 + (0.30 * AMSU5) 
            END IF
         END IF
C
C-- CORRECTION TO PREDICTED CLEAR FOR CHANNELS 6, 7, AND 8 OVER
C   HOT TERRAIN NORTH OF ANTARCTICA
C
         IF (XLAT.GT.(-60.0).AND.SFCTYP.EQ.1) THEN
            DIFF6 = TCLROBS(6) - TCLEAR(6)
            DIFF7 = TCLROBS(7) - TCLEAR(7)
            DIFF8 = TCLROBS(8) - TCLEAR(8)
C
            IF (DIFF6 .GT. DEL6) TCLEAR(6) = TCLEAR(6) + DIFF6
            IF (DIFF7 .GT. DEL7) TCLEAR(7) = TCLEAR(7) + DIFF7
            IF (DIFF8 .GT. DEL8) TCLEAR(8) = TCLEAR(8) + DIFF8
         END IF

      ELSE
C
C-  NOAA-19
C
C-- DO A TEMPERATURE ADJUSTMENT FOR CHANNELS 4, THROUGH AND 8 OVER 
C   HIGH TERRAIN IN ANTARCTICA.
C
         IF (XLAT.LT.-60.0.AND.TERHGT.GE.2900) THEN
            DELTA8 =  4.0 + (0.0010 * FLOAT(TERHGT-2900))
            DELTA7 =  3.5 + (0.0010 * FLOAT(TERHGT-2900))
            DELTA6 =  5.5 + (0.0010 * FLOAT(TERHGT-2900))
            DELTA5 =  2.7 + (0.0008 * FLOAT(TERHGT-2900))
            DELTA4 =  2.0 + (0.0008 * FLOAT(TERHGT-2900))
            TCLEAR(8) = TCLEAR(8) - DELTA8
            TCLEAR(7) = TCLEAR(7) - DELTA7
            TCLEAR(6) = TCLEAR(6) - DELTA6
            TCLEAR(5) = TCLEAR(5) - DELTA5
            TCLEAR(4) = TCLEAR(4) - DELTA4
         END IF
C
C-- DO A SECONDARY TEMPERATURE ADJUSTMENT FOR CHANNELS 3 THROUGH 8
C   STARTING AT SOMEWHAT LOWER HEIGHT FOR LAND OR SNOW.
C
         IF (XLAT.LT.-60.0.AND.TERHGT.GE.1265) THEN
            DELTA8 = 0.0125337 * FLOAT(TERHGT - 1265)
            DELTA7 = 0.0085342 * FLOAT(TERHGT - 1265)
            DELTA6 = 0.0048723 * FLOAT(TERHGT - 1265)
            DELTA5 = 0.0018923 * FLOAT(TERHGT - 1265)
c           DELTA4 = 0.0018252 * FLOAT(TERHGT - 1265)
c           DELTA3 = 0.0008214 * FLOAT(TERHGT - 1265)
            TCLEAR(8) = TCLEAR(8) - DELTA8
            TCLEAR(7) = TCLEAR(7) - DELTA7
            TCLEAR(6) = TCLEAR(6) - DELTA6
            TCLEAR(5) = TCLEAR(5) - DELTA5
c           TCLEAR(4) = TCLEAR(4) - DELTA4
c           TCLEAR(3) = TCLEAR(3) - DELTA3
         END IF
C
C-- DO A BIAS CORRECTION FOR CHANNELS 6, 7, AND 8 OVER LAND AND
C   COAST IN TROPICAL AREAS.

         IF ((SFCTYP.EQ.1.OR.SFCTYP.EQ.2).AND.AMSU6.GT.232.0.AND.
     +        TERHGT.LE.2610) THEN
            DELTA8 = (-27.0000 + (0.000512  * (TCLEAR(8)**2)))
            DELTA7 = (-32.4361 + (0.000492  * (TCLEAR(7)**2)))
            DELTA6 = (-37.8723 + (0.000613  * (TCLEAR(6)**2)))
            IF (DELTA8.LT.0.0) DELTA8 = 0.0
            IF (DELTA7.LT.0.0) DELTA7 = 0.0
            IF (DELTA6.LT.0.0) DELTA6 = 0.0
            TCLEAR(8) = TCLEAR(8) - DELTA8
            TCLEAR(7) = TCLEAR(7) - DELTA7
            TCLEAR(6) = TCLEAR(6) - DELTA6
         END IF
C
C-- DO A BIAS CORRECTION FOR CHANNELS 6, 7, AND 8 OVER HIGH
C   TERRAIN NORTH OF THE ANTARCTIC REGION.

         IF (TERHGT.GT.2270.AND.XLAT.GT.(-60.0)) THEN
            DELTA8 = (-14.0000 + (0.000371  * (TCLEAR(8)**2)))
            DELTA7 = (-20.0000 + (0.000410  * (TCLEAR(7)**2)))
            DELTA6 = (-23.0000 + (0.000500  * (TCLEAR(6)**2)))
            IF (DELTA8.LT.0.0) DELTA8 = 0.0
            IF (DELTA7.LT.0.0) DELTA7 = 0.0
            IF (DELTA6.LT.0.0) DELTA6 = 0.0
            TCLEAR(8) = TCLEAR(8) - DELTA8
            TCLEAR(7) = TCLEAR(7) - DELTA7
            TCLEAR(6) = TCLEAR(6) - DELTA6
         END IF
         
C
C-- DO A SECONDARY BIAS CORRECTION FOR PREDICTED CLEAR CHANNELS
C   6, 7, AND 8 OVER LAND AND COAST.
C
         IF ((SFCTYP.EQ.1.OR.SFCTYP.EQ.2).AND.AMSU6.GT.232.0.AND.
     +        TERHGT.LE.2610) THEN
            IF (AMSU4.GT.278.5) THEN
               TCLEAR(6) = TCLEAR(6) - D9WARM6(HIRSPT)
               TCLEAR(7) = TCLEAR(7) - D9WARM7(HIRSPT)
               TCLEAR(8) = TCLEAR(8) - D9WARM8(HIRSPT)
            ELSE
               TCLEAR(6) = TCLEAR(6) - D9COOL6(HIRSPT)
               TCLEAR(7) = TCLEAR(7) - D9COOL7(HIRSPT)
               TCLEAR(8) = TCLEAR(8) - D9COOL8(HIRSPT)
            END IF
         END IF
C
C-- DO A TERTIARY BIAS CORRECTION FOR PREDICTED CLEAR CHANNELS
C   6, 7, AND 8 OVER LAND AND COAST.
C
         IF ((SFCTYP.EQ.1.OR.SFCTYP.EQ.2).AND.AMSU6.GT.232.0.AND.
     +        TERHGT.LE.2610) THEN
            TCLEAR(6) = TCLEAR(6) - D9BIAS6(HIRSPT)
            TCLEAR(7) = TCLEAR(7) - D9BIAS7(HIRSPT)
            TCLEAR(8) = TCLEAR(8) - D9BIAS8(HIRSPT)
         END IF
C
C-- DO A LAND AND COAST CORRECTION FOR PREDICTED CLEAR CHANNEL 8
C
         IF ((SFCTYP.EQ.1.OR.SFCTYP.EQ.2) .AND. TERHGT .LT. 2610) THEN
            IF (XLAT.GT.(-60.0)) THEN
               TCLEAR(8) = TCLEAR(8) - 142.5 + (0.6 * AMSU5) 
               TCLEAR(7) = TCLEAR(7) - 143.2 + (0.57 * AMSU5) 
               TCLEAR(6) = TCLEAR(6) -  74.1 + (0.30 * AMSU5) 
            END IF
         END IF
C
C-- CORRECTION TO PREDICTED CLEAR FOR CHANNELS 6, 7, AND 8 OVER
C   HOT TERRAIN NORTH OF ANTARCTICA
C
         IF (XLAT.GT.(-60.0).AND.SFCTYP.EQ.1) THEN
            DIFF6 = TCLROBS(6) - TCLEAR(6)
            DIFF7 = TCLROBS(7) - TCLEAR(7)
            DIFF8 = TCLROBS(8) - TCLEAR(8)
C
            IF (DIFF6 .GT. DEL6) TCLEAR(6) = TCLEAR(6) + DIFF6
            IF (DIFF7 .GT. DEL7) TCLEAR(7) = TCLEAR(7) + DIFF7
            IF (DIFF8 .GT. DEL8) TCLEAR(8) = TCLEAR(8) + DIFF8
         END IF
      END IF

      RETURN
      END
