Newer
Older
!MNH_LIC Copyright 1997-2018 CNRS, Meteo-France and Universite Paul Sabatier
!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
!MNH_LIC for details. version 1.
!-----------------------------------------------------------------

WAUTELET Philippe
committed
MODULE MODE_WRITE_SURF_MNH_TOOLS
IMPLICIT NONE

WAUTELET Philippe
committed
CONTAINS
SUBROUTINE PREPARE_METADATA_WRITE_SURF(HREC,HDIR,HCOMMENT,KGRID,KTYPE,KDIMS,HSUBR,TPFIELD)
!
USE MODE_FIELD, ONLY: FIND_FIELD_ID_FROM_MNHNAME, TFIELDDATA, TFIELDLIST, TYPECHAR, TYPEDATE, TYPELOG

WAUTELET Philippe
committed
USE MODE_MSG
!
CHARACTER(LEN=LEN_HREC),INTENT(IN) :: HREC ! name of the article to write
CHARACTER(LEN=2), INTENT(IN) :: HDIR ! Expected type of the data field (XX,XY,--...)
CHARACTER(LEN=100), INTENT(IN) :: HCOMMENT ! Comment string
INTEGER, INTENT(IN) :: KGRID ! Localization on the model grid
INTEGER, INTENT(IN) :: KTYPE ! Datatype
INTEGER, INTENT(IN) :: KDIMS ! Number of dimensions
CHARACTER(LEN=*), INTENT(IN) :: HSUBR ! name of the subroutine calling
TYPE(TFIELDDATA), INTENT(OUT) :: TPFIELD ! metadata of field
!
CHARACTER(LEN=32) :: YTXT
INTEGER :: IDX,IID, IRESP
LOGICAL :: GWARN

