SUBROUTINE LAIDLITL(KPROMA,KPROMB,KSTART,KPROF,KFLEV,&
 & KFLDN,KFLDX,&
 & PDLAT,PDLO,PDLAT5,PDLO5,KL0,&
 & PXSL,PXSL5,PXF,PXF5)  

!**** *LAIDLITL - semi-LAgrangian scheme:   (tangent-linear version)
!                 Bilinear horizontal interpolations for one variable.

!     Purpose.
!     --------
!       Performs bilinear horizontal interpolations for one variable.

!**   Interface.
!     ----------
!        *CALL* *LAIDLITL(KPROMA,KPROMB,KSTART,KPROF,KFLEV
!                      ,KFLDN,KFLDX
!                      ,PDLAT,PDLO,PDLAT5,PDLO5,KL0
!                      ,PXSL,PXSL5,PXF,PXF5)

!        Explicit arguments :
!        --------------------

!        INPUT:
!          KPROMA  - horizontal dimension for grid-point quantities.
!          KPROMB  - horizontal dimension for interpolation point
!                    quantities.
!          KSTART  - first element of arrays where
!                    computations are performed.
!          KPROF   - depth of work.
!          KFLEV   - vertical dimension.
!          KFLDN   - number of the first field.
!          KFLDX   - number of the last field.
!          PDLAT   - weight (distance) for horizontal linear interpolation
!                    on a same latitude.
!          PDLO    - weights (distances) for horizontal linear interpolation
!                    on a same longitude.
!          KL0     - indices of the four western points
!                    of the 16 points interpolation grid.
!          PXSL    - quantity to be interpolated.
! ----------------------- trajectory variables ---------------------------
!          PDLAT5  - weight (distance) for horizontal linear interpolation
!                    on a same latitude.
!          PDLO5   - weights (distances) for horizontal linear interpolation
!                    on a same longitude.
!          PXSL5   - quantity to be interpolated.
! ------------------------------------------------------------------------

!        OUTPUT:
!          PXF     - interpolated variable.
!          PXF5    - interpolated variable (TRAJECTORY).

!        Implicit arguments :
!        --------------------

!     Method.
!     -------
!        See documentation

!     Externals.
!     ----------

!        No external.

!     Reference.
!     ----------

!     Author.
!     -------
!        C. Temperton (ECMWF)

!     Modifications.
!     --------------
!        Original : 98/06/12.
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        K. Yessad (Sep 2008): update comments + cleanings.
!     ------------------------------------------------------------------

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

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

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMB 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLEV 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLDN 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLDX 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTART 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROF 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDLAT(KPROMB,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDLO(KPROMB,KFLEV,1:2) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDLAT5(KPROMB,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDLO5(KPROMB,KFLEV,1:2) 
INTEGER(KIND=JPIM),INTENT(IN)    :: KL0(KPROMB,KFLEV,1:2) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PXSL(KPROMA*(KFLDX-KFLDN+1)) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PXSL5(KPROMA*(KFLDX-KFLDN+1)) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PXF(KPROMB,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PXF5(KPROMB,KFLEV) 

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

INTEGER(KIND=JPIM) :: JLEV, JROF

REAL(KIND=JPRB) :: ZDLAT, ZDLAT5, ZDLO1, ZDLO15, ZDLO2, ZDLO25,&
 & ZVALLO1, ZVALLO15, ZVALLO2, ZVALLO25  
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

IF (LHOOK) CALL DR_HOOK('LAIDLITL',0,ZHOOK_HANDLE)

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

!*       1.    INTERPOLATIONS.
!              ---------------

DO JLEV=1,KFLEV
  DO JROF=KSTART,KPROF

!     Computation of coordinates and distances (trajectory).

    ZDLAT5 =PDLAT5(JROF,JLEV)
    ZDLAT  =PDLAT(JROF,JLEV)

    ZDLO15 =PDLO5(JROF,JLEV,1)
    ZDLO1  =PDLO(JROF,JLEV,1)
    ZDLO25 =PDLO5(JROF,JLEV,2)
    ZDLO2  =PDLO(JROF,JLEV,2)

!     Interpolation.

    ZVALLO15=PXSL5(KL0(JROF,JLEV,1)+1) + ZDLO15*&
     & ( PXSL5(KL0(JROF,JLEV,1)+2)-PXSL5(KL0(JROF,JLEV,1)+1) )  
    ZVALLO1=PXSL(KL0(JROF,JLEV,1)+1) + ZDLO15*&
     & ( PXSL(KL0(JROF,JLEV,1)+2)-PXSL(KL0(JROF,JLEV,1)+1) )&
     & +ZDLO1* &
     & ( PXSL5(KL0(JROF,JLEV,1)+2)-PXSL5(KL0(JROF,JLEV,1)+1) )  
    ZVALLO25=PXSL5(KL0(JROF,JLEV,2)+1) + ZDLO25*&
     & ( PXSL5(KL0(JROF,JLEV,2)+2)-PXSL5(KL0(JROF,JLEV,2)+1) )  
    ZVALLO2=PXSL(KL0(JROF,JLEV,2)+1) + ZDLO25*&
     & ( PXSL(KL0(JROF,JLEV,2)+2)-PXSL(KL0(JROF,JLEV,2)+1) )&
     & +ZDLO2* &
     & ( PXSL5(KL0(JROF,JLEV,2)+2)-PXSL5(KL0(JROF,JLEV,2)+1) )  
    PXF5(JROF,JLEV)= ZVALLO15 + ZDLAT5*(ZVALLO25-ZVALLO15)
    PXF(JROF,JLEV)= ZVALLO1 + ZDLAT5*(ZVALLO2-ZVALLO1)&
     & + ZDLAT*(ZVALLO25-ZVALLO15)  

  ENDDO
ENDDO

!     ------------------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('LAIDLITL',1,ZHOOK_HANDLE)
END SUBROUTINE LAIDLITL

