SUBROUTINE LAIDDITLAD(KPROMA,KPROMB,KSTART,KPROF,KFLEV,&
 & KFLDN,KFLDX,KFLD,KSEP,KMAP,PSIGN,KDEP,LDVECADIN,LDPLANE,&
 & PCLA,PDLO,PCLO,PCLA5,PDLO5,PCLO5,KL0,&
 & KINC,PZINC,KDIM,PXSL,PXSL5,PXF)  

!**** *LAIDDITLAD - semi-LAgrangian scheme:    (adjoint version)
!                 BI-dimensional 12 points interpolations.
!     N.B.: Not to be confused with LAIDDIAD, which is used when the
!     interpolation point is NOT a function of the control variable!

!     Purpose.
!     --------
!       Performs bi-dimensional 12 points interpolations.

!**   Interface.
!     ----------
!        *CALL* *LAIDDITLAD(KPROMA,KPROMB,KSTART,KPROF,KFLEV
!                      ,KFLDN,KFLDX,KFLD,KSEP,KMAP,PSIGN,LDVECADIN
!                      ,PCLA,PDLO,PCLO,PCLA5,PDLO5,PCLO5,KL0,&
!                      ,KINC,PZINC,KDIM,PXSL,PXSL5,PXF)

!        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.
!          KFLD    - field offset in semi-lagrangian buffer.
!          KSEP    - vertical separation for updates.
!          KMAP    - mapping array for bit reproducibility
!          PSIGN   - sign (+ or -) to be applied to point (symmetric/
!                    antisymmetric properties at polar latitudes)
!          KDEP    - indication of the interpolation stencil lat. dep.
!          LDVECADIN - switch for scalar adjoint interpolation.
!          LDPLANE - switch: .T. = plane geometry; .F. = spherical geometry.
! ----------------------- trajectory variables ----------------------------
!          PCLA5   - weights for horizontal cubic interpolation in latitude
!          PDLO5   - distances for horizontal linear interpolations 
!                    in longitude (latitude rows 0, 3)
!          PCLO5   - weights for horizontal cubic interpolations in longitude
!                    (latitude rows 1, 2)
! -------------------------------------------------------------------------
!          KL0     - indices of the four western points
!                    of the 16 points interpolation grid.
!          KDIM    - first dimension of KINC and PZINC
!          PXF     - interpolated variable.
!          PXSL5   - semi-lagrangian variable.   (trajectory)

!        OUTPUT:
!          KINC    - addresses for increments.
!          PZINC   - increments (saved for later).

!        INPUT/OUTPUT:
!          PCLA    - weights for horizontal cubic interpolation in latitude
!          PDLO    - distances for horizontal linear interpolations 
!                    in longitude (latitude rows 0, 3)
!          PCLO    - weights for horizontal cubic interpolations in longitude
!                    (latitude rows 1, 2)
!          PXSL    - semi-lagrangian variable.  

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

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

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

!        No external.
!        Called by LARCINBAD, LARCIN2AD

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

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

