SUBROUTINE WVRG2XF(P_ZFLOCAL,K_NWVFIELDS,KGPTOT,KPROMA)

!**** *WVRG2XF*  - stores charnock parameter into work array 

!     Purpose.
!     --------
!                 stores charnock parameter into work array

!**   Interface.
!     ----------
!        *CALL* *WVRG2XF(ZFLOCAL,NWVFIELDS)*

!        Explicit arguments : 
!        ------------------
!            ZFLOCAL   - The fields to be passed from WAVE to ATM
!                        It only contains the contribution for local
!                        grid points.
!            NWVFIELDS - Number of fields passed from WAVE to ATM

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

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

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

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

!     Author.
!     -------
!        LARS ISAKSEN *ECMWF*
!        JIM DOYLE

!     Modifications:
!     --------------
!        J. Bidlot  97-06-13: Use of the wave specific parts of the work array.
!        S. Abdalla 01-11-27: Generalised interface.
!        J. Bidlot  01-11-20: work only on local grid points.
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        D.Salmond     22-Nov-2005 Mods for coarser/finer physics
!        M.Hamrud      01-Jul-2006  Revised surface fields
!     ------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
USE SURFACE_FIELDS_MIX   ,ONLY : SD_WS, YSD_WS

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: K_NWVFIELDS 
REAL(KIND=JPRB)   ,INTENT(IN)    :: P_ZFLOCAL(KGPTOT,K_NWVFIELDS) 
INTEGER(KIND=JPIM),INTENT(IN)    :: KGPTOT
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMA
INTEGER(KIND=JPIM) :: IFLD

INTEGER(KIND=JPIM) :: IEND, IBL, IST, JROF, JSTGLO

REAL(KIND=JPRB) :: ZHOOK_HANDLE


IF (LHOOK) CALL DR_HOOK('WVRG2XF',0,ZHOOK_HANDLE)
CALL GSTATS(1426,0)
!$OMP PARALLEL DO SCHEDULE(STATIC)&
!$OMP&PRIVATE(JSTGLO,IST,IEND,IBL,IFLD,JROF)
DO JSTGLO=1,KGPTOT,KPROMA
  IST    = 1
  IEND   = MIN(KPROMA,KGPTOT-JSTGLO+1)
  IBL    = (JSTGLO-1)/KPROMA+1

  DO IFLD=1, K_NWVFIELDS
    DO JROF =IST,IEND
      SD_WS(JROF,YSD_WS%YWS(IFLD)%MP,IBL) = P_ZFLOCAL(JSTGLO+JROF-1,IFLD)
    ENDDO
  ENDDO
ENDDO
!$OMP END PARALLEL DO
CALL GSTATS(1426,1)

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

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