SUBROUTINE PPUV10M(&
 & KPROMA,KIDIA,KFDIA,LDNEUTRAL,LDRELCURR,PINTH,&
 & PUB,PVB,PAPHI,&
 & PRI,PBN,PBM,PU0,PV0,&
 & PU10M,PV10M)  

!**** *PPUV10M* - POST-PROCESSED SURFACE WIND

!     PURPOSE
!     -------
!          COMPUTE FROM THE MODEL VALUES AT THE OBSERVATION
!          POINT THE TWO HORIZONTAL COMPONENTS OF THE WIND
!          AT SPECIFIED HEIGHT

!**   INTERFACE
!     ---------
!       *CALL* *PPUV10M(
!     C                 KPROMA,KIDIA,KFDIA,LDNEUTRAL,LDRELCURR,PINTH,
!     I                 PUB,PVB,PAPHI,
!     I                 PRI,PBN,ZBM,
!     O                 PU10M,PV10M)

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

!        KPROMA                    - HORIZONTAL DIMENSION.             (INPUT-C)
!        KIDIA                     - INDEX OF START POINT              (INPUT-C)
!        KFDIA                     - INDEX OF END   POINT              (INPUT-C)
!        LDNEUTRAL                 - CONTROL TYPE OF OUTPUT WINDS      (INPUT-C)
!                                    FALSE: REAL WIND,                 (INPUT-C)
!                                    TRUE : EQUIVALENT NEUTRAL WIND
!        LDRELCURR                 - TRUE: WIND RELATIVE TO OC.CURRENT (INPUT-C)
!        PINTH(KPROMA)             - INTERPOLATION HEIGHT              (INPUT)
!        PUB(KPROMA)               - MODEL VALUE OF THE U-WIND
!                                    POINT                             (INPUT)
!        PVB(KPROMA)               - MODEL VALUE OF THE V-WIND
!                                    COMPONENT AT THE OBSERVATION
!                                    POINT                             (INPUT)
!        PAPHI(KPROMA)             - POST-PROCESSED GEOPOTENTIAL
!        PRI(KPROMA)               - RICHARSON NUMBER                  (INPUT)
!        PBN(KPROMA)               - NEUTRAL COEFFICIENT               (INPUT)
!        PBM(KPROMA)               - MOMENTUM COEFFICIENT              (INPUT)
!        PU0(KPROMA)               - U-COMP OCEAN CURRENT              (INPUT)
!        PV0(KPROMA)               - V-COMP OCEAN CURRENT              (INPUT)
!        PU10M(KPROMA)             - POST-PROCESSED U-COMPONENT        (OUTPUT)
!        PV10M(KPROMA)             - POST-PROCESSED V-COMPONENT        (OUTPUT)

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

!     METHOD.
!     -------
!        INTERPOLATION METHOD OF J.F. GELEYN, TELLUS (1988), 40A, 347-351

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

!     REFERENCE.
!     ----------
!        ECMWF RESEARCH DEPARTMENT DOCUMENTATION OF THE IFS

!     AUTHOR.
!     -------
!        CARLA CARDINALI *ECMWF*

!     MODIFICATIONS.
!     --------------
!        ORIGINAL    : 92-05-22
!        L. Isaksen  : 96-02-20 NFLEV --> NFLEVG
!        M.HAMRUD    : 98-10-26 Security if lowest model level below 10m
!        D.VASILJEVIC: 99-02-08 Interpolation level passed as argument
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        H.Hersbach  : 08-04-16 Option for neutral winds, add ocean current
!     ------------------------------------------------------------------

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

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KIDIA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFDIA 
LOGICAL,           INTENT(IN)    :: LDNEUTRAL
LOGICAL,           INTENT(IN)    :: LDRELCURR
REAL(KIND=JPRB)   ,INTENT(IN)    :: PINTH(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PUB(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVB(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PAPHI(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRI(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PBN(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PBM(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PU0(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PV0(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PU10M(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PV10M(KPROMA) 
INTEGER(KIND=JPIM) :: JL

REAL(KIND=JPRB) :: ZCBN, ZCBS, ZCBU, ZRAT, ZRED
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

!*    2.     WIND INTERPOLATION.
!            -------------------
DO JL=KIDIA,KFDIA
  IF (PINTH(JL) < PAPHI(JL) .OR. LDNEUTRAL) THEN
    ZRAT=PINTH(JL)/PAPHI(JL)
    ZCBN=LOG(1.0_JPRB+(EXP(PBN(JL))-1.0_JPRB)*ZRAT)
    ZCBS=-(PBN(JL)-PBM(JL))*ZRAT
    ZCBU=-LOG(1.0_JPRB+(EXP(PBN(JL)-PBM(JL))-1.0_JPRB)*ZRAT)
    IF (LDNEUTRAL) THEN
      ZRED=ZCBN/PBM(JL)
    ELSEIF(PRI(JL) >= 0.0_JPRB) THEN
      ZRED=(ZCBN+ZCBS)/PBM(JL)
    ELSE
      ZRED=(ZCBN+ZCBU)/PBM(JL)
    ENDIF
    IF (.NOT.LECURR) THEN
      PU10M(JL)=ZRED*PUB(JL)
      PV10M(JL)=ZRED*PVB(JL)
    ELSEIF (LDRELCURR) THEN
      PU10M(JL)=ZRED*(PUB(JL)-PU0(JL))
      PV10M(JL)=ZRED*(PVB(JL)-PV0(JL))
    ELSE
      PU10M(JL)=ZRED*PUB(JL)+(1.0_JPRB-ZRED)*PU0(JL)
      PV10M(JL)=ZRED*PVB(JL)+(1.0_JPRB-ZRED)*PV0(JL)
    ENDIF
  ELSE
    PU10M(JL)=PUB(JL)
    PV10M(JL)=PVB(JL)
  ENDIF
ENDDO
!     -----------------------------------------------------------

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