!     Modifications.
!     --------------
!      Original : 98/10/16.
!      Modified 99-11-16 by C. Temperton: correct vectorization!      
!      Modified 00-02-04 by C. Temperton: KINC array transposed.
!      Modified 00-02-09 by C. Temperton: KSEP introduced.
!      Modified 00-02-17 by C. Temperton: more optimization....
!      Modified 00-03-01 by C. Temperton: precompute functions (PFUN5).
!      Modified 00-07-11 by G. Mozdzynski: bit reproducibility support
!      Modified 01-02-27 by C. Temperton: LVECADIN option.
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!      Modified 05-02-18 by C. Temperton: Removed redundant computation
!                         and output of interpolated trajectory variable.
!        F. Vana 15-Jul-2008: - Weights driven high order interpolation
!                             - unification with ELAIDDITLAD 
!     ------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMSLREP, ONLY : LSLADREP
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)    :: KSTART 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROF 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLEV 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLDN 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLDX 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLD 
INTEGER(KIND=JPIM),INTENT(IN)    :: KDIM 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSEP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KMAP(KPROMB,12,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSIGN(KPROMB,12,KFLEV) 
INTEGER(KIND=JPIM),INTENT(IN)    :: KDEP(KPROMB,KFLEV)
LOGICAL           ,INTENT(IN)    :: LDVECADIN 
LOGICAL           ,INTENT(IN)    :: LDPLANE
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PCLA(KPROMB,KFLEV,3) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDLO(KPROMB,KFLEV,0:3) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PCLO(KPROMB,KFLEV,3,2) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCLA5(KPROMB,KFLEV,3) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDLO5(KPROMB,KFLEV,0:3) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCLO5(KPROMB,KFLEV,3,2)
INTEGER(KIND=JPIM),INTENT(IN)    :: KL0(KPROMB,KFLEV,0:3) 
INTEGER(KIND=JPIM),INTENT(OUT)   :: KINC(KDIM*KFLEV+1,KPROMB) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PZINC(KDIM*KFLEV+1,KPROMB) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PXSL(KPROMA*(KFLDX-KFLDN+1)) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PXSL5(KPROMA*(KFLDX-KFLDN+1)) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PXF(KPROMB,KFLEV) 

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

INTEGER(KIND=JPIM) :: IB, ILEV, JJLEV, JLEV, JROF, IBASE

REAL(KIND=JPRB) :: ZCLA15, ZCLA25, ZCLA35, ZF115, ZF125, ZF215, ZF225,&
 &  Z0, Z1, Z2, Z3, Z05, Z15, Z25, Z35

REAL(KIND=JPRB) :: ZSUM(KPROMB,12,KFLEV)
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

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

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

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

IBASE=(KFLD-1)*KPROMA
ILEV=1

IF( LSLADREP )THEN

  IF (.NOT.LDVECADIN) THEN

    DO JLEV=1,KFLEV

      DO JROF=KSTART,KPROF

        ! Computation of coordinates and distances (trajectory).

        ZCLA15=PCLA5(JROF,JLEV,1)
        ZCLA25=PCLA5(JROF,JLEV,2)
        ZCLA35=PCLA5(JROF,JLEV,3)

        ZF115=PXSL5(KL0(JROF,JLEV,1)+1)
        ZF215=PXSL5(KL0(JROF,JLEV,1)+2)
        ZF125=PXSL5(KL0(JROF,JLEV,2)+1)
        ZF225=PXSL5(KL0(JROF,JLEV,2)+2)

        ! longitudial interpolation (trajectory)
        Z05=PXSL5(KL0(JROF,JLEV,0)+1)+PDLO5(JROF,JLEV,0) &
         & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1))
        Z15=PXSL5(KL0(JROF,JLEV,1)) &
         & +PCLO5(JROF,JLEV,1,1)*(ZF115-PXSL5(KL0(JROF,JLEV,1))) &
         & +PCLO5(JROF,JLEV,2,1)*(ZF215-PXSL5(KL0(JROF,JLEV,1))) &
         & +PCLO5(JROF,JLEV,3,1)*(PXSL5(KL0(JROF,JLEV,1)+3) &
         &                       -PXSL5(KL0(JROF,JLEV,1)))
        Z25=PXSL5(KL0(JROF,JLEV,2)) &  
         & +PCLO5(JROF,JLEV,1,2)*(ZF125-PXSL5(KL0(JROF,JLEV,2))) &
         & +PCLO5(JROF,JLEV,2,2)*(ZF225-PXSL5(KL0(JROF,JLEV,2))) &
         & +PCLO5(JROF,JLEV,3,2)*(PXSL5(KL0(JROF,JLEV,2)+3) &
         &                       -PXSL5(KL0(JROF,JLEV,2)))
        Z35=PXSL5(KL0(JROF,JLEV,3)+1)+PDLO5(JROF,JLEV,3) &
         & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1))

        ! Interpolation (adjoint).
        ! final interpolation in latitude
        Z0=(1._JPRB-ZCLA15-ZCLA25-ZCLA35)*PXF(JROF,JLEV)
        Z1=ZCLA15*PXF(JROF,JLEV)
        Z2=ZCLA25*PXF(JROF,JLEV)
        Z3=ZCLA35*PXF(JROF,JLEV)
        PCLA(JROF,JLEV,1)=PCLA(JROF,JLEV,1)+(Z15-Z05)*PXF(JROF,JLEV)
        PCLA(JROF,JLEV,2)=PCLA(JROF,JLEV,2)+(Z25-Z05)*PXF(JROF,JLEV)
        PCLA(JROF,JLEV,3)=PCLA(JROF,JLEV,3)+(Z35-Z05)*PXF(JROF,JLEV)

        ! longitudial interpolation.
        ZSUM(JROF,1,JLEV) =PSIGN(JROF,1,JLEV)*(1.0_JPRB-PDLO5(JROF,JLEV,0))*Z0
        ZSUM(JROF,2,JLEV) =PSIGN(JROF,2,JLEV)*PDLO5(JROF,JLEV,0)*Z0
        PDLO(JROF,JLEV,0) =PDLO(JROF,JLEV,0)+ Z0 &
         & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1)) 

        ZSUM(JROF,3,JLEV) =PSIGN(JROF,3,JLEV) &
         & * (1.0_JPRB-PCLO5(JROF,JLEV,1,1)-PCLO5(JROF,JLEV,2,1) &
         &            -PCLO5(JROF,JLEV,3,1)) * Z1
        ZSUM(JROF,4,JLEV) =PSIGN(JROF,4,JLEV)*PCLO5(JROF,JLEV,1,1)*Z1 
        ZSUM(JROF,5,JLEV) =PSIGN(JROF,5,JLEV)*PCLO5(JROF,JLEV,2,1)*Z1 
        ZSUM(JROF,6,JLEV) =PSIGN(JROF,6,JLEV)*PCLO5(JROF,JLEV,3,1)*Z1 
        PCLO(JROF,JLEV,1,1)=PCLO(JROF,JLEV,1,1) &
         & + (ZF115-PXSL5(KL0(JROF,JLEV,1)))*Z1
        PCLO(JROF,JLEV,2,1)=PCLO(JROF,JLEV,2,1) &
         & + (ZF215-PXSL5(KL0(JROF,JLEV,1)))*Z1
        PCLO(JROF,JLEV,3,1)=PCLO(JROF,JLEV,3,1) &
         & + (PXSL5(KL0(JROF,JLEV,1)+3)-PXSL5(KL0(JROF,JLEV,1)))*Z1

        ZSUM(JROF,7,JLEV) =PSIGN(JROF,7,JLEV) &
         & * (1.0_JPRB-PCLO5(JROF,JLEV,1,2)-PCLO5(JROF,JLEV,2,2) &
         &            -PCLO5(JROF,JLEV,3,2)) * Z2
        ZSUM(JROF,8,JLEV) =PSIGN(JROF,8,JLEV)*PCLO5(JROF,JLEV,1,2)*Z2 
        ZSUM(JROF,9,JLEV) =PSIGN(JROF,9,JLEV)*PCLO5(JROF,JLEV,2,2)*Z2 
        ZSUM(JROF,10,JLEV)=PSIGN(JROF,10,JLEV)*PCLO5(JROF,JLEV,3,2)*Z2 
        PCLO(JROF,JLEV,1,2)=PCLO(JROF,JLEV,1,2) &
         & + (ZF125-PXSL5(KL0(JROF,JLEV,2)))*Z2
        PCLO(JROF,JLEV,2,2)=PCLO(JROF,JLEV,2,2) &
         & + (ZF225-PXSL5(KL0(JROF,JLEV,2)))*Z2
        PCLO(JROF,JLEV,3,2)=PCLO(JROF,JLEV,3,2) &
         & + (PXSL5(KL0(JROF,JLEV,2)+3)-PXSL5(KL0(JROF,JLEV,2)))*Z2

        ZSUM(JROF,11,JLEV)=PSIGN(JROF,11,JLEV)*(1.0_JPRB-PDLO5(JROF,JLEV,3))*Z3
        ZSUM(JROF,12,JLEV)=PSIGN(JROF,12,JLEV)*PDLO5(JROF,JLEV,3)*Z3
        PDLO(JROF,JLEV,3) =PDLO(JROF,JLEV,3)+ Z3 &
         & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1)) 

      ENDDO
    ENDDO

    DO JROF=KSTART,KPROF
      DO JLEV=1,KFLEV
        PXSL(KMAP(JROF,1,JLEV))=PXSL(KMAP(JROF,1,JLEV))+ZSUM(JROF,1,JLEV)
        PXSL(KMAP(JROF,2,JLEV))=PXSL(KMAP(JROF,2,JLEV))+ZSUM(JROF,2,JLEV)
        PXSL(KMAP(JROF,3,JLEV))=PXSL(KMAP(JROF,3,JLEV))+ZSUM(JROF,3,JLEV)
        PXSL(KMAP(JROF,4,JLEV))=PXSL(KMAP(JROF,4,JLEV))+ZSUM(JROF,4,JLEV)
        PXSL(KMAP(JROF,5,JLEV))=PXSL(KMAP(JROF,5,JLEV))+ZSUM(JROF,5,JLEV)
        PXSL(KMAP(JROF,6,JLEV))=PXSL(KMAP(JROF,6,JLEV))+ZSUM(JROF,6,JLEV)
        PXSL(KMAP(JROF,7,JLEV))=PXSL(KMAP(JROF,7,JLEV))+ZSUM(JROF,7,JLEV)
        PXSL(KMAP(JROF,8,JLEV))=PXSL(KMAP(JROF,8,JLEV))+ZSUM(JROF,8,JLEV)
        PXSL(KMAP(JROF,9,JLEV))=PXSL(KMAP(JROF,9,JLEV))+ZSUM(JROF,9,JLEV)
        PXSL(KMAP(JROF,10,JLEV))=PXSL(KMAP(JROF,10,JLEV))+ZSUM(JROF,10,JLEV)
        PXSL(KMAP(JROF,11,JLEV))=PXSL(KMAP(JROF,11,JLEV))+ZSUM(JROF,11,JLEV)
        PXSL(KMAP(JROF,12,JLEV))=PXSL(KMAP(JROF,12,JLEV))+ZSUM(JROF,12,JLEV)
      ENDDO
    ENDDO

  ELSE

    IF (LDPLANE) THEN

      DO JJLEV=1,KSEP 
        DO JLEV=JJLEV,KFLEV,KSEP

          IB=(ILEV-1)*KDIM

