SUBROUTINE PPINITZTL (KPROMA,KSTART,KPROF,KFLEV,&
 & PRGEOPH,PRGEOPF,&
 & PRXP,PRXPD,&
 & PRXP5)  

!**** *PPINITZ* - SET UP HELP-ARRAYS FOR VERTICAL (Z) INTERPOLATION
!                 TANGENT LINEAR VERSION

!     PURPOSE.
!     --------

!        SETS UP HELP-ARRAYS FOR Z LEVEL VERTICAL INTERPOLATION.
!     MUST BE CALLED BEFORE ANY INTEERPOLATION ROUTINES.

!**   INTERFACE.
!     ----------

!     SUBROUTINE PPINITZTL (KPROMA,KSTART,KPROF,KFLEV,
!    I                      PRGEOPH,PRGEOPF,
!    O                      PRXP,PRXPD,
!    R                      PRGEOPH5,PRGEOPF5,PRXP5)

!        EXPLICIT ARGUMENTS :
!        --------------------

!        KPROMA                    - HORIZONTAL DIMENSIONS
!        KSTART                    - START OF WORK
!        KPROF                     - DEPTH OF WORK
!        KFLEV                     - NUMBER OF INPUT PRESSURE LEVELS
!        PRGEOPH(KPROMA,0:KFLEV)   - INPUT HALF LEVEL PRESSURES
!        PRGEOPF(KPROMA,KFLEV)     - INPUT FULL LEVEL PRESSURES

!        PRXP(KPROMA,0:KFLEV,NPPM )- HALF,FULL AND LN HALF,FULL LEVEL
!                                    GEOPOTENTIALAS
!        PRXPD(KPROMA,0:KFLEV,NPPM)- 1./D(Z) AND 1./D(LN(Z))

!        PRXP5(KPROMA,0:KFLEV,NPPM )- HALF,FULL AND LN HALF,FULL LEVEL
!                                    GEOPOTENTIALAS

!        IMPLICIT ARGUMENTS :  NONE.
!        --------------------

!     EXTERNALS.   NONE.
!     ----------

!     REFERENCE.
!     ----------
!        ECMWF Research Department documentation of the IFS

!     AUTHOR.
!     -------
!        D. VASILJEVIC *ECMWF*
!        (TANGENT LINEAR VERSION - MIKE FISHER *ECMWF*)

!     MODIFICATIONS.
!     --------------
!        M.Hamrud      01-Oct-2003 CY28 Cleaning

!     ------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK

USE YOMDIM   , ONLY : NPPM

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLEV 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTART 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROF 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRGEOPH(KPROMA,0:KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRGEOPF(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRXP(KPROMA,0:KFLEV,NPPM) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRXPD(KPROMA,0:KFLEV,NPPM) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRXP5(KPROMA,0:KFLEV,NPPM) 
INTEGER(KIND=JPIM) :: JFLEV, JL, JSLCT

REAL(KIND=JPRB) :: ZTEMP
REAL(KIND=JPRB) :: ZHOOK_HANDLE

!     ------------------------------------------------------------------

!*       1.    COMPUTE HELP VARIABLES RELATED TO INPUT GRID.
!              ---------------------------------------------

!*       1.1   GEOP./LN GEOP.  AT HALF AND FULL LEVELS

IF (LHOOK) CALL DR_HOOK('PPINITZTL',0,ZHOOK_HANDLE)
DO JFLEV=1,KFLEV
  DO JL=KSTART,KPROF
    PRXP(JL,JFLEV,1)=PRGEOPH(JL,JFLEV)
    PRXP(JL,JFLEV,2)=PRGEOPF(JL,JFLEV)
    PRXP(JL,JFLEV,3)=     PRGEOPH(JL,JFLEV)
    PRXP(JL,JFLEV,4)=     PRGEOPF(JL,JFLEV)
  ENDDO
ENDDO

DO JL=KSTART,KPROF
  PRXP(JL,0,1)=PRGEOPH(JL,0)
  PRXP(JL,0,2)=0.0_JPRB
  PRXP(JL,0,3)=PRGEOPH(JL,0)
  PRXP(JL,0,4)=0.0_JPRB
ENDDO

!*       1.2   1/D(Z) AND 1/D(LN(Z))

DO JSLCT=1,NPPM
  DO JFLEV=0,KFLEV-1
    DO JL=KSTART,KPROF
      ZTEMP = 1.0_JPRB/(PRXP5(JL,JFLEV,JSLCT)-PRXP5(JL,JFLEV+1,JSLCT))
      PRXPD(JL,JFLEV,JSLCT)= ZTEMP*ZTEMP*&
       & (PRXP(JL,JFLEV+1,JSLCT)-PRXP(JL,JFLEV,JSLCT))  
    ENDDO
  ENDDO
ENDDO

!     ------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('PPINITZTL',1,ZHOOK_HANDLE)
END SUBROUTINE PPINITZTL

