SUBROUTINE FGWND(KSET,KCURRPO,KCURLPO)

!**** SUBROUTINE FGWND - FIRST GUESS CHECK FOR WIND

!          HEIKKI JARVINEN   ECMWF          15/MAR/1995
!          DRASKO VASILJEVIC ECMWF          21/10/1999

!*    PURPOSE
!     -------

!        FIRST GUESS CHECK FOR WIND

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

!     ***CALL*FGWND(KSET,KCURRPO,KCURLPO)
!     WHERE KSET    = OBSERVATION SET NUMBER
!           KCURRPO = CURRENT REP. POINTER
!           KCURLPO = CURRENT LEV POINTER

!        FGWND IS CALLED BY SUBROUTINE FIRST

!*    METHOD
!     ------

!        FIRST, A WIND DIRECTION CHECK IS DONE FOR TEMP AND PILOT WINDS.
!     OBSERVED WIND DIRECTION IS COMPARED WITH FIRST GUESS WIND DIRECTION
!     IF:
!        - LEVEL IS ABOVE 700HPA
!        - FIRST GUESS AND OBSERVED AVERAGE WIND SPEED IS GREATER THAN
!          15M/S
!     CONDITIONS FOR FLAGGING ARE:
!                            [ 60 DEGREE, FLAG = 1]
!              (OBDD-FGDD) > [ 90   "   , FLAG = 2]
!                            [120   "   , FLAG = 3]
!     WHERE
!              OBDD = OBSERVED WIND DIRECTION
!              FGDD = FIRST GUESS WIND DIRECTION

!     THEN, A (WIND SPEED) FIRST GUESS CHECK IS DONE.  WIND COMPONENTS ARE
!     CHECKED TOGETHER:

!        IF ( ( ZUDEP/ZUFGE)**2 + (ZVDEP/ZVFGE)**2 )/2. >

!           (1+ ( ZUFOE**2 + ZVFOE**2 )/2. )*ERRLIM(J), J = 1, 2, 3
!     WHERE
!        ZUDEP  = FIRST GUESS DEPARTURE FOR U (OBS - FG)
!        ZVDEP  = FIRST GUESS DEPARTURE FOR V (OBS - FG)
!        ZUFGE  = FIRST GUESS ERROR FOR U
!        ZVFGE  = FIRST GUESS ERROR FOR V
!        ZUFOE  = FINAL OBSERVATION ERROR FOR U
!        ZVFOE  = FINAL OBSERVATION ERROR FOR V
!                  = [ 8]
!        ERRLIM(J) = [18], J = 1, 2, 3 (J IS ALSO FLAG VALUE)
!                  = [32]

!     SCATTEROMETER WINDS ARE REJECTED IF EITHER OBSERVED OR FIRST GUESS
!     VALUE IS GREATER THAT 35M/S, OR SST IS LESS THAN 273.15K
!     PREVIOUS VALUES 20M/S AND 275K RESP. BEING TOO CONSERVATIVE).
!     USE NOW OF SEA ICE CONCENTRATION LIMIT (0.01)

!     IN ADDITION, IF WIND DIRECTION CHECK GAVE FLAG > 2 THEN FIRST GUESS
!     CHECK FLAG IS INCREASED BY 1, UNLESS IT IS 3.

!     THE FIRST-GUESS CHECK IS ASYMMETRIC FOR CLOUD TRACK WINDS.
!     THE REJECTION LIMIT IS REDUCED IF THE CLOUD WIND IS
!     EXTRATROPICAL, UPPER LEVEL, IN STRONG FIRST-GUESS FLOW AND
!     CLEARLY WEAKER THAN THE FIRST-GUESS.

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

!        NFLGDSE -

!**   MODIFICATIONS
!     -------------
!        H. Jarvinen    12 Dec 1996 : A modified subroutine call
!        Erik Andersson 15 May 1998 : Changed BgQC limits, in namelist.
!        Niels Bormann  22 June 2001 : Optional SATOB FG check
!        C. Payan       26 June 2004 : check seaice for Scatt with SST for MF
!        C. Payan          May  2005 : check seaice for Scatt controlled
!                             by NICESEAMASK integer key

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

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

USE YOMLUN   , ONLY : NULOUT
USE YOMCST   , ONLY : RPI
USE YOMCOCTP , ONLY : NSYNOP   ,NAIREP   ,NSATOB   ,&
 & NDRIBU   ,NPAOB   ,NTEMP    ,NTDROP             ,&
 & NSCATT   ,NSCAT1  ,NSCAT2   ,NSCAT3   ,NPILOT
USE YOMANCS  , ONLY : RMDI     ,RDEGREES ,NMDI
USE YOMALIM  , ONLY : NFLLIM
USE YOMVNMB  , ONLY : NVNUMB
USE YOMSCC   , ONLY : LSCDPR   ,LTARGDROP, NICESEAMASK
USE YOMNMCOD , ONLY : NPRESVC
USE YOMNMEV  , ONLY : NR1EVENT ,ND1EVENT
USE YOMFGLIM , ONLY : RAVRWS   ,RDF060   ,RDF090   ,RDF120
USE YOMRPLIM , ONLY : RP700
USE YOMTHLIM , ONLY : RSCAWLI  ,RSCACLI  ,RSCATLI
USE YOMCOSJO , ONLY : RBGQC    ,NVAR_U10 ,NVAR_U   ,&
 & LHUBERBGQC, &
 & RHUBERBGQC, RHUBERBGQC_SONDEGOOD, RHUBERBGQC_SONDEOK
USE YOMDB
USE YOMTVRAD , ONLY : SATOBGRP_TABLE
USE YOMOBSET_THSAFE
USE OML_MOD, ONLY : OML_MY_THREAD

USE GOMS_MIX     , ONLY : YGOMEC, YGOMS, NUSE_ECCI
IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KSET 
INTEGER(KIND=JPIM),INTENT(IN)    :: KCURRPO 
INTEGER(KIND=JPIM),INTENT(IN)    :: KCURLPO 
INTEGER(KIND=JPIM) :: ICDTYP, IDIRFL, IFLAG,&
 & IOBTYP, IPOSM, IU,&
 & IV, IVAR, IVARU, IVARV, IVCO, ICDT, IOBT, IHULEV, ISONDETYPE  
INTEGER(KIND=JPIM) :: JFLAG, IGRP, ITID

LOGICAL :: LLFAIL, LLPRINT

REAL(KIND=JPRB) :: ZANGFO, ZBARWN, ZCOSAG, ZLEFT, ZLS, ZOBLAT,&
 & ZOBLON, ZPPP, ZREJLAT, ZREJMOD, ZRHSIDE, ZRIGHT, &
 & ZCI, ZSST, ZU, ZUDEP, ZUFG, ZUFGE, ZUFOE, ZV, ZVDEP, &
 & ZVFG, ZVFGE, ZVFOE, ZWDIFF, ZWNDFG, ZWNDFG2, &
 & ZWNDOB, ZWNDOB2
REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "nflgdse.intfb.h"
#include "cmoctmap.intfb.h"
#include "fcobs.h"
#include "openmp_obs.h"
!*

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

!        1.       INITIALIZE
!                 ----------

!*          1.1   WIND DIRECTION FLAG

IF (LHOOK) CALL DR_HOOK('FGWND',0,ZHOOK_HANDLE)
ITID = OML_MY_THREAD()
IDIRFL  = 0
LLFAIL  = .FALSE.
LLPRINT = .FALSE.
IGRP    = MOD(OBSET(ITID)%MTYPOB(KSET)/100,100)
                                                                                
!*          1.2  LOCAL VARIABLES INITIALISATION
                                                                                
ZCI     = 0.0_JPRB
ZSST    = 300._JPRB
                                                                                
!*
!     ------------------------------------------------------------------

!        2.       FIND OUT BOTH WIND COMPONENTS
!                 -----------------------------

!*          2.1   OBSERVATION POINTERS

IU = KCURLPO
IV = IU + 1
!*
!           2.2   CHECK THAT V-COMPONENT FOLLOWS U-COMPONENT

IVARU = ROBODY(IU,MDBVNM)
IVARV = ROBODY(IV,MDBVNM)
!*
!              2.2.1   UPPER-AIR WIND COMPONENTS

IF(IVARU == NVNUMB( 1) .AND. IVARV /= NVNUMB( 2)) THEN
  LLFAIL = .TRUE.
!*
!              2.2.2   10 METRE WIND COMPONENTS

ELSEIF(IVARU == NVNUMB(56) .AND. IVARV /= NVNUMB(57)) THEN
  LLFAIL = .TRUE.
!*
!              2.2.3   AMBIGUOUS SCATTEROMETER WIND COMPONENTS

ELSEIF(IVARU == NVNUMB(62) .AND. IVARV /= NVNUMB(61)) THEN
  LLFAIL = .TRUE.
ENDIF
IF(LLFAIL) THEN
  ROBODY(IU,MDBDSTA) = ZCHSTAT_REJECT( ROBODY(IU,MDBDSTA))
  ROBODY(IU,MDBDEV1) = ZCHEV1( ROBODY(IU,MDBDEV1),ND1EVENT( 2))
  WRITE(NULOUT,'('' * WARNING: MISSING WIND COMP. IN FGWND '')')
  GOTO 5
ENDIF
!*
!           2.3   COLLECT REPORT/VARIABLE INFORMATION

!*             2.3.1   HEADER INFORMATION AND MODEL FIELD VALUES

IPOSM      = ROBHDR(KCURRPO,MDB_MAPOMM_AT_INDEX)
IOBTYP     = ROBHDR(KCURRPO,MDBOTP)
ICDTYP     = ROBHDR(KCURRPO,MDB_CODETYPE_AT_HDR)
ZOBLAT     = ROBHDR(KCURRPO,MDBLAT)*RDEGREES
ZOBLON     = ROBHDR(KCURRPO,MDBLON)*RDEGREES
ZLS        = YGOMEC(IPOSM)%ECLSMA
ZSST       = YGOMS(IPOSM)%TS
IF (NUSE_ECCI == 1) ZCI = YGOMEC(IPOSM)%ECCI
!*
!              2.3.2   U-COMPONENT

ZU    = ROBODY(IU,MDBVAR)         ! OBSERVED VARIABLE
ZUDEP = ROBODY(IU,MDBOMF)         ! FIRST GUESS DEPARTURE
ZUFOE = ROBODY(IU,MDBFOE)         ! FINAL OBSERVATION ERROR
ZUFGE = ROBODY(IU,MDBFGE)         ! FIRST GUESS ERROR
ZUFG  = ZU - ZUDEP                ! FIRST GUESS VALUE
IVCO  = ROBODY(IU,MDBVCO)         ! VERTICAL COORDINATE TYPE
ZPPP  = ROBODY(IU,MDBPPP)         ! VERTICAL COORDINATE
!*
!              2.3.3   V-COMPONENT

ZV    = ROBODY(IV,MDBVAR)
ZVDEP = ROBODY(IV,MDBOMF)
ZVFOE = ROBODY(IV,MDBFOE)
ZVFGE = ROBODY(IV,MDBFGE)
ZVFG  = ZV - ZVDEP
!*
!           2.4   CHECK IF SOMETHING IS MISSING

IF(ZUDEP == RMDI .OR.ZUFOE == RMDI .OR.ZUFGE == RMDI     ) GOTO 5
IF(ZVDEP == RMDI .OR.ZVFOE == RMDI .OR.ZVFGE == RMDI     ) GOTO 5
!*
!     ------------------------------------------------------------------

!        3.       FIRST GUESS CHECK FOR WIND DIRECTION
!                 ------------------------------------

!*          3.1   SELECT THE OBSERVATION TYPE (ONLY UPPERAIR REPORTS)

IF(IOBTYP == NSYNOP .OR. IOBTYP == NDRIBU .OR.&
 & IOBTYP == NPAOB  .OR. IOBTYP == NSCATT) GOTO 4  
!*
!           3.2   CHECK LEVEL

IF(IVCO == NPRESVC .AND. ZPPP > RP700) GOTO 4
!*
!           3.3   FIND OUT MEAN OF OBSERVED AND FIRST GUESS WIND SPEED

ZWNDOB = SQRT(ZU*ZU + ZV*ZV)
ZWNDFG = SQRT(ZUFG*ZUFG + ZVFG*ZVFG)
ZBARWN = (ZWNDFG + ZWNDOB)/2.0_JPRB
!*
!           3.4   CHECK THE MEAN WIND SPEED

IF(ZBARWN  <  RAVRWS) GOTO 4
!*
!*          3.5   FIND OUT ANGLE BETWEEN FGS. AND OBS. WIND

IF(ZWNDOB  ==  0.0_JPRB .OR. ZWNDFG  ==  0.0_JPRB) THEN
  ZANGFO = 0.0_JPRB
ELSE
  ZCOSAG = (ZU*ZUFG + ZV*ZVFG)/(ZWNDOB*ZWNDFG)
  IF(ZCOSAG  >   1.0_JPRB) ZCOSAG =  1.0_JPRB
  IF(ZCOSAG  <  -1.0_JPRB) ZCOSAG = -1.0_JPRB
  ZANGFO = ACOS(ZCOSAG)*180._JPRB/RPI
ENDIF

!*          3.6   FIND OUT WIND DIRECTION CHECK FLAG

IFLAG = NFLLIM(0)
IF(ZANGFO  >  RDF060) IFLAG = IFLAG + 1
IF(ZANGFO  >  RDF090) IFLAG = IFLAG + 1
IF(ZANGFO  >  RDF120) IFLAG = IFLAG + 1

!*          3.7   SET THE WIND DIRECTION CHECK FLAG AND EVENT

IDIRFL = IFLAG
IF(IFLAG > NFLLIM(0)) THEN
  ROBODY(IU,MDBDEV1) = ZCHEV1( ROBODY(IU,MDBDEV1),ND1EVENT(10))
  ROBODY(IV,MDBDEV1) = ZCHEV1( ROBODY(IV,MDBDEV1),ND1EVENT(10))
  CALL NFLGDSE(IU,'FIRST',IFLAG)
  CALL NFLGDSE(IV,'FIRST',IFLAG)

  IF(LSCDPR) THEN
    WRITE(NULOUT,'('' - WIND DIRECTION F.G. FLAG '',I2,&
     & '' FOR OBSTYP '',I2,'' OBS U/V '',2(F7.2,1X),&
     & '' FG. U/V '',2(F7.2,1X))')&
     & IFLAG,IOBTYP,ZU,ZV,ZUFG,ZVFG  
  ENDIF
ENDIF
!*
!     ------------------------------------------------------------------

!        4.       FIRST GUESS CHECK FOR WIND SPEED
!                 --------------------------------

4 CONTINUE
!*
!           4.1   NORMALIZE ERRORS AND DEPARTURES

ZUFOE = ZUFOE/ZUFGE
ZVFOE = ZVFOE/ZVFGE
ZUDEP = ZUDEP/ZUFGE
ZVDEP = ZVDEP/ZVFGE

IF(IVARU == NVNUMB(56)) THEN
  IVAR=NVAR_U10                              ! Surface wind
ELSEIF(IVARU == NVNUMB(62)) THEN
  IVAR=NVAR_U10                              ! Ambiguos wind
ELSE
  IVAR=NVAR_U                                ! Upper-air wind
ENDIF
!*
!           4.2   SETUP EQUATION

ZLEFT  = (ZUDEP**2 + ZVDEP**2)/2.0_JPRB
ZRIGHT = (ZUFOE**2 + ZVFOE**2)/2.0_JPRB + 1.0_JPRB
!*
!           4.3   MODIFY FLAG LIMITS THROUGH ZREJMOD

ZREJMOD = 1.0_JPRB
IFLAG   = NFLLIM(0)
!*
!           4.4  AIREP

IF(IOBTYP == NAIREP) THEN
!*
!              4.4.1   REJECT AIREP WITH ZERO WIND SPEED

  ZWNDOB2 = ZU*ZU + ZV*ZV
  ZWNDFG2 = ZUFG*ZUFG + ZVFG*ZVFG
  IF(ZWNDOB2  <  0.001_JPRB .AND. ZWNDFG2  >  5.0_JPRB*5.0_JPRB) THEN
    ZREJMOD = 0.01_JPRB
  ENDIF
!*
!              4.4.2 TEMP-DROPSONDES : RELAX BACKGROUND CHECK

ELSEIF(IOBTYP == NTEMP .AND. ICDTYP == NTDROP .AND. LTARGDROP)   THEN
  IF(ABS(ZOBLAT) > 30._JPRB) THEN
    ZREJMOD = 2.0_JPRB   ! relax extratropics to account for low predictability
  ELSE
    ZREJMOD = 100._JPRB ! relax tropics even more to improve hurricane analysis
  ENDIF
!*
!           4.5  SATOB

ELSEIF(IOBTYP == NSATOB) THEN
  IF(ABS(ZOBLAT) > 20._JPRB) THEN
    ZREJMOD = ZREJMOD * SATOBGRP_TABLE(IGRP)%zrejmod_factor
  ENDIF

!*
!              4.5.1   RELAX FLAG LIMIT FOR LOW LEVEL SATOB

  IF(IVCO == NPRESVC .AND. ZPPP > RP700) THEN
    ZREJMOD = 2.0_JPRB
  ENDIF
!*
!              4.5.2   ASYMMETRIC SATOB-FIRST-GUESS CHECK

  ZREJLAT = 20._JPRB
  ZWDIFF = 4._JPRB
  ZWNDOB = SQRT(ZU*ZU + ZV*ZV)
  ZWNDFG = SQRT(ZUFG*ZUFG + ZVFG*ZVFG)
  IF((ZWNDFG-ZWNDOB) > ZWDIFF .AND. SATOBGRP_TABLE(IGRP)%asym_fgcheck) THEN
    ROBODY(IU,MDBDEV1) = ZCHEV1( ROBODY(IU,MDBDEV1),ND1EVENT(10))
    ROBODY(IV,MDBDEV1) = ZCHEV1( ROBODY(IV,MDBDEV1),ND1EVENT(10))
!*
!                 4.5.3.1   MORE TOLERANT FOR LOW LEVEL WINDS

    IF(IVCO == NPRESVC .AND. ZPPP > RP700) THEN
      ZREJMOD = 1.50_JPRB
!*
!                 4.5.3.2   ASYMMETRIC CHECK MORE TOLERANT IN TROPICS

    ELSEIF(ABS(ZOBLAT) <= ZREJLAT) THEN
      ZREJMOD = 0.7_JPRB
!*
!                 4.5.3.3   OTHERWISE SPEED DEPENDENT ASYMMETRIC LIMIT

    ELSE
      ZREJMOD = -0.0125_JPRB*ZWNDFG + 0.75_JPRB
      IF(ZREJMOD < 0.0_JPRB) ZREJMOD = 0.0_JPRB
    ENDIF
  ENDIF

ENDIF
!*
!           4.7   TEST THE ERROR LIMIT

DO JFLAG = 1, 3
  IF (LHUBERBGQC(IVAR,IOBTYP)) THEN
    IHULEV = 3
    IF (ZPPP < 85000.0_JPRB) THEN
      IHULEV = 2
    ELSEIF (ZPPP < 15000.0_JPRB) THEN
      IHULEV = 1
    ENDIF
    IF (IOBTYP == NTEMP .OR. IOBTYP == NPILOT) THEN
!      IF (IOBTYP == NTEMP) THEN
!        ISONDETYPE = ROBHDR(KCURRPO,MDB_SONDE_TYPE_AT_HDR)
!      ELSE      
        ISONDETYPE = NMDI
!      ENDIF 
! Good sondes: VIZ (10,11,14,21,31,38,49,51), SIPPICAN (82,83,84,85,86,87),
!              VAISALA RS92 (78,79,80,81), VAISALA RS90 (71,72,73,74,78),
!              MEISEI (22,47,55)
      IF (ANY(ISONDETYPE == (/10,11,14,21,31,38,49,51,82,83,84,85,86,87, &
                            & 78,79,80,81,71,72,73,74,78,22,47,55/))) THEN
        ZRHSIDE = ZRIGHT*RHUBERBGQC_SONDEGOOD(IVAR,IOBTYP,IHULEV,JFLAG)*ZREJMOD
      ELSE
        ZRHSIDE = ZRIGHT*RHUBERBGQC_SONDEOK(IVAR,IOBTYP,IHULEV,JFLAG)*ZREJMOD
      ENDIF
    ELSE
      CALL CMOCTMAP('CODETOSQ',NULOUT,IOBTYP,ICDTYP,IOBT,ICDT)
      ZRHSIDE = ZRIGHT*RHUBERBGQC(IVAR,ICDT,IOBT,IHULEV,JFLAG)*ZREJMOD
    ENDIF
  ELSE
    ZRHSIDE = ZRIGHT*RBGQC(IVAR,IOBTYP,JFLAG)*ZREJMOD
  ENDIF
  IF(ZLEFT  >  ZRHSIDE) IFLAG = JFLAG
ENDDO

!*
!           4.8   SET DATUM FLAG AND ADD AN EVENT
!*
!              4.8.1   CHECK WIND DIRECTION FLAG

IF(IDIRFL >= NFLLIM(2) .AND. IFLAG < NFLLIM(3)) THEN
  IFLAG = IFLAG + 1
ENDIF
!*
!              4.8.2   SET FLAG

IF(IFLAG > NFLLIM(0)) THEN
  ROBODY(IU,MDBDEV1) = ZCHEV1( ROBODY(IU,MDBDEV1),ND1EVENT(10))
  ROBODY(IV,MDBDEV1) = ZCHEV1( ROBODY(IV,MDBDEV1),ND1EVENT(10))
  CALL NFLGDSE(IU,'FIRST',IFLAG)
  CALL NFLGDSE(IV,'FIRST',IFLAG)
  LLPRINT = .TRUE.
ENDIF
!*
!           4.9   PERFORM A SPECIAL CHECK FOR SCATTEROMETER WINDS

IF(IOBTYP == NSCATT) THEN
!*
!              4.9.1   REJECT ERS WINDS IF OBS/FG EXCEEDS RSCAWLI (35M/S)

  IF(ICDTYP == NSCAT1 .OR. ICDTYP == NSCAT2 .OR. ICDTYP == NSCAT3) THEN
    ZWNDOB = SQRT(ZU*ZU + ZV*ZV)
    ZWNDFG = SQRT(ZUFG*ZUFG + ZVFG*ZVFG)
    IF(ZWNDOB > RSCAWLI .OR. ZWNDFG > RSCAWLI) THEN
      ROBHDR(KCURRPO,MDBRST) = ZCHSTAT_REJECT( ROBHDR(KCURRPO,MDBRST))
      ROBHDR(KCURRPO,MDBREV1) = ZCHEV1( ROBHDR(KCURRPO,MDBREV1),NR1EVENT(16))
      LLPRINT = .TRUE.
    ENDIF
  ENDIF
!*
!              4.9.2.1   REJECT SCATT WINDS IF TS LESS THAN RSCATLI
!                      (MF limit: 278K , EC limit: 273.15K)
!              Note: NICESAMASK=0 since cy32r3; QC now handled in blacklist 
  IF (NICESEAMASK == 1 .OR. NICESEAMASK == 3) THEN
     IF  (ZSST < RSCATLI) THEN
        ROBHDR(KCURRPO,MDBRST) = ZCHSTAT_BLACKLST( ROBHDR(KCURRPO,MDBRST))
        ROBHDR(KCURRPO,MDBREV1)= ZCHEV1( ROBHDR(KCURRPO,MDBREV1),NR1EVENT(12))
        ROBODY(IU,MDBDSTA) = ZCHSTAT_BLACKLST( ROBODY(IU,MDBDSTA))
        ROBODY(IU,MDBDEV1) = ZCHEV1( ROBODY(IU,MDBDEV1),ND1EVENT(16))
        ROBODY(IV,MDBDSTA) = ZCHSTAT_BLACKLST( ROBODY(IV,MDBDSTA))
        ROBODY(IV,MDBDEV1) = ZCHEV1( ROBODY(IV,MDBDEV1),ND1EVENT(16))
        LLPRINT = .TRUE.
     ENDIF
  ENDIF 
!              4.9.2.2   REJECT SCATT WINDS IF ECCI MORE THAN RSCACLI (0.01)
!              Note: NICESAMASK=0 since cy32r3; QC now handled in blacklist 
  IF(NICESEAMASK == 2 .OR. NICESEAMASK == 3) THEN
     IF (ZCI > RSCACLI) THEN
        ROBHDR(KCURRPO,MDBRST) = ZCHSTAT_REJECT( ROBHDR(KCURRPO,MDBRST))
        ROBHDR(KCURRPO,MDBREV1) = ZCHEV1( ROBHDR(KCURRPO,MDBREV1),NR1EVENT(12))
        LLPRINT = .TRUE.
     ENDIF
  ENDIF
ENDIF
!*
!           4.10  INFORM

IF(LSCDPR .AND. LLPRINT) &
   &WRITE(NULOUT,'('' - WIND F.G. FLAG '',I1,'' FOR OBSTYP'',I2,&
   &'' AT LAT '',F6.2,'' LON '',F7.2,'' OBS '',&
   &(I3),''/'',(I3,1X),2(F7.2,1X),&
   &'' F.G. U/V '',2(F7.2,1X),'' ICE-SEA MASK '',(F6.2,1X))')&
   &IFLAG,IOBTYP,ZOBLAT,ZOBLON,IVARU,IVARV,ZU,ZV,ZUFG,ZVFG,ZCI
!*
!     ------------------------------------------------------------------

!        5.       RETURN
!                 ------
5 CONTINUE
IF (LHOOK) CALL DR_HOOK('FGWND',1,ZHOOK_HANDLE)
END SUBROUTINE FGWND