!CDIR NODEP
          DO JROF=KSTART,KPROF

            ! Computation of coordinates and distances (trajectory).

            ZCLA15=PCLA5(JROF,JLEV,1)
            ZCLA25=PCLA5(JROF,JLEV,2)
            ZCLA35=PCLA5(JROF,JLEV,3)

            ZF115=PXSL5(KL0(JROF,JLEV,1)+1)
            ZF215=PXSL5(KL0(JROF,JLEV,1)+2)
            ZF125=PXSL5(KL0(JROF,JLEV,2)+1)
            ZF225=PXSL5(KL0(JROF,JLEV,2)+2)

            ! longitudial interpolation (trajectory)
            Z05=PXSL5(KL0(JROF,JLEV,0)+1)+PDLO5(JROF,JLEV,0) &
             & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1))
            Z15=PXSL5(KL0(JROF,JLEV,1)) &
             & +PCLO5(JROF,JLEV,1,1)*(ZF115-PXSL5(KL0(JROF,JLEV,1))) &
             & +PCLO5(JROF,JLEV,2,1)*(ZF215-PXSL5(KL0(JROF,JLEV,1))) &
             & +PCLO5(JROF,JLEV,3,1)*(PXSL5(KL0(JROF,JLEV,1)+3) &
             &                       -PXSL5(KL0(JROF,JLEV,1)))
            Z25=PXSL5(KL0(JROF,JLEV,2)) &  
             & +PCLO5(JROF,JLEV,1,2)*(ZF125-PXSL5(KL0(JROF,JLEV,2))) &
             & +PCLO5(JROF,JLEV,2,2)*(ZF225-PXSL5(KL0(JROF,JLEV,2))) &
             & +PCLO5(JROF,JLEV,3,2)*(PXSL5(KL0(JROF,JLEV,2)+3) &
             &                       -PXSL5(KL0(JROF,JLEV,2)))
            Z35=PXSL5(KL0(JROF,JLEV,3)+1)+PDLO5(JROF,JLEV,3) &
             & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1))

            ! Interpolation (adjoint).

            KINC(IB+1,JROF)=IBASE+KMAP(JROF,1,JLEV)
            KINC(IB+2,JROF)=IBASE+KMAP(JROF,2,JLEV)
            KINC(IB+3,JROF)=IBASE+KMAP(JROF,3,JLEV)
            KINC(IB+4,JROF)=IBASE+KMAP(JROF,4,JLEV)
            KINC(IB+5,JROF)=IBASE+KMAP(JROF,5,JLEV)
            KINC(IB+6,JROF)=IBASE+KMAP(JROF,6,JLEV)
            KINC(IB+7,JROF)=IBASE+KMAP(JROF,7,JLEV)
            KINC(IB+8,JROF)=IBASE+KMAP(JROF,8,JLEV)
            KINC(IB+9,JROF)=IBASE+KMAP(JROF,9,JLEV)
            KINC(IB+10,JROF)=IBASE+KMAP(JROF,10,JLEV)
            KINC(IB+11,JROF)=IBASE+KMAP(JROF,11,JLEV)
            KINC(IB+12,JROF)=IBASE+KMAP(JROF,12,JLEV)

            ! final interpolation in latitude
            Z0=(1._JPRB-ZCLA15-ZCLA25-ZCLA35)*PXF(JROF,JLEV)
            Z1=ZCLA15*PXF(JROF,JLEV)
            Z2=ZCLA25*PXF(JROF,JLEV)
            Z3=ZCLA35*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,1)=PCLA(JROF,JLEV,1)+(Z15-Z05)*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,2)=PCLA(JROF,JLEV,2)+(Z25-Z05)*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,3)=PCLA(JROF,JLEV,3)+(Z35-Z05)*PXF(JROF,JLEV)

            ! longitudial interpolation.
            PZINC(IB+1,JROF) =PSIGN(JROF,1,JLEV)*(1.0_JPRB-PDLO5(JROF,JLEV,0))*Z0
            PZINC(IB+2,JROF) =PSIGN(JROF,2,JLEV)*PDLO5(JROF,JLEV,0)*Z0
            PDLO(JROF,JLEV,0) =PDLO(JROF,JLEV,0)+ Z0 &
             & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1)) 

            PZINC(IB+3,JROF) =PSIGN(JROF,3,JLEV) &
             & * (1.0_JPRB-PCLO5(JROF,JLEV,1,1)-PCLO5(JROF,JLEV,2,1) &
             &            -PCLO5(JROF,JLEV,3,1)) * Z1
            PZINC(IB+4,JROF) =PSIGN(JROF,4,JLEV)*PCLO5(JROF,JLEV,1,1)*Z1 
            PZINC(IB+5,JROF) =PSIGN(JROF,5,JLEV)*PCLO5(JROF,JLEV,2,1)*Z1 
            PZINC(IB+6,JROF) =PSIGN(JROF,6,JLEV)*PCLO5(JROF,JLEV,3,1)*Z1 
            PCLO(JROF,JLEV,1,1)=PCLO(JROF,JLEV,1,1) &
             & + (ZF115-PXSL5(KL0(JROF,JLEV,1)))*Z1
            PCLO(JROF,JLEV,2,1)=PCLO(JROF,JLEV,2,1) &
             & + (ZF215-PXSL5(KL0(JROF,JLEV,1)))*Z1
            PCLO(JROF,JLEV,3,1)=PCLO(JROF,JLEV,3,1) &
             & + (PXSL5(KL0(JROF,JLEV,1)+3)-PXSL5(KL0(JROF,JLEV,1)))*Z1

            PZINC(IB+7,JROF) =PSIGN(JROF,7,JLEV) &
             & * (1.0_JPRB-PCLO5(JROF,JLEV,1,2)-PCLO5(JROF,JLEV,2,2) &
             &            -PCLO5(JROF,JLEV,3,2)) * Z2
            PZINC(IB+8,JROF) =PSIGN(JROF,8,JLEV)*PCLO5(JROF,JLEV,1,2)*Z2 
            PZINC(IB+9,JROF) =PSIGN(JROF,9,JLEV)*PCLO5(JROF,JLEV,2,2)*Z2 
            PZINC(IB+10,JROF)=PSIGN(JROF,10,JLEV)*PCLO5(JROF,JLEV,3,2)*Z2 
            PCLO(JROF,JLEV,1,2)=PCLO(JROF,JLEV,1,2) &
             & + (ZF125-PXSL5(KL0(JROF,JLEV,2)))*Z2
            PCLO(JROF,JLEV,2,2)=PCLO(JROF,JLEV,2,2) &
             & + (ZF225-PXSL5(KL0(JROF,JLEV,2)))*Z2
            PCLO(JROF,JLEV,3,2)=PCLO(JROF,JLEV,3,2) &
             & + (PXSL5(KL0(JROF,JLEV,2)+3)-PXSL5(KL0(JROF,JLEV,2)))*Z2

            PZINC(IB+11,JROF)=PSIGN(JROF,11,JLEV)*(1.0_JPRB-PDLO5(JROF,JLEV,3))*Z3
            PZINC(IB+12,JROF)=PSIGN(JROF,12,JLEV)*PDLO5(JROF,JLEV,3)*Z3
            PDLO(JROF,JLEV,3) =PDLO(JROF,JLEV,3)+ Z3 &
             & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1)) 

            IF (KDEP(JROF,JLEV) == 1) THEN
              KINC(IB+1,JROF)=KINC(IB+11,JROF)-1
              KINC(IB+2,JROF)=KINC(IB+12,JROF)+1
              PZINC(IB+4,JROF)=PZINC(IB+4,JROF)+PZINC(IB+1,JROF)
              PZINC(IB+5,JROF)=PZINC(IB+5,JROF)+PZINC(IB+2,JROF)
              PZINC(IB+1,JROF)=0.0_JPRB
              PZINC(IB+2,JROF)=0.0_JPRB
            ELSEIF (KDEP(JROF,JLEV) == 4) then
              KINC(IB+11,JROF)=KINC(IB+1,JROF)-1
              KINC(IB+12,JROF)=KINC(IB+2,JROF)+1
              PZINC(IB+8,JROF)=PZINC(IB+8,JROF)+PZINC(IB+11,JROF)
              PZINC(IB+9,JROF)=PZINC(IB+9,JROF)+PZINC(IB+12,JROF)
              PZINC(IB+11,JROF)=0.0_JPRB
              PZINC(IB+12,JROF)=0.0_JPRB
            ENDIF

          ENDDO
          ILEV=ILEV+1
        ENDDO
      ENDDO

    ELSE ! spherical geometry

      DO JJLEV=1,KSEP 
        DO JLEV=JJLEV,KFLEV,KSEP

          IB=(ILEV-1)*KDIM

