SUBROUTINE WMOVIEH

!**** *WMOVIEH* -

!     Purpose.
!     --------
!        Write Header of movies file

!**   Interface.
!     ----------
!        *CALL* *WMOVIEH

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

!     Author.
!     -------
!        Pascal Lamboley *METEO-FRANCE*

!     Modifications.
!     --------------
!        Original : 92-10-08
!        Modified : 97-08-06 P. Lamboley : Harpe format 4.2
!        Modified : 98-03-13 VALPARAISO
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!     ------------------------------------------------------------------

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

USE YOMLUN   , ONLY : NULOUT   ,NPPPSH
USE YOMDIM   , ONLY : NDGLG    ,NDLON    ,NDGUNG   ,NDGUXG   ,&
 & NDLUNG   ,NDLUXG   ,NFLEVG   ,NSMAX    ,&
 & NDGSAG   ,NDGENG  
USE YOMCT0   , ONLY : LELAM
USE YOMOP    , ONLY : NCADFORM
USE YOMGEM   , ONLY : NLOENG   ,NSTTYP   ,RMUCEN   ,RLOCEN   ,RSTRET
USE YOMLEG   , ONLY : RLATIG
USE YOMRIP   , ONLY : NINDAT   ,NSSSSS
USE YEMGEO   , ONLY : ERPK     ,EDELX   ,EDELY  ,&
 & ELONC    ,ELATC    ,ELON1    ,ELAT1    ,ELON2    ,&
 & ELAT2    ,ELON0    ,ELAT0    ,LMAP     ,LMRT
USE YOMCST   , ONLY : RA

IMPLICIT NONE

!     EXTERNAL INTEGER FUNCTIONS
CHARACTER ::  CLMOD*4

INTEGER(KIND=JPIM) ::  IDEB, IFIN, IUSED, IVERS
REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "ewrimova.intfb.h"
#include "wrimova.intfb.h"

IF (LHOOK) CALL DR_HOOK('WMOVIEH',0,ZHOOK_HANDLE)
Write (NulOut,*) 'WMOVIEH : Writing header, unit=',npppsh

IF (.NOT.LELAM) THEN
  CLMOD='ARP '
  IUSED=1
  IVERS=42
  CALL WRIMOVA(IVERS, CLMOD, IUSED,NINDAT,NSSSSS,NSTTYP,RSTRET,&
   & RLOCEN,RMUCEN,NDLON,NDGLG,NSMAX,NFLEVG,&
   & RLATIG,NLOENG,NDGSAG,NDGENG,NpppSh)  
ELSE
  IF(NCADFORM == 0) THEN
    CLMOD='ALA '
  ELSE
    CLMOD='AL1 '
  ENDIF
  IUSED=0
  IVERS=42
  IDEB=NDLUXG-NDLUNG+1
  IFIN=NDGUXG-NDGUNG+1

  CALL EWRIMOVA(IVERS, CLMOD, IUSED,NINDAT,NSSSSS,NSTTYP,&
   & NSMAX,NFLEVG,IDEB,IFIN,LMAP,&
   & ERPK,ELON0,ELAT0,ELONC,ELATC,LMRT,EDELX,EDELY,&
   & ELON1,ELAT1,ELON2,ELAT2,RA,NpppSh)  

ENDIF

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

