      SUBROUTINE TGZEX(GZ,T,SPL,LA,PR ,NPL,GAMMA) 
C 
C     * AUG 13/90 - M.LAZARE. - REMOVE HARD-COAT ON "PR", SINCE PASSED. 
C     * FEB 22/78 - J.D.HENDERSON 
C 
C     * T,GZ(LA,NPL) CONTAIN TEMPERATURE AND GEOPOTENTIAL 
C     *              ON NPL PRESSURE LEVELS.
C     * SPL = LN(SURFACE PRESSURE). 
C     * PR  = NPL VALUES OF PRESSURE. 
C     * GAMMA = DT/DZ (DEG/M)  (STD ATM = .0065). 
C     * THIS PROGRAM HYDROSTATICALLY CORRECTS THE TEMPERATURE 
C     * AND THE GEOPOTENTIAL BELOW THE SURFACE. 
C 
C     * LEVEL 2,GZ,T,SPL
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      REAL GZ(LA,1),T(LA,1),SPL(1)
      REAL PR(1)
C-------------------------------------------------------------------- 
      RGAS=287.E0 
      GRAV=9.80616E0
      GOG=GRAV/GAMMA
      POWER=RGAS*GAMMA/GRAV 
C 
      DO 390 I=1,LA 
      SFPR=EXP(SPL(I))
C 
C     * FIND THE FIRST PRESSURE LEVEL BELOW THE SURFACE.
C 
      DO 330 L=1,NPL
      N=L 
      IF(SFPR.LT.PR(L)) GO TO 340 
  330 CONTINUE
      GO TO 390 
C 
C     * CORRECT ALL LEVELS BELOW GROUND.
C 
  340 DO 350 L=N,NPL
      PPEXP=(PR(L)/PR(N-1))**POWER
      T(I,L)=T(I,N-1)*PPEXP 
      GZ(I,L)=GZ(I,N-1)-GOG*T(I,N-1)*(PPEXP-1.E0) 
  350 CONTINUE
C 
  390 CONTINUE
      RETURN
      END 