!CDIR NODEP
          DO JROF=KSTART,KPROF

            ! Computation of coordinates and distances (trajectory).

            ZCLA15=PCLA5(JROF,JLEV,1)
            ZCLA25=PCLA5(JROF,JLEV,2)
            ZCLA35=PCLA5(JROF,JLEV,3)

            ZF115=PXSL5(KL0(JROF,JLEV,1)+1)
            ZF215=PXSL5(KL0(JROF,JLEV,1)+2)
            ZF125=PXSL5(KL0(JROF,JLEV,2)+1)
            ZF225=PXSL5(KL0(JROF,JLEV,2)+2)

            ! longitudial interpolation (trajectory)
            Z05=PXSL5(KL0(JROF,JLEV,0)+1)+PDLO5(JROF,JLEV,0) &
             & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1))
            Z15=PXSL5(KL0(JROF,JLEV,1)) &
             & +PCLO5(JROF,JLEV,1,1)*(ZF115-PXSL5(KL0(JROF,JLEV,1))) &
             & +PCLO5(JROF,JLEV,2,1)*(ZF215-PXSL5(KL0(JROF,JLEV,1))) &
             & +PCLO5(JROF,JLEV,3,1)*(PXSL5(KL0(JROF,JLEV,1)+3) &
             &                       -PXSL5(KL0(JROF,JLEV,1)))
            Z25=PXSL5(KL0(JROF,JLEV,2)) &  
             & +PCLO5(JROF,JLEV,1,2)*(ZF125-PXSL5(KL0(JROF,JLEV,2))) &
             & +PCLO5(JROF,JLEV,2,2)*(ZF225-PXSL5(KL0(JROF,JLEV,2))) &
             & +PCLO5(JROF,JLEV,3,2)*(PXSL5(KL0(JROF,JLEV,2)+3) &
             &                       -PXSL5(KL0(JROF,JLEV,2)))
            Z35=PXSL5(KL0(JROF,JLEV,3)+1)+PDLO5(JROF,JLEV,3) &
             & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1))

            ! Interpolation (adjoint).

            KINC(IB+1,JROF)=IBASE+KMAP(JROF,1,JLEV)
            KINC(IB+2,JROF)=IBASE+KMAP(JROF,2,JLEV)
            KINC(IB+3,JROF)=IBASE+KMAP(JROF,3,JLEV)
            KINC(IB+4,JROF)=IBASE+KMAP(JROF,4,JLEV)
            KINC(IB+5,JROF)=IBASE+KMAP(JROF,5,JLEV)
            KINC(IB+6,JROF)=IBASE+KMAP(JROF,6,JLEV)
            KINC(IB+7,JROF)=IBASE+KMAP(JROF,7,JLEV)
            KINC(IB+8,JROF)=IBASE+KMAP(JROF,8,JLEV)
            KINC(IB+9,JROF)=IBASE+KMAP(JROF,9,JLEV)
            KINC(IB+10,JROF)=IBASE+KMAP(JROF,10,JLEV)
            KINC(IB+11,JROF)=IBASE+KMAP(JROF,11,JLEV)
            KINC(IB+12,JROF)=IBASE+KMAP(JROF,12,JLEV)

            ! final interpolation in latitude
            Z0=(1._JPRB-ZCLA15-ZCLA25-ZCLA35)*PXF(JROF,JLEV)
            Z1=ZCLA15*PXF(JROF,JLEV)
            Z2=ZCLA25*PXF(JROF,JLEV)
            Z3=ZCLA35*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,1)=PCLA(JROF,JLEV,1)+(Z15-Z05)*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,2)=PCLA(JROF,JLEV,2)+(Z25-Z05)*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,3)=PCLA(JROF,JLEV,3)+(Z35-Z05)*PXF(JROF,JLEV)

            ! longitudial interpolation.
            PZINC(IB+1,JROF) =PSIGN(JROF,1,JLEV)*(1.0_JPRB-PDLO5(JROF,JLEV,0))*Z0
            PZINC(IB+2,JROF) =PSIGN(JROF,2,JLEV)*PDLO5(JROF,JLEV,0)*Z0
            PDLO(JROF,JLEV,0) =PDLO(JROF,JLEV,0)+ Z0 &
             & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1)) 

            PZINC(IB+3,JROF) =PSIGN(JROF,3,JLEV) &
             & * (1.0_JPRB-PCLO5(JROF,JLEV,1,1)-PCLO5(JROF,JLEV,2,1) &
             &            -PCLO5(JROF,JLEV,3,1)) * Z1
            PZINC(IB+4,JROF) =PSIGN(JROF,4,JLEV)*PCLO5(JROF,JLEV,1,1)*Z1 
            PZINC(IB+5,JROF) =PSIGN(JROF,5,JLEV)*PCLO5(JROF,JLEV,2,1)*Z1 
            PZINC(IB+6,JROF) =PSIGN(JROF,6,JLEV)*PCLO5(JROF,JLEV,3,1)*Z1 
            PCLO(JROF,JLEV,1,1)=PCLO(JROF,JLEV,1,1) &
             & + (ZF115-PXSL5(KL0(JROF,JLEV,1)))*Z1
            PCLO(JROF,JLEV,2,1)=PCLO(JROF,JLEV,2,1) &
             & + (ZF215-PXSL5(KL0(JROF,JLEV,1)))*Z1
            PCLO(JROF,JLEV,3,1)=PCLO(JROF,JLEV,3,1) &
             & + (PXSL5(KL0(JROF,JLEV,1)+3)-PXSL5(KL0(JROF,JLEV,1)))*Z1

            PZINC(IB+7,JROF) =PSIGN(JROF,7,JLEV) &
             & * (1.0_JPRB-PCLO5(JROF,JLEV,1,2)-PCLO5(JROF,JLEV,2,2) &
             &            -PCLO5(JROF,JLEV,3,2)) * Z2
            PZINC(IB+8,JROF) =PSIGN(JROF,8,JLEV)*PCLO5(JROF,JLEV,1,2)*Z2 
            PZINC(IB+9,JROF) =PSIGN(JROF,9,JLEV)*PCLO5(JROF,JLEV,2,2)*Z2 
            PZINC(IB+10,JROF)=PSIGN(JROF,10,JLEV)*PCLO5(JROF,JLEV,3,2)*Z2 
            PCLO(JROF,JLEV,1,2)=PCLO(JROF,JLEV,1,2) &
             & + (ZF125-PXSL5(KL0(JROF,JLEV,2)))*Z2
            PCLO(JROF,JLEV,2,2)=PCLO(JROF,JLEV,2,2) &
             & + (ZF225-PXSL5(KL0(JROF,JLEV,2)))*Z2
            PCLO(JROF,JLEV,3,2)=PCLO(JROF,JLEV,3,2) &
             & + (PXSL5(KL0(JROF,JLEV,2)+3)-PXSL5(KL0(JROF,JLEV,2)))*Z2

            PZINC(IB+11,JROF)=PSIGN(JROF,11,JLEV)*(1.0_JPRB-PDLO5(JROF,JLEV,3))*Z3
            PZINC(IB+12,JROF)=PSIGN(JROF,12,JLEV)*PDLO5(JROF,JLEV,3)*Z3
            PDLO(JROF,JLEV,3) =PDLO(JROF,JLEV,3)+ Z3 &
             & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1)) 

          ENDDO
          ILEV=ILEV+1
        ENDDO
      ENDDO

    ENDIF
  ENDIF