WAUTELET Philippe
committed
!
CALL FIND_FIELD_ID_FROM_MNHNAME(TRIM(HREC),IID,IRESP,ONOWARNING=.TRUE.)
IF (IRESP==0) THEN
TPFIELD = TFIELDLIST(IID)
!Modify and check CLONGNAME
IF (TRIM(TPFIELD%CLONGNAME)/=TRIM(HREC)) THEN
CALL PRINT_MSG(NVERB_WARNING,'IO',TRIM(HSUBR),'CLONGNAME different ('//TRIM(TPFIELD%CLONGNAME) &
//'/'//TRIM(HREC)//') than expected for article '//TRIM(HREC))
TPFIELD%CLONGNAME = TRIM(HREC)
END IF
!Modify and check CDIR
IF (TPFIELD%CDIR/=HDIR) THEN
CALL PRINT_MSG(NVERB_WARNING,'IO',TRIM(HSUBR),'CDIR different ('//TRIM(TPFIELD%CDIR) &
//'/'//TRIM(HDIR)//') than expected for article '//TRIM(HREC))
TPFIELD%CDIR = HDIR
END IF
!Modify and check CCOMMENT
IF (LEN_TRIM(HCOMMENT)/=0) THEN
IF (TRIM(TPFIELD%CCOMMENT)/=TRIM(HCOMMENT)) THEN
!Usually in SURFEX fields, units are given at the end of the comment and between parenthesis
!Neglect that part of the comment for comparison
IDX = INDEX(HCOMMENT,'(',BACK=.TRUE.)
IF (IDX/=0) THEN
IF (TRIM(TPFIELD%CCOMMENT)/=TRIM(HCOMMENT(1:IDX-1))) THEN
GWARN = .TRUE.
ELSE
GWARN = .FALSE.
END IF
ELSE
GWARN = .TRUE.
END IF
IF (GWARN) THEN
CALL PRINT_MSG(NVERB_INFO,'IO',TRIM(HSUBR),'CCOMMENT different ('//TRIM(TPFIELD%CCOMMENT) &
//'/'//TRIM(HCOMMENT)//') than expected for article '//TRIM(HREC))
TPFIELD%CCOMMENT = TRIM(HCOMMENT)
END IF

WAUTELET Philippe
committed
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
END IF
ELSE
CALL PRINT_MSG(NVERB_DEBUG,'IO',TRIM(HSUBR),'CCOMMENT was empty -> replaced by TPFIELD%CCOMMENT for article ' &
//TRIM(HREC))
END IF
!Modify and check NGRID
IF (TPFIELD%NGRID/=KGRID) THEN
WRITE(YTXT,'( I0,"/",I0 )') TPFIELD%NGRID,KGRID
CALL PRINT_MSG(NVERB_WARNING,'IO',TRIM(HSUBR),'NGRID different ('//TRIM(YTXT) &
//') than expected for article '//TRIM(HREC))
TPFIELD%NGRID = KGRID
END IF
!Modify and check NTYPE
IF (TPFIELD%NTYPE/=KTYPE) THEN
WRITE(YTXT,'( I0,"/",I0 )') TPFIELD%NTYPE,KTYPE
CALL PRINT_MSG(NVERB_WARNING,'IO',TRIM(HSUBR),'NTYPE different ('//TRIM(YTXT) &
//') than expected for article '//TRIM(HREC))
TPFIELD%NTYPE = KTYPE
END IF
!Modify and check NDIMS
IF (TPFIELD%NDIMS/=KDIMS) THEN
WRITE(YTXT,'( I0,"/",I0 )') TPFIELD%NDIMS,KDIMS
CALL PRINT_MSG(NVERB_WARNING,'IO',TRIM(HSUBR),'NDIMS different ('//TRIM(YTXT) &
//') than expected for article '//TRIM(HREC))
TPFIELD%NDIMS = KDIMS
END IF
ELSE
CALL PRINT_MSG(NVERB_DEBUG,'IO',TRIM(HSUBR),TRIM(HREC)//' not found in FIELDLIST. Generating default metadata')
TPFIELD%CMNHNAME = TRIM(HREC)
TPFIELD%CSTDNAME = ''
TPFIELD%CLONGNAME = TRIM(HREC)
TPFIELD%CUNITS = ''
TPFIELD%CDIR = HDIR
TPFIELD%CCOMMENT = TRIM(HCOMMENT)
TPFIELD%NGRID = KGRID
TPFIELD%NTYPE = KTYPE
TPFIELD%NDIMS = KDIMS

WAUTELET Philippe
committed
#if 0
IF (TPFIELD%NDIMS==0 .OR. TPFIELD%NTYPE==TYPECHAR .OR. TPFIELD%NTYPE==TYPEDATE .OR. TPFIELD%NTYPE==TYPELOG) THEN
TPFIELD%LTIMEDEP = .FALSE.
ELSE
TPFIELD%LTIMEDEP = .TRUE.
END IF

WAUTELET Philippe
committed
#else
TPFIELD%LTIMEDEP = .FALSE.
#endif

WAUTELET Philippe
committed
END IF
!
END SUBROUTINE PREPARE_METADATA_WRITE_SURF
END MODULE MODE_WRITE_SURF_MNH_TOOLS
! #############################################################
SUBROUTINE WRITE_SURFX0_MNH(HREC,PFIELD,KRESP,HCOMMENT)
! #############################################################
!

WAUTELET Philippe
committed
!!**** *WRITEX0* - routine to write a real scalar
!!
!! PURPOSE
!! -------
!

WAUTELET Philippe
committed
! The purpose of WRITEX0 is
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
!
!!** METHOD
!! ------
!!
!! EXTERNAL
!! --------
!!
!!
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!!
!!
!! REFERENCE
!! ---------
!!
!!
!! AUTHOR
!! ------
!!
!! S.Malardel *METEO-FRANCE*
!!
!! MODIFICATIONS
!! -------------
!!
!! original 01/08/03
!! 06/08 P. Peyrille, V. Masson : change test for writing
!! YY, XY, DX, DY in 1D or 2D configuration
!! 03/09, G.Tanguy : add write_surft1_mnh
!! replace ZUNDEF(surfex) by XUNDEF(MNH)
!! 08/2015 M.Moge write the COVERS as 2D fields because SURFEX cannot write/read 3D fields
!! with Z-splitting using NB_PROC_IO_W / NB_PROC_IO_W
!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1
!! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
!----------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!

WAUTELET Philippe
committed
USE MODE_IO_WRITE_FIELD
USE MODE_FIELD, ONLY: TFIELDDATA,TYPEREAL
USE MODE_MSG

WAUTELET Philippe
committed
USE MODE_WRITE_SURF_MNH_TOOLS

WAUTELET Philippe
committed
USE MODD_CONF, ONLY: CPROGRAM

WAUTELET Philippe
committed
USE MODD_CONF_n, ONLY: CSTORAGE_TYPE

WAUTELET Philippe
committed
USE MODD_GRID

WAUTELET Philippe
committed
USE MODD_IO_ll, ONLY: TFILE_SURFEX
!
IMPLICIT NONE
!
!* 0.1 Declarations of arguments
!

WAUTELET Philippe
committed
CHARACTER(LEN=LEN_HREC),INTENT(IN) :: HREC ! name of the article to write
REAL, INTENT(IN) :: PFIELD ! the real scalar to write
INTEGER, INTENT(OUT) :: KRESP ! return-code if a problem appears
CHARACTER(LEN=100), INTENT(IN) :: HCOMMENT ! Comment string
!
!* 0.2 Declarations of local variables
!

WAUTELET Philippe
committed
CHARACTER(LEN=5) :: YMSG

WAUTELET Philippe
committed
INTEGER :: IID, IRESP

WAUTELET Philippe
committed
TYPE(TFIELDDATA) :: TZFIELD
!
!-------------------------------------------------------------------------------
!
CALL PRINT_MSG(NVERB_DEBUG,'IO','WRITE_SURFX0_MNH',TRIM(TFILE_SURFEX%CNAME)//': writing '//TRIM(HREC))

WAUTELET Philippe
committed
!
IF( ( HREC=='LAT0' .OR. HREC=='LON0' .OR. HREC=='RPK' .OR. HREC=='BETA' &
.OR. HREC=='LATORI'.OR. HREC=='LONORI' )&
.AND. CSTORAGE_TYPE/='PG' .AND. CSTORAGE_TYPE/='SU' ) THEN

WAUTELET Philippe
committed
CALL PRINT_MSG(NVERB_DEBUG,'IO','WRITE_SURFX0_MNH',TRIM(HREC)//' not written in file by externalized surface')

WAUTELET Philippe
committed
!
CALL PREPARE_METADATA_WRITE_SURF(HREC,'--',HCOMMENT,0,TYPEREAL,0,'WRITE_SURFX0_MNH',TZFIELD)

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,PFIELD,KRESP)

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
IF (TRIM(CPROGRAM)=='PGD') THEN
!Store these variables (necessary for PREP_PGD program when writing netCDF files)
SELECT CASE(TRIM(HREC))
CASE('LON0')
XLON0 = PFIELD
CASE('LAT0')
XLAT0 = PFIELD
CASE('BETA')
XBETA = PFIELD
CASE('RPK')
XRPK = PFIELD
CASE('LONORI')
XLONORI = PFIELD
CASE('LATORI')
XLATORI = PFIELD
CASE DEFAULT
!Nothing to do
END SELECT
END IF
!

WAUTELET Philippe
committed
IF (KRESP /=0) THEN
WRITE ( YMSG, '( I5 )' ) KRESP
CALL PRINT_MSG(NVERB_ERROR,'IO','WRITE_SURFX0_MNH','error when writing article '//TRIM(HREC)//' KRESP='//YMSG)
END IF
END IF
!-------------------------------------------------------------------------------
END SUBROUTINE WRITE_SURFX0_MNH
!
! #############################################################
SUBROUTINE WRITE_SURFX1_MNH(HREC,KL,PFIELD,KRESP,HCOMMENT,HDIR)
! #############################################################
!

WAUTELET Philippe
committed
!!**** *WRITEX1* - routine to fill a real 1D array for the externalised surface
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
!!
!! PURPOSE
!! -------
!
! The purpose of WRITE_SURFX1 is
!
!!** METHOD
!! ------
!!
!! EXTERNAL
!! --------
!!
!!
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!!
!!
!! REFERENCE
!! ---------
!!
!!
!! AUTHOR
!! ------
!!
!! S.Malardel *METEO-FRANCE*
!!
!! MODIFICATIONS
!! -------------
!!
!! original 01/08/03
!! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
!----------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!

WAUTELET Philippe
committed
USE MODE_IO_WRITE_FIELD

WAUTELET Philippe
committed
USE MODE_FIELD, ONLY: FIND_FIELD_ID_FROM_MNHNAME,TFIELDDATA,TFIELDLIST,TYPEREAL

WAUTELET Philippe
committed
USE MODE_MSG
USE MODE_TOOLS_ll

WAUTELET Philippe
committed
USE MODE_WRITE_SURF_MNH_TOOLS

WAUTELET Philippe
committed
USE MODD_CONF_n, ONLY: CSTORAGE_TYPE

WAUTELET Philippe
committed
USE MODD_GRID_n, ONLY: XXHAT, XYHAT

WAUTELET Philippe
committed
USE MODD_IO_ll, ONLY: TFILE_SURFEX

WAUTELET Philippe
committed
USE MODD_IO_SURF_MNH, ONLY :NMASK, CMASK, &

WAUTELET Philippe
committed
NIU, NJU, NIB, NJB, NIE, NJE, &
NIU_ALL, NJU_ALL, NIB_ALL, NJB_ALL, &
NIE_ALL, NJE_ALL, NMASK_ALL, NHALO
USE MODD_PARAMETERS, ONLY: XUNDEF, JPHEXT

WAUTELET Philippe
committed
USE MODI_UNPACK_1D_2D
!
IMPLICIT NONE
!
!* 0.1 Declarations of arguments
!

WAUTELET Philippe
committed
CHARACTER(LEN=LEN_HREC),INTENT(IN) :: HREC ! name of the article to write
INTEGER, INTENT(IN) :: KL ! number of points
REAL, DIMENSION(KL), INTENT(IN) :: PFIELD ! array containing the data field
INTEGER, INTENT(OUT) :: KRESP ! return-code if a problem appears
CHARACTER(LEN=100), INTENT(IN) :: HCOMMENT ! Comment string
CHARACTER(LEN=1), INTENT(IN) :: HDIR ! type of field :
! ! 'H' : field with
! ! horizontal spatial dim.
! ! 'A' : entire field with
! ! horizontal spatial dim. :
! ! It is not distributed on
! ! the processors
! ! '-' : no horizontal dim.
!
!* 0.2 Declarations of local variables
!
INTEGER :: J1D ! loop counter
INTEGER :: JILOOP,JJLOOP ! loop indexes

WAUTELET Philippe
committed
!
REAL, DIMENSION(:,:), ALLOCATABLE :: ZWORK ! work array written in the file
REAL, DIMENSION(:), ALLOCATABLE :: ZW1D ! 1D work array
!

WAUTELET Philippe
committed
INTEGER :: IID, IRESP
INTEGER :: IIU, IJU, IIB, IJB, IIE, IJE ! dimensions of horizontal fields
INTEGER, DIMENSION(:), ALLOCATABLE :: IMASK ! mask for unpacking

WAUTELET Philippe
committed
REAL :: ZUNDEF ! undefined value in SURFEX
!
CHARACTER(LEN=5) :: YMSG
TYPE(TFIELDDATA) :: TZFIELD
!-------------------------------------------------------------------------------
!
CALL PRINT_MSG(NVERB_DEBUG,'IO','WRITE_SURFX1_MNH',TRIM(TFILE_SURFEX%CNAME)//': writing '//TRIM(HREC))

WAUTELET Philippe
committed
!
!* 1. Special cases with no writing
! -----------------------------------
!
IF( HREC=='LAT' &
.OR. HREC=='LON' &
.OR. HREC=='MESH_SIZE' &
.OR. HREC=='DX' &
.OR. HREC=='DY' ) THEN

WAUTELET Philippe
committed
CALL PRINT_MSG(NVERB_DEBUG,'IO','WRITE_SURFX1_MNH',TRIM(HREC)//' with mask '// &
TRIM(CMASK)//' not written in file by externalized surface')
RETURN
!
ELSE IF( ( (CSTORAGE_TYPE/='PG' .AND. CSTORAGE_TYPE/='SU') &
.OR. CMASK/='FULL ') &
.AND. ( HREC=='ZS' .OR. HREC=='XX' .OR. HREC=='YY') ) THEN

WAUTELET Philippe
committed
CALL PRINT_MSG(NVERB_DEBUG,'IO','WRITE_SURFX1_MNH',TRIM(HREC)//' with mask '// &
TRIM(CMASK)//' not written in file by externalized surface')
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
RETURN
!
END IF
!
!* 2. Ecriture
! --------------
!
!
IF (HDIR=='A') THEN
IIU = NIU_ALL
IJU = NJU_ALL
IIB = NIB_ALL
IJB = NJB_ALL
IIE = NIE_ALL
IJE = NJE_ALL
ALLOCATE(IMASK(SIZE(NMASK_ALL)))
IMASK = NMASK_ALL
ELSE
IIU = NIU+2*NHALO
IJU = NJU+2*NHALO
IIB = NIB
IJB = NJB
IIE = NIE+2*NHALO
IJE = NJE+2*NHALO
ALLOCATE(IMASK(SIZE(NMASK)))
IMASK = NMASK
END IF
!
ALLOCATE(ZWORK(IIU,IJU))
ZWORK(:,:) = XUNDEF
!
IF (HDIR=='H' .OR. HDIR=='A') THEN
CALL UNPACK_1D_2D(IMASK,PFIELD,ZWORK(IIB:IIE,IJB:IJE))
IF ( HREC=='ZS' ) THEN
IF (LWEST_ll()) THEN
DO JILOOP = 1,JPHEXT
ZWORK(JILOOP,:) = ZWORK(IIB,:)
END DO
END IF
IF (LEAST_ll()) THEN
DO JILOOP = IIU-JPHEXT+1,IIU
ZWORK(JILOOP,:)=ZWORK(IIU-JPHEXT,:)
END DO
END IF
IF (LSOUTH_ll()) THEN
DO JJLOOP = 1,JPHEXT
ZWORK(:,JJLOOP)=ZWORK(:,IJB)
END DO
END IF
IF (LNORTH_ll()) THEN
DO JJLOOP =IJU-JPHEXT+1,IJU
ZWORK(:,JJLOOP)=ZWORK(:,IJU-JPHEXT)
END DO
END IF
END IF
END IF
CALL GET_SURF_UNDEF(ZUNDEF)
WHERE (ZWORK==ZUNDEF) ZWORK=XUNDEF
!
!! Add cases in 2D (IJB=IJE) and 1D (IJB=IJE and IIB=IIE)
!! to write the correct mesh
IF ( (CSTORAGE_TYPE=='PG' .OR. CSTORAGE_TYPE=='SU') &
.AND. CMASK=='FULL ' .AND. (HREC=='XX' .OR. HREC=='DX') ) THEN
ALLOCATE(ZW1D(IIU))
IF (IIB<IIE .AND. HREC=='XX') THEN
ZW1D(IIB+1:IIE) = 0.5 * ZWORK(IIB:IIE-1,1+JPHEXT) + 0.5 * ZWORK(IIB+1:IIE,1+JPHEXT)
ZW1D(IIB) = 1.5 * ZWORK(IIB ,1+JPHEXT) - 0.5 * ZWORK(IIB+1 ,1+JPHEXT)
DO J1D=JPHEXT,1,-1
ZW1D( J1D) = 2. * ZW1D(J1D+1) - ZW1D(J1D+2)
ZW1D(IIU+1-J1D) = 2. * ZW1D(IIU-J1D) - ZW1D(IIU-J1D-1)
END DO
ELSE IF (IIB==IIE .AND. HREC=='DX') THEN
ZW1D(IIB-1) = - 0.5 * ZWORK(IIB,1+JPHEXT)
ZW1D(IIB) = 0.5 * ZWORK(IIB,1+JPHEXT)
ZW1D(IIB+1) = 1.5 * ZWORK(IIB,1+JPHEXT)
END IF
!

WAUTELET Philippe
committed
IF (HDIR=='A') THEN

WAUTELET Philippe
committed
CALL FIND_FIELD_ID_FROM_MNHNAME('XHAT',IID,IRESP)
TZFIELD = TFIELDLIST(IID)
TZFIELD%CDIR = '--'

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,ZW1D(:),KRESP)

WAUTELET Philippe
committed
END IF
IF (HDIR=='H') THEN

WAUTELET Philippe
committed
CALL FIND_FIELD_ID_FROM_MNHNAME('XHAT',IID,IRESP)
CALL IO_WRITE_FIELD(TFILE_SURFEX,TFIELDLIST(IID),ZW1D(1+NHALO:IIU-NHALO),KRESP)

WAUTELET Philippe
committed
IF (.NOT. (ASSOCIATED(XXHAT))) THEN
!Store XXHAT if not yet done (necessary for PREP_PGD program when writing netCDF files)
ALLOCATE(XXHAT(IIU-2*NHALO))
XXHAT(:) = ZW1D(1+NHALO:IIU-NHALO)
END IF

WAUTELET Philippe
committed
END IF
DEALLOCATE(ZW1D)
ELSE IF ( (CSTORAGE_TYPE=='PG' .OR. CSTORAGE_TYPE=='SU') &
.AND. CMASK=='FULL ' .AND. (HREC=='YY' .OR. HREC=='DY') ) THEN
ALLOCATE(ZW1D(IJU))
IF (IJB<IJE .AND. HREC=='YY') THEN
ZW1D(IJB+1:IJE) = 0.5 * ZWORK(1+JPHEXT,IJB:IJE-1) + 0.5 * ZWORK(1+JPHEXT,IJB+1:IJE)
ZW1D(IJB) = 1.5 * ZWORK(1+JPHEXT,IJB ) - 0.5 * ZWORK(1+JPHEXT,IJB+1 )
DO J1D=JPHEXT,1,-1
ZW1D( J1D) = 2. * ZW1D(J1D+1) - ZW1D(J1D+2)
ZW1D(IJU+1-J1D) = 2. * ZW1D(IJU-J1D) - ZW1D(IJU-J1D-1)
END DO
ELSE IF (IJB==IJE .AND. (HREC=='DY' .OR. HREC=='YY')) THEN
ZW1D(IJB-1) = - 0.5 * ZWORK(1+JPHEXT,IJB)
ZW1D(IJB) = 0.5 * ZWORK(1+JPHEXT,IJB)
ZW1D(IJB+1) = 1.5 * ZWORK(1+JPHEXT,IJB)
END IF

WAUTELET Philippe
committed
IF (HDIR=='A') THEN

WAUTELET Philippe
committed
CALL FIND_FIELD_ID_FROM_MNHNAME('YHAT',IID,IRESP)
TZFIELD = TFIELDLIST(IID)
TZFIELD%CDIR = '--'

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,ZW1D(:),KRESP)

WAUTELET Philippe
committed
END IF
IF (HDIR=='H') THEN

WAUTELET Philippe
committed
CALL FIND_FIELD_ID_FROM_MNHNAME('YHAT',IID,IRESP)
CALL IO_WRITE_FIELD(TFILE_SURFEX,TFIELDLIST(IID),ZW1D(1+NHALO:IJU-NHALO),KRESP)

WAUTELET Philippe
committed
IF (.NOT. (ASSOCIATED(XYHAT))) THEN
!Store XYHAT if not yet done (necessary for PREP_PGD program when writing netCDF files)
ALLOCATE(XYHAT(IJU-2*NHALO))
XYHAT(:) = ZW1D(1+NHALO:IJU-NHALO)
END IF

WAUTELET Philippe
committed
END IF
DEALLOCATE(ZW1D)
ELSE IF (HDIR=='H') THEN

WAUTELET Philippe
committed
CALL PREPARE_METADATA_WRITE_SURF(HREC,'XY',HCOMMENT,4,TYPEREAL,2,'WRITE_SURFX1_MNH',TZFIELD)

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,ZWORK(1+NHALO:IIU-NHALO,1+NHALO:IJU-NHALO),KRESP)

WAUTELET Philippe
committed
CALL PREPARE_METADATA_WRITE_SURF(HREC,'--',HCOMMENT,4,TYPEREAL,2,'WRITE_SURFX1_MNH',TZFIELD)

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,ZWORK(:,:),KRESP)

WAUTELET Philippe
committed
CALL PREPARE_METADATA_WRITE_SURF(HREC,'--',HCOMMENT,4,TYPEREAL,1,'WRITE_SURFX1_MNH',TZFIELD)

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,PFIELD(:),KRESP)

WAUTELET Philippe
committed
IF (KRESP /=0) THEN
WRITE ( YMSG, '( I5 )' ) KRESP
CALL PRINT_MSG(NVERB_ERROR,'IO','WRITE_SURFX1_MNH','error when writing article '//TRIM(HREC)//' KRESP='//YMSG)
END IF
!
DEALLOCATE(ZWORK)
DEALLOCATE(IMASK)
!
!-------------------------------------------------------------------------------
END SUBROUTINE WRITE_SURFX1_MNH
!
! #############################################################
SUBROUTINE WRITE_SURFX2COV_MNH(HREC,KL1,KL2,PFIELD,OFLAG,KRESP,HCOMMENT,HDIR)
! #############################################################
!

WAUTELET Philippe
committed
!!**** *WRITEX1* - routine to fill a real 1D array for the externalised surface
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
!!
!! PURPOSE
!! -------
!
! The purpose of WRITE_SURFX1 is
!
!!** METHOD
!! ------
!!
!! EXTERNAL
!! --------
!!
!!
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!!
!!
!! REFERENCE
!! ---------
!!
!!
!! AUTHOR
!! ------
!!
!! S.Malardel *METEO-FRANCE*
!!
!! MODIFICATIONS
!! -------------
!!
!! original 01/08/03
!! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
!----------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!

WAUTELET Philippe
committed
USE MODE_IO_WRITE_FIELD
USE MODE_FIELD, ONLY: TFIELDDATA,TYPELOG,TYPEREAL
USE MODE_MSG
USE MODE_TOOLS_ll

WAUTELET Philippe
committed
USE MODE_WRITE_SURF_MNH_TOOLS

WAUTELET Philippe
committed
!
USE MODD_CONF_n, ONLY: CSTORAGE_TYPE
USE MODD_DATA_COVER_PAR,ONLY : JPCOVER
USE MODD_IO_ll, ONLY: TFILE_SURFEX

WAUTELET Philippe
committed
USE MODD_IO_SURF_MNH, ONLY :NMASK, CMASK, &

WAUTELET Philippe
committed
NIU, NJU, NIB, NJB, NIE, NJE, &
NIU_ALL, NJU_ALL, NIB_ALL, NJB_ALL, &
NIE_ALL, NJE_ALL, NMASK_ALL, NHALO
USE MODD_PARAMETERS, ONLY: XUNDEF, JPHEXT
!
USE MODI_GET_SURF_UNDEF
USE MODI_UNPACK_1D_2D
!
IMPLICIT NONE
!
!* 0.1 Declarations of arguments
!

WAUTELET Philippe
committed
CHARACTER(LEN=LEN_HREC), INTENT(IN) :: HREC ! name of the article to write
INTEGER, INTENT(IN) :: KL1,KL2 ! number of points
REAL, DIMENSION(KL1,KL2), INTENT(IN) :: PFIELD ! array containing the data field
LOGICAL,DIMENSION(:), INTENT(IN) :: OFLAG ! mask for array filling

WAUTELET Philippe
committed
INTEGER, INTENT(OUT) :: KRESP ! return-code if a problem appears
CHARACTER(LEN=100), INTENT(IN) :: HCOMMENT ! Comment string
CHARACTER(LEN=1), INTENT(IN) :: HDIR ! type of field :
! ! 'H' : field with
! ! horizontal spatial dim.
! ! 'A' : entire field with
! ! horizontal spatial dim. :
! ! It is not distributed on
! ! the processors
! ! '-' : no horizontal dim.
!
!* 0.2 Declarations of local variables
!
INTEGER :: J1D ! loop counter

WAUTELET Philippe
committed
!
REAL, DIMENSION(:,:), ALLOCATABLE :: ZWORK ! work array written in the file
!
INTEGER :: IIU, IJU, IIB, IJB, IIE, IJE ! dimensions of horizontal fields
INTEGER, DIMENSION(:), ALLOCATABLE :: IMASK ! mask for unpacking

WAUTELET Philippe
committed
REAL :: ZUNDEF ! undefined value in SURFEX
CHARACTER(LEN=2) :: YDIR
CHARACTER(LEN=LEN_HREC) :: YREC

WAUTELET Philippe
committed
!
!JUANZ
INTEGER :: NCOVER,ICOVER,IKL2, JL2
REAL,DIMENSION(:,:,:), ALLOCATABLE :: ZWORK3D
!JUANZ
LOGICAL :: GCOVER_PACKED ! .T. if cover fields are all packed together

WAUTELET Philippe
committed
!
CHARACTER(LEN=5) :: YMSG
TYPE(TFIELDDATA) :: TZFIELD
!-------------------------------------------------------------------------------
!
CALL PRINT_MSG(NVERB_DEBUG,'IO','WRITE_SURFX2COV_MNH',TRIM(TFILE_SURFEX%CNAME)//': writing '//TRIM(HREC))

WAUTELET Philippe
committed
!
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
!* 2. Ecriture
! --------------
!
IF (CMASK/='FULL') RETURN
!
IF (HDIR=='A') THEN
YDIR='--'
IIU = NIU_ALL
IJU = NJU_ALL
IIB = NIB_ALL
IJB = NJB_ALL
IIE = NIE_ALL
IJE = NJE_ALL
ALLOCATE(IMASK(SIZE(NMASK_ALL)))
IMASK = NMASK_ALL
ELSE
YDIR='XY'
IIU = NIU+2*NHALO
IJU = NJU+2*NHALO
IIB = NIB
IJB = NJB
IIE = NIE+2*NHALO
IJE = NJE+2*NHALO
ALLOCATE(IMASK(SIZE(NMASK)))
IMASK = NMASK
END IF
!
! we write the COVERS as 2D fields because SURFEX cannot write/read 3D fields
! with Z-splitting using NB_PROC_IO_W / NB_PROC_IO_W, so we do not use GCOVER_PACKED
!GCOVER_PACKED = ( NB_PROCIO_W /= 1 )
GCOVER_PACKED = .FALSE.

WAUTELET Philippe
committed
!
TZFIELD%CMNHNAME = 'COVER_PACKED'
TZFIELD%CSTDNAME = ''

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = 'COVER_PACKED'

WAUTELET Philippe
committed
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = ''
TZFIELD%NGRID = 0
TZFIELD%NTYPE = TYPELOG
TZFIELD%NDIMS = 0
TZFIELD%LTIMEDEP = .FALSE.

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,GCOVER_PACKED,KRESP)

WAUTELET Philippe
committed
!
IF (KRESP /=0) THEN
WRITE ( YMSG, '( I5 )' ) KRESP
CALL PRINT_MSG(NVERB_ERROR,'IO','WRITE_SURFX2COV_MNH','error when writing article '//TRIM(HREC)//' KRESP='//YMSG)
END IF
!
ALLOCATE(ZWORK(IIU,IJU))
ZWORK(:,:) = XUNDEF
NCOVER=COUNT(OFLAG)
ALLOCATE(ZWORK3D(IIU,IJU,NCOVER))
ZWORK3D = XUNDEF
!
ICOVER=0
DO IKL2=1,NCOVER
CALL UNPACK_1D_2D(IMASK,PFIELD(:,IKL2),ZWORK3D(IIB:IIE,IJB:IJE,IKL2))

WAUTELET Philippe
committed
!
IF (.NOT. GCOVER_PACKED) THEN
ICOVER=0

WAUTELET Philippe
committed
TZFIELD%CSTDNAME = ''
TZFIELD%CUNITS = ''
TZFIELD%CCOMMENT = TRIM(HCOMMENT)
TZFIELD%NGRID = 4
TZFIELD%NTYPE = TYPEREAL
TZFIELD%NDIMS = 2

WAUTELET Philippe
committed
TZFIELD%LTIMEDEP = .FALSE.
WRITE(YREC,'(A5,I3.3)') 'COVER',JL2

WAUTELET Philippe
committed
TZFIELD%CMNHNAME = TRIM(YREC)

WAUTELET Philippe
committed
TZFIELD%CLONGNAME = TRIM(YREC)

WAUTELET Philippe
committed
TZFIELD%CDIR = YDIR
IF (OFLAG(JL2)) THEN
ICOVER=ICOVER+1

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,ZWORK3D(1+NHALO:IIU-NHALO,1+NHALO:IJU-NHALO,ICOVER),KRESP)

WAUTELET Philippe
committed
CALL PREPARE_METADATA_WRITE_SURF(HREC,YDIR,HCOMMENT,4,TYPEREAL,3,'WRITE_SURFX2COV_MNH',TZFIELD)

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,ZWORK3D(1+NHALO:IIU-NHALO,1+NHALO:IJU-NHALO,:),KRESP)
END IF
!
DEALLOCATE(ZWORK3D)

WAUTELET Philippe
committed
!
IF (KRESP /=0) THEN
WRITE ( YMSG, '( I5 )' ) KRESP
CALL PRINT_MSG(NVERB_ERROR,'IO','WRITE_SURFX2COV_MNH','error when writing article '//TRIM(HREC)//' KRESP='//YMSG)
END IF
!
DEALLOCATE(ZWORK)
DEALLOCATE(IMASK)
!
!-------------------------------------------------------------------------------
END SUBROUTINE WRITE_SURFX2COV_MNH
!
! #############################################################
SUBROUTINE WRITE_SURFX2_MNH(HREC,KL1,KL2,PFIELD,KRESP,HCOMMENT,HDIR)
! #############################################################
!

WAUTELET Philippe
committed
!!**** *WRITEX2* - routine to fill a real 2D array for the externalised surface
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
!!
!! PURPOSE
!! -------
!
! The purpose of WRITE_SURFX2 is
!
!!** METHOD
!! ------
!!
!! EXTERNAL
!! --------
!!
!!
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!!
!!
!! REFERENCE
!! ---------
!!
!!
!! AUTHOR
!! ------
!!
!! S.Malardel *METEO-FRANCE*
!!
!! MODIFICATIONS
!! -------------
!!
!! original 01/08/03
!! G.TANGUY 03/2009 add replace ZUNDEF(surfex) by XUNDEF(MNH)
!! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
!----------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!

WAUTELET Philippe
committed
USE MODE_IO_WRITE_FIELD

WAUTELET Philippe
committed
USE MODE_FIELD, ONLY: TFIELDDATA,TYPEREAL

WAUTELET Philippe
committed
USE MODE_MSG
USE MODE_TOOLS_ll

WAUTELET Philippe
committed
USE MODE_WRITE_SURF_MNH_TOOLS

WAUTELET Philippe
committed
USE MODD_CONF_n, ONLY: CSTORAGE_TYPE
USE MODD_DATA_COVER_PAR,ONLY : JPCOVER
USE MODD_IO_ll, ONLY: TFILE_SURFEX

WAUTELET Philippe
committed
USE MODD_IO_SURF_MNH, ONLY :NMASK, CMASK, &

WAUTELET Philippe
committed
NIU, NJU, NIB, NJB, NIE, NJE, &
NIU_ALL, NJU_ALL, NIB_ALL, NJB_ALL, &
NIE_ALL, NJE_ALL, NMASK_ALL, NHALO
USE MODD_PARAMETERS, ONLY: XUNDEF

WAUTELET Philippe
committed
USE MODI_UNPACK_1D_2D
!
IMPLICIT NONE
!
!* 0.1 Declarations of arguments
!

WAUTELET Philippe
committed
CHARACTER(LEN=LEN_HREC), INTENT(IN) :: HREC ! name of the article to write
INTEGER, INTENT(IN) :: KL1,KL2 ! number of points
REAL, DIMENSION(KL1,KL2), INTENT(IN) :: PFIELD ! array containing the data field
INTEGER, INTENT(OUT) :: KRESP ! return-code if a problem appears
CHARACTER(LEN=100), INTENT(IN) :: HCOMMENT ! Comment string
CHARACTER(LEN=1), INTENT(IN) :: HDIR ! type of field :
! ! 'H' : field with
! ! horizontal spatial dim.
! ! 'A' : entire field with
! ! horizontal spatial dim. :
! ! It is not distributed on
! ! the processors
! ! '-' : no horizontal dim.
!
!* 0.2 Declarations of local variables
!

WAUTELET Philippe
committed
REAL, DIMENSION(:,:,:), ALLOCATABLE :: ZWORK ! work array written in the file
REAL, DIMENSION(:,:), ALLOCATABLE :: ZFIELD ! work array written in the file
!
INTEGER :: IIU, IJU, IIB, IJB, IIE, IJE ! dimensions of horizontal fields

WAUTELET Philippe
committed
INTEGER, DIMENSION(:), ALLOCATABLE :: IMASK ! mask for unpacking
REAL :: ZUNDEF ! undefined value in SURFEX
!
CHARACTER(LEN=5) :: YMSG
TYPE(TFIELDDATA) :: TZFIELD
!-------------------------------------------------------------------------------
!
CALL PRINT_MSG(NVERB_DEBUG,'IO','WRITE_SURFX2_MNH',TRIM(TFILE_SURFEX%CNAME)//': writing '//TRIM(HREC))

WAUTELET Philippe
committed
!
IF (HDIR=='A') THEN
IIU = NIU_ALL
IJU = NJU_ALL
IIB = NIB_ALL
IJB = NJB_ALL
IIE = NIE_ALL
IJE = NJE_ALL
ALLOCATE(IMASK(SIZE(NMASK_ALL)))
IMASK = NMASK_ALL
ELSE
IIU = NIU+2*NHALO
IJU = NJU+2*NHALO
IIB = NIB
IJB = NJB
IIE = NIE+2*NHALO
IJE = NJE+2*NHALO
ALLOCATE(IMASK(SIZE(NMASK)))
IMASK = NMASK
END IF
!
CALL GET_SURF_UNDEF(ZUNDEF)

WAUTELET Philippe
committed
!
IF (HDIR=='H' .OR. HDIR=='A') THEN
ALLOCATE(ZWORK(IIU,IJU,SIZE(PFIELD,2)))
ZWORK(:,:,:) = XUNDEF
CALL UNPACK_1D_2D(NMASK,PFIELD(:,:),ZWORK(IIB:IIE,IJB:IJE,:))
WHERE (ZWORK==ZUNDEF) ZWORK=XUNDEF

WAUTELET Philippe
committed
!
IF (HDIR=='H') THEN

WAUTELET Philippe
committed
CALL PREPARE_METADATA_WRITE_SURF(HREC,'XY',HCOMMENT,4,TYPEREAL,3,'WRITE_SURFX2_MNH',TZFIELD)

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,ZWORK(1+NHALO:IIU-NHALO,1+NHALO:IJU-NHALO,:),KRESP)

WAUTELET Philippe
committed
END IF
IF (HDIR=='A') THEN

WAUTELET Philippe
committed
CALL PREPARE_METADATA_WRITE_SURF(HREC,'--',HCOMMENT,4,TYPEREAL,3,'WRITE_SURFX2_MNH',TZFIELD)

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,ZWORK(:,:,:),KRESP)

WAUTELET Philippe
committed
END IF
!
DEALLOCATE(ZWORK)
DEALLOCATE(IMASK)
ELSE IF (HDIR=='-') THEN
ALLOCATE(ZFIELD(KL1,KL2))
ZFIELD=PFIELD
WHERE (ZFIELD==ZUNDEF) ZFIELD=XUNDEF

WAUTELET Philippe
committed
!

WAUTELET Philippe
committed
CALL PREPARE_METADATA_WRITE_SURF(HREC,'--',HCOMMENT,4,TYPEREAL,2,'WRITE_SURFX2_MNH',TZFIELD)

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,ZFIELD(:,:),KRESP)

WAUTELET Philippe
committed
!
DEALLOCATE(ZFIELD)
END IF
!
IF (KRESP /=0) THEN

WAUTELET Philippe
committed
WRITE ( YMSG, '( I5 )' ) KRESP
CALL PRINT_MSG(NVERB_ERROR,'IO','WRITE_SURFX2_MNH','error when writing article '//TRIM(HREC)//' KRESP='//YMSG)
END IF
!
!-------------------------------------------------------------------------------
END SUBROUTINE WRITE_SURFX2_MNH
!
! #############################################################
SUBROUTINE WRITE_SURFN0_MNH(HREC,KFIELD,KRESP,HCOMMENT)
! #############################################################
!

WAUTELET Philippe
committed
!!**** *WRITEN0* - routine to write an integer
!!
!! PURPOSE
!! -------
!

WAUTELET Philippe
committed
! The purpose of WRITEN0 is
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
!
!!** METHOD
!! ------
!!
!! EXTERNAL
!! --------
!!
!!
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!!
!!
!! REFERENCE
!! ---------
!!
!!
!! AUTHOR
!! ------
!!
!! S.Malardel *METEO-FRANCE*
!!
!! MODIFICATIONS
!! -------------
!!
!! original 01/08/03
!! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
!----------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!

WAUTELET Philippe
committed
USE MODE_IO_WRITE_FIELD
USE MODE_FIELD, ONLY: TFIELDDATA,TYPEINT
USE MODE_MSG

WAUTELET Philippe
committed
USE MODE_WRITE_SURF_MNH_TOOLS

WAUTELET Philippe
committed
USE MODD_CONF_n, ONLY: CSTORAGE_TYPE
USE MODD_IO_ll, ONLY: TFILE_SURFEX

WAUTELET Philippe
committed
USE MODD_IO_SURF_MNH, ONLY: NIU_ALL, NJU_ALL

WAUTELET Philippe
committed
USE MODD_PARAMETERS, ONLY: JPHEXT
IMPLICIT NONE
!
!* 0.1 Declarations of arguments
!

WAUTELET Philippe
committed
CHARACTER(LEN=LEN_HREC),INTENT(IN) :: HREC ! name of the article to write
INTEGER, INTENT(IN) :: KFIELD ! the integer to write
INTEGER, INTENT(OUT) :: KRESP ! return-code if a problem appears
CHARACTER(LEN=100), INTENT(IN) :: HCOMMENT ! Comment string
!
!* 0.2 Declarations of local variables
!

WAUTELET Philippe
committed
INTEGER :: IFIELD
TYPE(TFIELDDATA) :: TZFIELD
CHARACTER(LEN=5) :: YMSG
!-------------------------------------------------------------------------------
!
CALL PRINT_MSG(NVERB_DEBUG,'IO','WRITE_SURFN0_MNH',TRIM(TFILE_SURFEX%CNAME)//': writing '//TRIM(HREC))

WAUTELET Philippe
committed
!
IF( (HREC=='IMAX' .OR. HREC=='JMAX' .OR. HREC=='KMAX') .AND. &
CSTORAGE_TYPE/='PG' .AND. CSTORAGE_TYPE/='SU' ) THEN

WAUTELET Philippe
committed
CALL PRINT_MSG(NVERB_DEBUG,'IO','WRITE_SURFN0_MNH',TRIM(HREC)//' not written in file by externalized surface')

WAUTELET Philippe
committed
ELSE IF (HREC=='VERSION' .OR. HREC=='BUG') THEN
!Field is in fieldlist
CALL IO_WRITE_FIELD(TFILE_SURFEX,HREC,KFIELD,KRESP)
IF (HREC=='IMAX') IFIELD = NIU_ALL-2*JPHEXT
IF (HREC=='JMAX') IFIELD = NJU_ALL-2*JPHEXT

WAUTELET Philippe
committed
CALL PREPARE_METADATA_WRITE_SURF(HREC,'--',HCOMMENT,0,TYPEINT,0,'WRITE_SURFN0_MNH',TZFIELD)

WAUTELET Philippe
committed
CALL IO_WRITE_FIELD(TFILE_SURFEX,TZFIELD,IFIELD,KRESP)

WAUTELET Philippe
committed
END IF
!
IF (KRESP /=0) THEN
WRITE ( YMSG, '( I5 )' ) KRESP
CALL PRINT_MSG(NVERB_ERROR,'IO','WRITE_SURFN0_MNH','error when writing article '//TRIM(HREC)//' KRESP='//YMSG)
END IF
!
!-------------------------------------------------------------------------------
END SUBROUTINE WRITE_SURFN0_MNH
!
! #############################################################
SUBROUTINE WRITE_SURFN1_MNH(HREC,KL,KFIELD,KRESP,HCOMMENT,HDIR)
! #############################################################
!

WAUTELET Philippe
committed
!!**** *WRITEN0* - routine to write an integer
!!
!! PURPOSE
!! -------
!

WAUTELET Philippe
committed
! The purpose of WRITEN0 is
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
!
!!** METHOD
!! ------
!!
!! EXTERNAL
!! --------
!!
!!
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!!
!!
!! REFERENCE
!! ---------
!!
!!
!! AUTHOR
!! ------
!!
!! S.Malardel *METEO-FRANCE*
!!
!! MODIFICATIONS
!! -------------
!!
!! original 01/08/03
!! Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
!----------------------------------------------------------------------------
!
!* 0. DECLARATIONS
! ------------
!

WAUTELET Philippe
committed
USE MODE_IO_WRITE_FIELD
USE MODE_FIELD, ONLY: TFIELDDATA,TYPEINT
USE MODE_MSG

WAUTELET Philippe
committed
USE MODE_WRITE_SURF_MNH_TOOLS

WAUTELET Philippe
committed
USE MODD_IO_ll, ONLY: TFILE_SURFEX

WAUTELET Philippe
committed
USE MODD_IO_SURF_MNH, ONLY: NMASK, CMASK, &

WAUTELET Philippe
committed
NIU, NJU, NIB, NJB, NIE, NJE
USE MODD_PARAMETERS, ONLY: NUNDEF
!
USE MODI_UNPACK_1D_2D
!
IMPLICIT NONE
!