SUBROUTINE PPCLW(KPROMA,KSTART,KPROF,KFLEV,KLEVP,KLOLEV,KLEVB,&
 & PCLWF,&
 & PCLWPP)  

!**** *PPCLW* - POST-PROCESS CLOUD LIQUID WATER

!     PURPOSE.
!     --------
!        PERFORMS THE VERTICAL INTERPOLATION OF CLOUD LIQUID WATER
!     TO A GIVEN LEVEL.

!**   INTERFACE.
!     ----------
!        *CALL* *PPCLW(KPROMA,KSTART,KPROF,KFLEV,KLEVP,KLOLEV,KLEVB,
!                      PCLWF,PCLWPP)

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

!        KPROMA                    - HORIZONTAL DIMENSION.             (INPUT-C)
!        KSTART                    - START OF WORK.                    (INPUT-C)
!        KPROF                     - DEPTH OF WORK.                    (INPUT-C)
!        KFLEV                     - NUMBER OF INPUT PRESSURE LEVELS   (INPUT-C)
!        KLEVP                     - NUMBER OF OUTPUT PRESSURE LEVELS  (INPUT-C)
!        KLOLEV                    - BEGINING FOR THE INTERPOLATION    (INPUT-C)
!        KLEVB(KPROMA,KLEVP,NPPM)  - INPUT LEVEL BELOW PRPRES          (INPUT-C)
!                                    (SEE PPFLEV)
!        PCLWF(KPROMA,0:KFLEV)     - CLOUD LW ON FULL INPUT LEVELS     (INPUT)

!        PCLWPP(KPROMA,KLEVP)      - POST-PROCESSED CLOUD LW          (OUTPUT)

!        IMPLICIT ARGUMENTS :  CONSTANTS FROM YOMCST AND YOMSTA.
!        --------------------

!     METHOD.
!     -------
!        SEE DOCUMENTATION

!     EXTERNALS.  PPINTP - LINEAR INTERPOLATION
!     ----------

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

!     AUTHOR.
!     -------
!        D. VASILJEVIC  *ECMWF*

!     MODIFICATIONS.
!     --------------
!        ORIGINAL : 93-01-12
!        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)    :: KLEVP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTART 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROF 
INTEGER(KIND=JPIM),INTENT(IN)    :: KLOLEV 
INTEGER(KIND=JPIM),INTENT(IN)    :: KLEVB(KPROMA,KLEVP,NPPM) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PCLWF(KPROMA,0:KFLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PCLWPP(KPROMA,KLEVP) 
INTEGER(KIND=JPIM) :: IPNT, JL, JLEVP
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

!*       1.    POST-PROCESS CLOUD LIQUID WATER (CLW)
!              -------------------------------------

!*       1.1   PREPARE FOR EXTRAPOLATION ABOVE TOP

IF (LHOOK) CALL DR_HOOK('PPCLW',0,ZHOOK_HANDLE)
DO JL=KSTART,KPROF
  PCLWF(JL,0)=PCLWF(JL,1)
ENDDO

!*       1.2   INTERPOLATE CLW

!     ISLCT=2
!     CALL PPINTP(KPROMA,KSTART,KPROF,KFLEV,KLEVP,KLOLEV,
!    1            KLEVB,ISLCT,
!    2            LDBELO,LDBLOW,PRPRES,PRXP,PRXPD,
!    3            PCLWF,PCLWPP)
DO JLEVP=KLOLEV,KLEVP
  DO JL   =KSTART,KPROF
    IPNT =MIN(MAX(KLEVB(JL,JLEVP,1),0),KFLEV)
    PCLWPP(JL,JLEVP)   = PCLWF(JL,IPNT)
  ENDDO
ENDDO

!*       1.3   INTERPOLATE BETWEEN LOWEST LEVEL AND SURFACE.

!     DO 133 JLEVP=KLOLEV,KLEVP
!     IF (LDBLOW(JLEVP)) THEN
!        DO 132 JL=KSTART,KPROF
!        IF(LDBELO(JL,JLEVP).AND..NOT.LDBELS(JL,JLEVP) ) THEN
!           PCLWPP(JL,JLEVP)=PCLWF(JL,KFLEV)
!        ENDIF
!132     CONTINUE
!     ENDIF
!133  CONTINUE

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

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