ELSE         !(non-reproducible)

  IF (.NOT.LDVECADIN) THEN

    DO JLEV=1,KFLEV

      DO JROF=KSTART,KPROF

        ! Computation of coordinates and distances (trajectory).

        ZCLA15=PCLA5(JROF,JLEV,1)
        ZCLA25=PCLA5(JROF,JLEV,2)
        ZCLA35=PCLA5(JROF,JLEV,3)

        ZF115=PXSL5(KL0(JROF,JLEV,1)+1)
        ZF215=PXSL5(KL0(JROF,JLEV,1)+2)
        ZF125=PXSL5(KL0(JROF,JLEV,2)+1)
        ZF225=PXSL5(KL0(JROF,JLEV,2)+2)

        ! longitudial interpolation (trajectory)
        Z05=PXSL5(KL0(JROF,JLEV,0)+1)+PDLO5(JROF,JLEV,0) &
         & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1))
        Z15=PXSL5(KL0(JROF,JLEV,1)) &
         & +PCLO5(JROF,JLEV,1,1)*(ZF115-PXSL5(KL0(JROF,JLEV,1))) &
         & +PCLO5(JROF,JLEV,2,1)*(ZF215-PXSL5(KL0(JROF,JLEV,1))) &
         & +PCLO5(JROF,JLEV,3,1)*(PXSL5(KL0(JROF,JLEV,1)+3) &
         &                       -PXSL5(KL0(JROF,JLEV,1)))
        Z25=PXSL5(KL0(JROF,JLEV,2)) &  
         & +PCLO5(JROF,JLEV,1,2)*(ZF125-PXSL5(KL0(JROF,JLEV,2))) &
         & +PCLO5(JROF,JLEV,2,2)*(ZF225-PXSL5(KL0(JROF,JLEV,2))) &
         & +PCLO5(JROF,JLEV,3,2)*(PXSL5(KL0(JROF,JLEV,2)+3) &
         &                       -PXSL5(KL0(JROF,JLEV,2)))
        Z35=PXSL5(KL0(JROF,JLEV,3)+1)+PDLO5(JROF,JLEV,3) &
         & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1))

        ! Interpolation (adjoint).
        ! final interpolation in latitude
        Z0=(1._JPRB-ZCLA15-ZCLA25-ZCLA35)*PXF(JROF,JLEV)
        Z1=ZCLA15*PXF(JROF,JLEV)
        Z2=ZCLA25*PXF(JROF,JLEV)
        Z3=ZCLA35*PXF(JROF,JLEV)
        PCLA(JROF,JLEV,1)=PCLA(JROF,JLEV,1)+(Z15-Z05)*PXF(JROF,JLEV)
        PCLA(JROF,JLEV,2)=PCLA(JROF,JLEV,2)+(Z25-Z05)*PXF(JROF,JLEV)
        PCLA(JROF,JLEV,3)=PCLA(JROF,JLEV,3)+(Z35-Z05)*PXF(JROF,JLEV)

        ! longitudial interpolation.
        PXSL(KL0(JROF,JLEV,0)+1)=PXSL(KL0(JROF,JLEV,0)+1) & 
         & +(1.0_JPRB-PDLO5(JROF,JLEV,0))*Z0
        PXSL(KL0(JROF,JLEV,0)+2)=PXSL(KL0(JROF,JLEV,0)+2) &
         & +PDLO5(JROF,JLEV,0)*Z0
        PDLO(JROF,JLEV,0) =PDLO(JROF,JLEV,0)+ Z0 &
         & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1)) 

        PXSL(KL0(JROF,JLEV,1))=PXSL(KL0(JROF,JLEV,1)) &
         & + (1.0_JPRB-PCLO5(JROF,JLEV,1,1)-PCLO5(JROF,JLEV,2,1) &
         &            -PCLO5(JROF,JLEV,3,1)) * Z1
        PXSL(KL0(JROF,JLEV,1)+1)=PXSL(KL0(JROF,JLEV,1)+1) &
         & + PCLO5(JROF,JLEV,1,1)*Z1 
        PXSL(KL0(JROF,JLEV,1)+2)=PXSL(KL0(JROF,JLEV,1)+2) &
         & + PCLO5(JROF,JLEV,2,1)*Z1 
        PXSL(KL0(JROF,JLEV,1)+3)=PXSL(KL0(JROF,JLEV,1)+3) &
         & + PCLO5(JROF,JLEV,3,1)*Z1 
        PCLO(JROF,JLEV,1,1)=PCLO(JROF,JLEV,1,1) &
         & + (ZF115-PXSL5(KL0(JROF,JLEV,1)))*Z1
        PCLO(JROF,JLEV,2,1)=PCLO(JROF,JLEV,2,1) &
         & + (ZF215-PXSL5(KL0(JROF,JLEV,1)))*Z1
        PCLO(JROF,JLEV,3,1)=PCLO(JROF,JLEV,3,1) &
         & + (PXSL5(KL0(JROF,JLEV,1)+3)-PXSL5(KL0(JROF,JLEV,1)))*Z1

        PXSL(KL0(JROF,JLEV,2))=PXSL(KL0(JROF,JLEV,2)) &
         & + (1.0_JPRB-PCLO5(JROF,JLEV,1,2)-PCLO5(JROF,JLEV,2,2) &
         &            -PCLO5(JROF,JLEV,3,2)) * Z2
        PXSL(KL0(JROF,JLEV,2)+1)=PXSL(KL0(JROF,JLEV,2)+1) &
         & + PCLO5(JROF,JLEV,1,2)*Z2 
        PXSL(KL0(JROF,JLEV,2)+2)=PXSL(KL0(JROF,JLEV,2)+2) &
         & + PCLO5(JROF,JLEV,2,2)*Z2 
        PXSL(KL0(JROF,JLEV,2)+3)=PXSL(KL0(JROF,JLEV,2)+3) &
         & + PCLO5(JROF,JLEV,3,2)*Z2 
        PCLO(JROF,JLEV,1,2)=PCLO(JROF,JLEV,1,2) &
         & + (ZF125-PXSL5(KL0(JROF,JLEV,2)))*Z2
        PCLO(JROF,JLEV,2,2)=PCLO(JROF,JLEV,2,2) &
         & + (ZF225-PXSL5(KL0(JROF,JLEV,2)))*Z2
        PCLO(JROF,JLEV,3,2)=PCLO(JROF,JLEV,3,2) &
         & + (PXSL5(KL0(JROF,JLEV,2)+3)-PXSL5(KL0(JROF,JLEV,2)))*Z2

        PXSL(KL0(JROF,JLEV,3)+1)=PXSL(KL0(JROF,JLEV,3)+1) &
         & + (1.0_JPRB-PDLO5(JROF,JLEV,3))*Z3
        PXSL(KL0(JROF,JLEV,3)+2)=PXSL(KL0(JROF,JLEV,3)+2) &
         & + PDLO5(JROF,JLEV,3)*Z3
        PDLO(JROF,JLEV,3) =PDLO(JROF,JLEV,3)+ Z3 &
         & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1)) 

      ENDDO
    ENDDO

  ELSE

    IF (LDPLANE) THEN

      DO JJLEV=1,KSEP 
        DO JLEV=JJLEV,KFLEV,KSEP

          IB=(ILEV-1)*KDIM

  !CDIR NODEP
          DO JROF=KSTART,KPROF

            ! Computation of coordinates and distances (trajectory).

            ZCLA15=PCLA5(JROF,JLEV,1)
            ZCLA25=PCLA5(JROF,JLEV,2)
            ZCLA35=PCLA5(JROF,JLEV,3)

            ZF115=PXSL5(KL0(JROF,JLEV,1)+1)
            ZF215=PXSL5(KL0(JROF,JLEV,1)+2)
            ZF125=PXSL5(KL0(JROF,JLEV,2)+1)
            ZF225=PXSL5(KL0(JROF,JLEV,2)+2)

            ! longitudial interpolation (trajectory)
            Z05=PXSL5(KL0(JROF,JLEV,0)+1)+PDLO5(JROF,JLEV,0) &
             & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1))
            Z15=PXSL5(KL0(JROF,JLEV,1)) &
             & +PCLO5(JROF,JLEV,1,1)*(ZF115-PXSL5(KL0(JROF,JLEV,1))) &
             & +PCLO5(JROF,JLEV,2,1)*(ZF215-PXSL5(KL0(JROF,JLEV,1))) &
             & +PCLO5(JROF,JLEV,3,1)*(PXSL5(KL0(JROF,JLEV,1)+3) &
             &                       -PXSL5(KL0(JROF,JLEV,1)))
            Z25=PXSL5(KL0(JROF,JLEV,2)) &  
             & +PCLO5(JROF,JLEV,1,2)*(ZF125-PXSL5(KL0(JROF,JLEV,2))) &
             & +PCLO5(JROF,JLEV,2,2)*(ZF225-PXSL5(KL0(JROF,JLEV,2))) &
             & +PCLO5(JROF,JLEV,3,2)*(PXSL5(KL0(JROF,JLEV,2)+3) &
             &                       -PXSL5(KL0(JROF,JLEV,2)))
            Z35=PXSL5(KL0(JROF,JLEV,3)+1)+PDLO5(JROF,JLEV,3) &
             & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1))

            ! Interpolation (adjoint).

            KINC(IB+1,JROF)=IBASE+KL0(JROF,JLEV,0)+1
            KINC(IB+2,JROF)=IBASE+KL0(JROF,JLEV,0)+2
            KINC(IB+3,JROF)=IBASE+KL0(JROF,JLEV,1)
            KINC(IB+4,JROF)=IBASE+KL0(JROF,JLEV,1)+1
            KINC(IB+5,JROF)=IBASE+KL0(JROF,JLEV,1)+2
            KINC(IB+6,JROF)=IBASE+KL0(JROF,JLEV,1)+3
            KINC(IB+7,JROF)=IBASE+KL0(JROF,JLEV,2)
            KINC(IB+8,JROF)=IBASE+KL0(JROF,JLEV,2)+1
            KINC(IB+9,JROF)=IBASE+KL0(JROF,JLEV,2)+2
            KINC(IB+10,JROF)=IBASE+KL0(JROF,JLEV,2)+3
            KINC(IB+11,JROF)=IBASE+KL0(JROF,JLEV,3)+1
            KINC(IB+12,JROF)=IBASE+KL0(JROF,JLEV,3)+2

            ! final interpolation in latitude
            Z0=(1._JPRB-ZCLA15-ZCLA25-ZCLA35)*PXF(JROF,JLEV)
            Z1=ZCLA15*PXF(JROF,JLEV)
            Z2=ZCLA25*PXF(JROF,JLEV)
            Z3=ZCLA35*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,1)=PCLA(JROF,JLEV,1)+(Z15-Z05)*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,2)=PCLA(JROF,JLEV,2)+(Z25-Z05)*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,3)=PCLA(JROF,JLEV,3)+(Z35-Z05)*PXF(JROF,JLEV)

            ! longitudial interpolation.
            PZINC(IB+1,JROF) =(1.0_JPRB-PDLO5(JROF,JLEV,0))*Z0
            PZINC(IB+2,JROF) =PDLO5(JROF,JLEV,0)*Z0
            PDLO(JROF,JLEV,0) =PDLO(JROF,JLEV,0)+ Z0 &
             & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1)) 

            PZINC(IB+3,JROF) = &
             & (1.0_JPRB-PCLO5(JROF,JLEV,1,1)-PCLO5(JROF,JLEV,2,1) &
             &          -PCLO5(JROF,JLEV,3,1)) * Z1
            PZINC(IB+4,JROF) =PCLO5(JROF,JLEV,1,1)*Z1 
            PZINC(IB+5,JROF) =PCLO5(JROF,JLEV,2,1)*Z1 
            PZINC(IB+6,JROF) =PCLO5(JROF,JLEV,3,1)*Z1 
            PCLO(JROF,JLEV,1,1)=PCLO(JROF,JLEV,1,1) &
             & + (ZF115-PXSL5(KL0(JROF,JLEV,1)))*Z1
            PCLO(JROF,JLEV,2,1)=PCLO(JROF,JLEV,2,1) &
             & + (ZF215-PXSL5(KL0(JROF,JLEV,1)))*Z1
            PCLO(JROF,JLEV,3,1)=PCLO(JROF,JLEV,3,1) &
             & + (PXSL5(KL0(JROF,JLEV,1)+3)-PXSL5(KL0(JROF,JLEV,1)))*Z1

            PZINC(IB+7,JROF) = &
             & (1.0_JPRB-PCLO5(JROF,JLEV,1,2)-PCLO5(JROF,JLEV,2,2) &
             &          -PCLO5(JROF,JLEV,3,2)) * Z2
            PZINC(IB+8,JROF) =PCLO5(JROF,JLEV,1,2)*Z2 
            PZINC(IB+9,JROF) =PCLO5(JROF,JLEV,2,2)*Z2 
            PZINC(IB+10,JROF)=PCLO5(JROF,JLEV,3,2)*Z2 
            PCLO(JROF,JLEV,1,2)=PCLO(JROF,JLEV,1,2) &
             & + (ZF125-PXSL5(KL0(JROF,JLEV,2)))*Z2
            PCLO(JROF,JLEV,2,2)=PCLO(JROF,JLEV,2,2) &
             & + (ZF225-PXSL5(KL0(JROF,JLEV,2)))*Z2
            PCLO(JROF,JLEV,3,2)=PCLO(JROF,JLEV,3,2) &
             & + (PXSL5(KL0(JROF,JLEV,2)+3)-PXSL5(KL0(JROF,JLEV,2)))*Z2

            PZINC(IB+11,JROF)=(1.0_JPRB-PDLO5(JROF,JLEV,3))*Z3
            PZINC(IB+12,JROF)=PDLO5(JROF,JLEV,3)*Z3
            PDLO(JROF,JLEV,3) =PDLO(JROF,JLEV,3)+ Z3 &
             & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1)) 

            IF (KDEP(JROF,JLEV) == 1) THEN
              KINC(IB+1,JROF)=KINC(IB+11,JROF)-1
              KINC(IB+2,JROF)=KINC(IB+12,JROF)+1
              PZINC(IB+4,JROF)=PZINC(IB+4,JROF)+PZINC(IB+1,JROF)
              PZINC(IB+5,JROF)=PZINC(IB+5,JROF)+PZINC(IB+2,JROF)
              PZINC(IB+1,JROF)=0.0_JPRB
              PZINC(IB+2,JROF)=0.0_JPRB
            ELSEIF (KDEP(JROF,JLEV) == 4) then
              KINC(IB+11,JROF)=KINC(IB+1,JROF)-1
              KINC(IB+12,JROF)=KINC(IB+2,JROF)+1
              PZINC(IB+8,JROF)=PZINC(IB+8,JROF)+PZINC(IB+11,JROF)
              PZINC(IB+9,JROF)=PZINC(IB+9,JROF)+PZINC(IB+12,JROF)
              PZINC(IB+11,JROF)=0.0_JPRB
              PZINC(IB+12,JROF)=0.0_JPRB
            ENDIF

          ENDDO
          ILEV=ILEV+1
        ENDDO
      ENDDO

    ELSE ! spherical geometry

      DO JJLEV=1,KSEP 
        DO JLEV=JJLEV,KFLEV,KSEP

          IB=(ILEV-1)*KDIM

  !CDIR NODEP
          DO JROF=KSTART,KPROF

            ! Computation of coordinates and distances (trajectory).

            ZCLA15=PCLA5(JROF,JLEV,1)
            ZCLA25=PCLA5(JROF,JLEV,2)
            ZCLA35=PCLA5(JROF,JLEV,3)

            ZF115=PXSL5(KL0(JROF,JLEV,1)+1)
            ZF215=PXSL5(KL0(JROF,JLEV,1)+2)
            ZF125=PXSL5(KL0(JROF,JLEV,2)+1)
            ZF225=PXSL5(KL0(JROF,JLEV,2)+2)

            ! longitudial interpolation (trajectory)
            Z05=PXSL5(KL0(JROF,JLEV,0)+1)+PDLO5(JROF,JLEV,0) &
             & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1))
            Z15=PXSL5(KL0(JROF,JLEV,1)) &
             & +PCLO5(JROF,JLEV,1,1)*(ZF115-PXSL5(KL0(JROF,JLEV,1))) &
             & +PCLO5(JROF,JLEV,2,1)*(ZF215-PXSL5(KL0(JROF,JLEV,1))) &
             & +PCLO5(JROF,JLEV,3,1)*(PXSL5(KL0(JROF,JLEV,1)+3) &
             &                       -PXSL5(KL0(JROF,JLEV,1)))
            Z25=PXSL5(KL0(JROF,JLEV,2)) &  
             & +PCLO5(JROF,JLEV,1,2)*(ZF125-PXSL5(KL0(JROF,JLEV,2))) &
             & +PCLO5(JROF,JLEV,2,2)*(ZF225-PXSL5(KL0(JROF,JLEV,2))) &
             & +PCLO5(JROF,JLEV,3,2)*(PXSL5(KL0(JROF,JLEV,2)+3) &
             &                       -PXSL5(KL0(JROF,JLEV,2)))
            Z35=PXSL5(KL0(JROF,JLEV,3)+1)+PDLO5(JROF,JLEV,3) &
             & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1))

            ! Interpolation (adjoint).

            KINC(IB+1,JROF)=IBASE+KL0(JROF,JLEV,0)+1
            KINC(IB+2,JROF)=IBASE+KL0(JROF,JLEV,0)+2
            KINC(IB+3,JROF)=IBASE+KL0(JROF,JLEV,1)
            KINC(IB+4,JROF)=IBASE+KL0(JROF,JLEV,1)+1
            KINC(IB+5,JROF)=IBASE+KL0(JROF,JLEV,1)+2
            KINC(IB+6,JROF)=IBASE+KL0(JROF,JLEV,1)+3
            KINC(IB+7,JROF)=IBASE+KL0(JROF,JLEV,2)
            KINC(IB+8,JROF)=IBASE+KL0(JROF,JLEV,2)+1
            KINC(IB+9,JROF)=IBASE+KL0(JROF,JLEV,2)+2
            KINC(IB+10,JROF)=IBASE+KL0(JROF,JLEV,2)+3
            KINC(IB+11,JROF)=IBASE+KL0(JROF,JLEV,3)+1
            KINC(IB+12,JROF)=IBASE+KL0(JROF,JLEV,3)+2

            ! final interpolation in latitude
            Z0=(1._JPRB-ZCLA15-ZCLA25-ZCLA35)*PXF(JROF,JLEV)
            Z1=ZCLA15*PXF(JROF,JLEV)
            Z2=ZCLA25*PXF(JROF,JLEV)
            Z3=ZCLA35*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,1)=PCLA(JROF,JLEV,1)+(Z15-Z05)*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,2)=PCLA(JROF,JLEV,2)+(Z25-Z05)*PXF(JROF,JLEV)
            PCLA(JROF,JLEV,3)=PCLA(JROF,JLEV,3)+(Z35-Z05)*PXF(JROF,JLEV)

            ! longitudial interpolation.
            PZINC(IB+1,JROF) =(1.0_JPRB-PDLO5(JROF,JLEV,0))*Z0
            PZINC(IB+2,JROF) =PDLO5(JROF,JLEV,0)*Z0
            PDLO(JROF,JLEV,0) =PDLO(JROF,JLEV,0)+ Z0 &
             & *(PXSL5(KL0(JROF,JLEV,0)+2)-PXSL5(KL0(JROF,JLEV,0)+1)) 

            PZINC(IB+3,JROF) = &
             & (1.0_JPRB-PCLO5(JROF,JLEV,1,1)-PCLO5(JROF,JLEV,2,1) &
             &          -PCLO5(JROF,JLEV,3,1)) * Z1
            PZINC(IB+4,JROF) =PCLO5(JROF,JLEV,1,1)*Z1 
            PZINC(IB+5,JROF) =PCLO5(JROF,JLEV,2,1)*Z1 
            PZINC(IB+6,JROF) =PCLO5(JROF,JLEV,3,1)*Z1 
            PCLO(JROF,JLEV,1,1)=PCLO(JROF,JLEV,1,1) &
             & + (ZF115-PXSL5(KL0(JROF,JLEV,1)))*Z1
            PCLO(JROF,JLEV,2,1)=PCLO(JROF,JLEV,2,1) &
             & + (ZF215-PXSL5(KL0(JROF,JLEV,1)))*Z1
            PCLO(JROF,JLEV,3,1)=PCLO(JROF,JLEV,3,1) &
             & + (PXSL5(KL0(JROF,JLEV,1)+3)-PXSL5(KL0(JROF,JLEV,1)))*Z1

            PZINC(IB+7,JROF) = &
             & (1.0_JPRB-PCLO5(JROF,JLEV,1,2)-PCLO5(JROF,JLEV,2,2) &
             &          -PCLO5(JROF,JLEV,3,2)) * Z2
            PZINC(IB+8,JROF) =PCLO5(JROF,JLEV,1,2)*Z2 
            PZINC(IB+9,JROF) =PCLO5(JROF,JLEV,2,2)*Z2 
            PZINC(IB+10,JROF)=PCLO5(JROF,JLEV,3,2)*Z2 
            PCLO(JROF,JLEV,1,2)=PCLO(JROF,JLEV,1,2) &
             & + (ZF125-PXSL5(KL0(JROF,JLEV,2)))*Z2
            PCLO(JROF,JLEV,2,2)=PCLO(JROF,JLEV,2,2) &
             & + (ZF225-PXSL5(KL0(JROF,JLEV,2)))*Z2
            PCLO(JROF,JLEV,3,2)=PCLO(JROF,JLEV,3,2) &
             & + (PXSL5(KL0(JROF,JLEV,2)+3)-PXSL5(KL0(JROF,JLEV,2)))*Z2

            PZINC(IB+11,JROF)=(1.0_JPRB-PDLO5(JROF,JLEV,3))*Z3
            PZINC(IB+12,JROF)=PDLO5(JROF,JLEV,3)*Z3
            PDLO(JROF,JLEV,3) =PDLO(JROF,JLEV,3)+ Z3 &
             & *(PXSL5(KL0(JROF,JLEV,3)+2)-PXSL5(KL0(JROF,JLEV,3)+1)) 

          ENDDO
          ILEV=ILEV+1
        ENDDO
      ENDDO

    ENDIF

  ENDIF

ENDIF

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

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