SUBROUTINE OBSPERR(KPAR,PLEV1,PLAT,POBTIM,&
 & PWEIGHT,PERERR)  

!**** SUBROUTINE OBSPERR - PERSISTENCE ERROR (TERM 2 AND FINAL)

!        D. VASILJEVIC    ECMWF    17/10/1994

!     PURPOSE
!     -------

!        FINAL PERSISTENCE ERROR

!**   INTERFACE
!     ---------

!        CALL OBSPERR(KPAR,PLEV1,PLAT,POBTIM,
!                     PWEIGHT,PERERR)

!     WHERE:
!            KPAR   = VARIABLE FOR WHICH PERSIST. ERROR IS LOOKED FOR
!            PLEV1  = PRESSURE LEVEL 1 (VERTICAL REF. 1)
!            PLAT   = LAT.
!            POBTIM = TIME DIFFERENCE
!            PWEIGHT= WEIGHT
!            PERERR = FINAL PER. ERR.

!        OBSPERR IS CALLED BY SUBROUTINES

!     METHOD
!     ------

!        THE PERSISTENCE ERROR ITSELF IS FORMULATED AS:
!           ERRPER  =  (ERPRM1/6)*(1+2*SIN(ABS(2*LAT)))* B * DT
!     WHERE,
!           ERRPER = PERSISTENCE ERROR
!           ERPRM1 = MAX. PERSISTENCE ERROR FOR 1 HOUR
!           LAT    = LATITUDE OF OBSERVATION IN QUESTION
!           B      = 1.5 + (0.5*MIN(MAX(LAT,-20),20)/20) * A (TERM 2)
!           A      = SIN(2*PI*(DAY/365.25)+PI/2)             (TERM 1)
!           DAY    = DAY OF YEAR
!           DT     = FRACTION OF DAY
!     PARAMETER B (TERM 2) AND ERRPER (FINAL PERSIST. ERROR) ARE CALC-
!     ULATED IN THIS ROUTINE.  IN ADDITION TO THAT, IF OBSERVATION IS
!     SYNOP LAND OR SYNOP SHIP AND PRESSURE TENDENCY CORRECTION HAS
!     BEEN APPLIED FINAL PERSISTENCE ERROR IS REDUCED. REDUCTION FACTOR
!     4 IS USED IF CORRECTION IS FOR LAND STATION OR FOR A SHIP WHICH
!     TENDENCY HAS ALSO BEEN CORRECTED FOR A SHIP MOVEMENT. REDUCTION
!     FACTOR IS 2 IF NO ACCOUNT OF SHIP MOVEMENT HAS BEEN POSSIBLE.

!**   EXTERNALS
!     ---------

!        PEREREV - PERSISTENCE ERROR EVALUATION (COMMON ROUTINE WITH
!                  IFS)

!**   HISTORY
!     -------

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

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

USE PARCMA   , ONLY : JPMXVAR
USE YOMANCS  , ONLY : RADIANS  ,RMDI     ,RMINPHOU ,RREDPERR
USE YOMLIM   , ONLY : RLAT20   ,RP700    ,RP250
USE YOMVNMB  , ONLY : NVNUMB
USE YOMLUN   , ONLY : NULOUT

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KPAR 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLEV1 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLAT 
REAL(KIND=JPRB)   ,INTENT(IN)    :: POBTIM 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PWEIGHT 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PERERR 
REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "pererev.intfb.h"

!*
!-----------------------------------------------------------------------

!        1.       EVALUATE THEM HERE
!                 ------------------

IF (LHOOK) CALL DR_HOOK('OBSPERR',0,ZHOOK_HANDLE)
CALL PEREREV(KPAR,PLEV1,&
 & PLAT,POBTIM,&
 & PWEIGHT,&
 & NULOUT,NVNUMB,JPMXVAR,RLAT20,RP700,RP250,&
 & RREDPERR,RMINPHOU,RADIANS,RMDI,&
 & PERERR)  
!*
!-----------------------------------------------------------------------

!        2.       RETURN
!                 ------

2 CONTINUE
IF (LHOOK) CALL DR_HOOK('OBSPERR',1,ZHOOK_HANDLE)
END SUBROUTINE OBSPERR
