FUNCTION USTAR_1D(PWIND,PZ,PZ0,PLMO)
USE MODD_CSTS
USE MODD_SURF_PAR, ONLY : XUNDEF
IMPLICIT NONE
REAL, DIMENSION(:), INTENT(IN) :: PWIND
REAL, DIMENSION(:), INTENT(IN) :: PZ
REAL, DIMENSION(:), INTENT(IN) :: PZ0
REAL, DIMENSION(:), INTENT(IN) :: PLMO
REAL, DIMENSION(SIZE(PZ)) :: USTAR_1D
REAL, DIMENSION(SIZE(PZ)) :: ZZ_O_LMO
REAL, DIMENSION(SIZE(PZ)) :: ZZ0_O_LMO
REAL(KIND=JPRB) :: ZHOOK_HANDLE
!
!* purely unstable case
IF (LHOOK) CALL DR_HOOK('MODE_SBLS:USTAR_1D',0,ZHOOK_HANDLE)
USTAR_1D (:) = 0.
ZZ_O_LMO (:) = XUNDEF
ZZ0_O_LMO(:) = XUNDEF
!
!* general case
WHERE(ABS(PLMO) > 1.E-20 .AND. PLMO/=XUNDEF)
ZZ_O_LMO = PZ(:) / PLMO(:)
ZZ0_O_LMO = PZ0(:) / PLMO(:)
USTAR_1D(:) = PWIND &
* XKARMAN / ( LOG(PZ(:)/PZ0(:)) &
- PAULSON_PSIM(ZZ_O_LMO(:)) &
+ PAULSON_PSIM(ZZ0_O_LMO(:)) )
END WHERE
!
!* purely neutral case
WHERE(PLMO==XUNDEF)
ZZ_O_LMO = 0.
USTAR_1D(:) = PWIND &
* XKARMAN / LOG(PZ(:)/PZ0(:))
END WHERE
IF (LHOOK) CALL DR_HOOK('MODE_SBLS:USTAR_1D',1,ZHOOK_HANDLE)
!
END FUNCTION USTAR_1D