Newer
Older

WAUTELET Philippe
committed
!MNH_LIC Copyright 1996-2020 CNRS, Meteo-France and Universite Paul Sabatier
!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence

WAUTELET Philippe
committed
!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
!MNH_LIC for details. version 1.
!-----------------------------------------------------------------
module mode_write_diachro
implicit none
private
public :: Write_diachro
contains
! #################################################################
SUBROUTINE WRITE_DIACHRO(TPDIAFILE,HGROUP,HTYPE, &
KGRID, tpdates, PVAR, &
HTITRE,HUNITE,HCOMMENT,OICP,OJCP,OKCP,KIL,KIH,KJL,KJH,KKL,KKH, &
PTRAJX,PTRAJY,PTRAJZ )
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
! #################################################################
!
!!**** *WRITE_DIACHRO* - Ecriture d'un enregistrement dans un fichier
!! diachronique (de nom de base HGROUP)
!!
!! PURPOSE
!! -------
!
!
!!** METHOD
!! ------
!! En fait pour un groupe donne HGROUP, on ecrit systematiquement
! plusieurs enregistrements :
! - 1: HGROUP.TYPE (type d'informations a enregistrer)
! - 2: HGROUP.DIM (dimensions de toutes les matrices a
! enregistrer)
! - 3: HGROUP.TITRE (Nom des processus)
! - 4: HGROUP.UNITE (Unites pour chaque processus)
! - 5: HGROUP.COMMENT (Champ commentaire pour chaque processus)
! - 6: HGROUP.TRAJT (Temps)
! - 7: HGROUP.PROCx (Champ traite . 1 enr./ 1 processus)
! - 8: HGROUP.DATIM (Les differentes dates du modele)
! et pour certains types d'informations on enregistre egalement
! des coordonnees (HGROUP.TRAJX, HGROUP.TRAJY, HGROUP.TRAJZ)
!!
!! EXTERNAL
!! --------
!! None
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module
!!
!! REFERENCE
!! ---------
!!
!!
!! AUTHOR
!! ------
!! J. Duron * Laboratoire d'Aerologie *
!!
!!
!! MODIFICATIONS
!! -------------
!! Original 08/01/96
!! Updated PM
!! Modification (N. Asencio) 18/06/99 : the two first dimensions of PMASK
!! are linked to the horizontal grid, FMWRIT is called with 'XY' argument.
!! In standard configuration of the budgets, the mask is written once
!! outside this routine with FMWRIT call. Its record name is 'MASK_nnnn.MASK'
!! So optional PMASK is not used .
!! Modification (J. Duron) 24/06/99 : add logical GPACK to disable the pack option,
!! add the initialization of the dimensions of
!! MASK array in MASK case with write outside the
!! routine.
!! J.Escobar 02/10/2015 modif for JPHEXT(JPVEXT) variable
!! D.Gazen+ G.Delautier 06/2016 modif for ncl files

WAUTELET Philippe
committed
!! P. Wautelet 09/06/2017: name of the variable added to the name of the written field
!! and better comment (true comment + units)
!! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O

WAUTELET Philippe
committed
! P. Wautelet 13/09/2019: budget: simplify and modernize date/time management
! P. Wautelet 13/09/2019: remove never used PMASK optional dummy-argument
! P. Wautelet 28/08/2020: remove TPLUOUTDIA dummy argument
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!
USE MODD_BUDGET
use modd_conf, only: lpack

WAUTELET Philippe
committed
use modd_field, only: tfielddata, TYPECHAR, TYPEDATE, TYPEINT, TYPEREAL

WAUTELET Philippe
committed
USE MODD_IO, ONLY: TFILEDATA
USE MODD_PARAMETERS, ONLY: JPHEXT

WAUTELET Philippe
committed
use modd_time, only: tdtexp, tdtseg
use modd_time_n, only: tdtmod
use modd_type_date, only: date_time

WAUTELET Philippe
committed
use mode_datetime, only: Datetime_distance

WAUTELET Philippe
committed
USE MODE_IO_FIELD_WRITE, only: IO_Field_write, IO_Field_write_box
use mode_menu_diachro, only: MENU_DIACHRO

WAUTELET Philippe
committed
use mode_msg
!
IMPLICIT NONE
!
!* 0.1 Dummy arguments
! ---------------
TYPE(TFILEDATA), INTENT(IN) :: TPDIAFILE ! file to write
CHARACTER(LEN=*), INTENT(IN) :: HGROUP, HTYPE
INTEGER,DIMENSION(:), INTENT(IN) :: KGRID

WAUTELET Philippe
committed
type(date_time), dimension(:), intent(in) :: tpdates
REAL,DIMENSION(:,:,:,:,:,:), INTENT(IN) :: PVAR
CHARACTER(LEN=*),DIMENSION(:),INTENT(IN) :: HTITRE, HUNITE, HCOMMENT
LOGICAL, INTENT(IN),OPTIONAL :: OICP, OJCP, OKCP
INTEGER, INTENT(IN),OPTIONAL :: KIL, KIH
INTEGER, INTENT(IN),OPTIONAL :: KJL, KJH
INTEGER, INTENT(IN),OPTIONAL :: KKL, KKH
REAL,DIMENSION(:,:,:), INTENT(IN),OPTIONAL :: PTRAJX
REAL,DIMENSION(:,:,:), INTENT(IN),OPTIONAL :: PTRAJY
REAL,DIMENSION(:,:,:), INTENT(IN),OPTIONAL :: PTRAJZ
!
!* 0.1 Local variables
! ---------------
CHARACTER(LEN=20) :: YCOMMENT
CHARACTER(LEN=3) :: YJ

WAUTELET Philippe
committed
INTEGER :: ILENG, ILENTITRE, ILENUNITE, ILENCOMMENT

WAUTELET Philippe
committed
INTEGER :: II, IJ, IK, IT, IN, IP, J, JJ
INTEGER :: INTRAJT, IKTRAJX, IKTRAJY, IKTRAJZ
INTEGER :: ITTRAJX, ITTRAJY, ITTRAJZ
INTEGER :: INTRAJX, INTRAJY, INTRAJZ
INTEGER :: IIMASK, IJMASK, IKMASK, ITMASK, INMASK, IPMASK
INTEGER :: ICOMPX, ICOMPY, ICOMPZ
INTEGER :: IIMAX_ll, IJMAX_ll ! size of the physical global domain

WAUTELET Philippe
committed
integer :: ji
INTEGER,DIMENSION(:),ALLOCATABLE :: ITABCHAR

WAUTELET Philippe
committed
logical :: gicp, gjcp, gkcp

WAUTELET Philippe
committed
real, dimension(:,:), allocatable :: ztimes
real, dimension(:,:), allocatable :: zdatime
TYPE(TFIELDDATA) :: TZFIELD
!------------------------------------------------------------------------------

WAUTELET Philippe
committed

WAUTELET Philippe
committed
call Print_msg( NVERB_DEBUG, 'BUD', 'Write_diachro', 'called' )

WAUTELET Philippe
committed
if ( present( oicp ) ) then
gicp = oicp
else
gicp = .false.
end if
if ( present( ojcp ) ) then
gjcp = ojcp
else
gjcp = .false.
end if
if ( present( okcp ) ) then
gkcp = okcp
else
gkcp = .false.
end if
GPACK=LPACK
LPACK=.FALSE.
YCOMMENT='NOTHING'
!

WAUTELET Philippe
committed
II = SIZE(PVAR,1)
IJ = SIZE(PVAR,2)
IF(HTYPE == 'CART' .AND. .NOT. GICP .AND. .NOT. GJCP) THEN
!for parallel execution, PVAR is distributed on several proc

WAUTELET Philippe
committed
II=KIH-KIL+1
IJ=KJH-KJL+1
ENDIF
IK = SIZE(PVAR,3)
IT = SIZE(PVAR,4)
IN = SIZE(PVAR,5)
IP = SIZE(PVAR,6)

WAUTELET Philippe
committed
INTRAJT=SIZE(tpdates)
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
IKTRAJX=0; IKTRAJY=0; IKTRAJZ=0
ITTRAJX=0; ITTRAJY=0; ITTRAJZ=0
INTRAJX=0; INTRAJY=0; INTRAJZ=0
IF(PRESENT(PTRAJX))THEN
IKTRAJX=SIZE(PTRAJX,1)
ITTRAJX=SIZE(PTRAJX,2)
INTRAJX=SIZE(PTRAJX,3)
ENDIF
IF(PRESENT(PTRAJY))THEN
IKTRAJY=SIZE(PTRAJY,1)
ITTRAJY=SIZE(PTRAJY,2)
INTRAJY=SIZE(PTRAJY,3)
ENDIF
IF(PRESENT(PTRAJZ))THEN
IKTRAJZ=SIZE(PTRAJZ,1)
ITTRAJZ=SIZE(PTRAJZ,2)
INTRAJZ=SIZE(PTRAJZ,3)
ENDIF
IIMASK=0; IJMASK=0; IKMASK=0; ITMASK=0; INMASK=0; IPMASK=0
IF(HTYPE == 'MASK')THEN
! MASK is written outside this routine but the dimensions must be initialized
! the mask is defined on the extended domain
CALL GET_GLOBALDIMS_ll (IIMAX_ll,IJMAX_ll)
IIMASK=IIMAX_ll + 2 * JPHEXT
IJMASK=IJMAX_ll + 2 * JPHEXT
IKMASK=1
ITMASK=NBUWRNB
INMASK=NBUMASK
IPMASK=1
ENDIF
ILENTITRE = LEN(HTITRE)
ILENUNITE = LEN(HUNITE)
ILENCOMMENT = LEN(HCOMMENT)
ICOMPX=0; ICOMPY=0; ICOMPZ=0

WAUTELET Philippe
committed
IF ( GICP ) THEN
ICOMPX = 1
ELSE
ICOMPX = 0

WAUTELET Philippe
committed
IF ( GJCP ) THEN
ICOMPY = 1
ELSE
ICOMPY = 0

WAUTELET Philippe
committed
IF ( GKCP ) THEN

WAUTELET Philippe
committed
ELSE
ICOMPZ = 0
ENDIF
!
!
! 1er enregistrement TYPE
!
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.TYPE'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(HGROUP)//'.TYPE'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(YCOMMENT)
TZFIELD%NGRID = KGRID(1)
TZFIELD%NTYPE = TYPECHAR
TZFIELD%NDIMS = 0
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
CALL IO_Field_write(TPDIAFILE,TZFIELD,HTYPE)
!
! 2eme enregistrement DIMENSIONS des MATRICES et LONGUEUR des TABLEAUX de CARACTERES et FLAGS de COMPRESSION sur les DIFFERENTS AXES
!
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.DIM'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(HGROUP)//'.DIM'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(YCOMMENT)
TZFIELD%NGRID = KGRID(1)
TZFIELD%NTYPE = TYPEINT
TZFIELD%NDIMS = 1
TZFIELD%LTIMEDEP = .FALSE.
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
SELECT CASE(HTYPE)
CASE('CART','MASK','SPXY')
ILENG = 34
ALLOCATE(ITABCHAR(ILENG))
ITABCHAR(1)=ILENTITRE; ITABCHAR(2)=ILENUNITE
ITABCHAR(3)=ILENCOMMENT; ITABCHAR(4)=II
ITABCHAR(5)=IJ; ITABCHAR(6)=IK
ITABCHAR(7)=IT; ITABCHAR(8)=IN
ITABCHAR(9)=IP; ITABCHAR(10)=KIL
ITABCHAR(11)=KJL; ITABCHAR(12)=KKL
ITABCHAR(13)=KIH; ITABCHAR(14)=KJH
ITABCHAR(15)=KKH; ITABCHAR(16)=ICOMPX
ITABCHAR(17)=ICOMPY; ITABCHAR(18)=ICOMPZ
IF(HTYPE == 'MASK')THEN
! ITABCHAR(10)=1; ITABCHAR(11)=1
! ITABCHAR(13)=1; ITABCHAR(14)=1
ITABCHAR(16)=1; ITABCHAR(17)=1
ENDIF
ITABCHAR(19)=INTRAJT; ITABCHAR(20)=IKTRAJX
ITABCHAR(21)=IKTRAJY; ITABCHAR(22)=IKTRAJZ
ITABCHAR(23)=ITTRAJX; ITABCHAR(24)=ITTRAJY
ITABCHAR(25)=ITTRAJZ; ITABCHAR(26)=INTRAJX
ITABCHAR(27)=INTRAJY; ITABCHAR(28)=INTRAJZ
ITABCHAR(29)=IIMASK; ITABCHAR(30)=IJMASK
ITABCHAR(31)=IKMASK; ITABCHAR(32)=ITMASK
ITABCHAR(33)=INMASK; ITABCHAR(34)=IPMASK

WAUTELET Philippe
committed
CALL IO_Field_write(TPDIAFILE,TZFIELD,ITABCHAR)
DEALLOCATE(ITABCHAR)
CASE DEFAULT
ILENG = 25
ALLOCATE(ITABCHAR(ILENG))
ITABCHAR(1)=ILENTITRE; ITABCHAR(2)=ILENUNITE
ITABCHAR(3)=ILENCOMMENT; ITABCHAR(4)=II
ITABCHAR(5)=IJ; ITABCHAR(6)=IK
ITABCHAR(7)=IT; ITABCHAR(8)=IN
ITABCHAR(9)=IP
ITABCHAR(10)=INTRAJT; ITABCHAR(11)=IKTRAJX
ITABCHAR(12)=IKTRAJY; ITABCHAR(13)=IKTRAJZ
ITABCHAR(14)=ITTRAJX; ITABCHAR(15)=ITTRAJY
ITABCHAR(16)=ITTRAJZ; ITABCHAR(17)=INTRAJX
ITABCHAR(18)=INTRAJY; ITABCHAR(19)=INTRAJZ
ITABCHAR(20)=IIMASK; ITABCHAR(21)=IJMASK
ITABCHAR(22)=IKMASK; ITABCHAR(23)=ITMASK
ITABCHAR(24)=INMASK; ITABCHAR(25)=IPMASK

WAUTELET Philippe
committed
CALL IO_Field_write(TPDIAFILE,TZFIELD,ITABCHAR)
DEALLOCATE(ITABCHAR)
END SELECT
!
! 3eme enregistrement TITRE
!
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.TITRE'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(HGROUP)//'.TITRE'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(YCOMMENT)
TZFIELD%NGRID = KGRID(1)
TZFIELD%NTYPE = TYPECHAR
TZFIELD%NDIMS = 1
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
CALL IO_Field_write(TPDIAFILE,TZFIELD,HTITRE(1:IP))
!
! 4eme enregistrement UNITE
!
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.UNITE'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(HGROUP)//'.UNITE'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(YCOMMENT)
TZFIELD%NGRID = KGRID(1)
TZFIELD%NTYPE = TYPECHAR
TZFIELD%NDIMS = 1
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
CALL IO_Field_write(TPDIAFILE,TZFIELD,HUNITE(1:IP))
!
! 5eme enregistrement COMMENT
!
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.COMMENT'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(HGROUP)//'.COMMENT'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(YCOMMENT)
TZFIELD%NGRID = KGRID(1)
TZFIELD%NTYPE = TYPECHAR
TZFIELD%NDIMS = 1
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
CALL IO_Field_write(TPDIAFILE,TZFIELD,HCOMMENT(1:IP))
!
! 6eme enregistrement PVAR
!
! Dans la mesure ou cette matrice risque d'etre tres volumineuse, on ecrira un
! enregistrement par processus
!!!!!!!!!!!!!!!! FUJI compiler directive !!!!!!!!!!
!ocl scalar
!!!!!!!!!!!!!!!! FUJI compiler directive !!!!!!!!!!
DO J = 1,IP
YJ = ' '
IF(J < 10)WRITE(YJ,'(I1)')J ; YJ = ADJUSTL(YJ)
IF(J >= 10 .AND. J < 100) THEN
WRITE(YJ,'(I2)')J ; YJ = ADJUSTL(YJ)
ELSE IF(J >= 100 .AND. J < 1000) THEN
WRITE(YJ,'(I3)')J
ENDIF

WAUTELET Philippe
committed
IF(HTYPE == 'CART' .AND. .NOT. GICP .AND. .NOT. GJCP) THEN
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.PROC'//YJ

WAUTELET Philippe
committed
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(TZFIELD%CMNHNAME)

WAUTELET Philippe
committed
TZFIELD%CUNITS = TRIM(HUNITE(J))

WAUTELET Philippe
committed
TZFIELD%CDIR = 'XY'
TZFIELD%CCOMMENT = TRIM(HTITRE(J))//' - '//TRIM(HCOMMENT(J))//' ('//TRIM(HUNITE(J))//')'

WAUTELET Philippe
committed
TZFIELD%NGRID = KGRID(J)
TZFIELD%NTYPE = TYPEREAL
TZFIELD%NDIMS = 5
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
CALL IO_Field_write_BOX(TPDIAFILE,TZFIELD,'BUDGET',PVAR(:,:,:,:,:,J), &

WAUTELET Philippe
committed
KIL+JPHEXT,KIH+JPHEXT,KJL+JPHEXT,KJH+JPHEXT)
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.PROC'//YJ
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(TZFIELD%CMNHNAME)

WAUTELET Philippe
committed
TZFIELD%CUNITS = TRIM(HUNITE(J))
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(HTITRE(J))//' - '//TRIM(HCOMMENT(J))//' ('//TRIM(HUNITE(J))//')'
TZFIELD%NGRID = KGRID(J)
TZFIELD%NTYPE = TYPEREAL
TZFIELD%NDIMS = 5
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
CALL IO_Field_write(TPDIAFILE,TZFIELD,PVAR(:,:,:,:,:,J))
ENDIF
ENDDO
!
! 7eme enregistrement TRAJT
!
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.TRAJT'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(HGROUP)//'.TRAJT'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(YCOMMENT)
TZFIELD%NGRID = KGRID(1)
TZFIELD%NTYPE = TYPEREAL
TZFIELD%NDIMS = 2
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
!Reconstitute old diachro format
allocate( ztimes( size( tpdates ), 1 ) )
do ji=1,size(tpdates)
call Datetime_distance( tdtexp, tpdates(ji ), ztimes(ji, 1 ) )
end do
call IO_Field_write( tpdiafile, tzfield, ztimes )
deallocate( ztimes )
!
! Dans certains cas
!
!
! 8eme enregistrement TRAJX
!
IF(PRESENT(PTRAJX))THEN
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.TRAJX'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(HGROUP)//'.TRAJX'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(YCOMMENT)
TZFIELD%NGRID = KGRID(1)
TZFIELD%NTYPE = TYPEREAL
TZFIELD%NDIMS = 3
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
CALL IO_Field_write(TPDIAFILE,TZFIELD,PTRAJX)
ENDIF
!
! 9eme enregistrement TRAJY
!
IF(PRESENT(PTRAJY))THEN
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.TRAJY'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(HGROUP)//'.TRAJY'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(YCOMMENT)
TZFIELD%NGRID = KGRID(1)
TZFIELD%NTYPE = TYPEREAL
TZFIELD%NDIMS = 3
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
CALL IO_Field_write(TPDIAFILE,TZFIELD,PTRAJY)
ENDIF
!
! 10eme enregistrement TRAJZ
!
IF(PRESENT(PTRAJZ))THEN
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.TRAJZ'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(HGROUP)//'.TRAJZ'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(YCOMMENT)
TZFIELD%NGRID = KGRID(1)
TZFIELD%NTYPE = TYPEREAL
TZFIELD%NDIMS = 3
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
CALL IO_Field_write(TPDIAFILE,TZFIELD,PTRAJZ)
ENDIF
!
! 11eme enregistrement PDATIME
!
TZFIELD%CMNHNAME = TRIM(HGROUP)//'.DATIM'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(HGROUP)//'.DATIM'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = TRIM(YCOMMENT)
TZFIELD%NGRID = KGRID(1)
TZFIELD%NTYPE = TYPEREAL
TZFIELD%NDIMS = 2
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
!Reconstitute old diachro format
allocate( zdatime( 16, size(tpdates) ) )
zdatime(1, : ) = tdtexp%tdate%year
zdatime(2, : ) = tdtexp%tdate%month
zdatime(3, : ) = tdtexp%tdate%day
zdatime(4, : ) = tdtexp%time
zdatime(5, : ) = tdtseg%tdate%year
zdatime(6, : ) = tdtseg%tdate%month
zdatime(7, : ) = tdtseg%tdate%day
zdatime(8, : ) = tdtseg%time
zdatime(9, : ) = tdtmod%tdate%year
zdatime(10, : ) = tdtmod%tdate%month
zdatime(11, : ) = tdtmod%tdate%day
zdatime(12, : ) = tdtmod%time
zdatime(13, : ) = tpdates(:)%tdate%year
zdatime(14, : ) = tpdates(:)%tdate%month
zdatime(15, : ) = tpdates(:)%tdate%day
zdatime(16, : ) = tpdates(:)%time
call IO_Field_write( tpdiafile, tzfield, zdatime )
deallocate( zdatime )
CALL MENU_DIACHRO(TPDIAFILE,HGROUP)
LPACK=GPACK
!-----------------------------------------------------------------------------
!
!* 2. EXITS
! -----
!
RETURN
END SUBROUTINE WRITE_DIACHRO
end module mode_write_diachro