Skip to content

Commit

Permalink
correct calendar for track netcdf output (NOAA-EMC#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelaccensi authored Sep 22, 2023
1 parent 8589d12 commit 7bbdaca
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 63 deletions.
42 changes: 26 additions & 16 deletions model/src/ww3_trnc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ PROGRAM W3TRNC
! ----------------------------------------------------------------
! W3NMOD Subr. W3GDATMD Set number of model.
! W3NOUT Subr. W3ODATMD Set number of model for output.
! W3IOGR Subr. W3IOGRMD Reading/writing model definition file.
! ----------------------------------------------------------------
!
! 5. Called by :
Expand All @@ -70,13 +71,14 @@ PROGRAM W3TRNC
!/ ------------------------------------------------------------------- /
USE CONSTANTS

USE W3GDATMD, ONLY : W3NMOD, W3SETG, FLAGLL, XFR
USE W3GDATMD, ONLY : W3NMOD, W3SETG, FLAGLL, XFR, GNAME
USE W3ODATMD, ONLY : W3NOUT, W3SETO, FNMPRE
USE W3SERVMD, ONLY : ITRACE, NEXTLN, EXTCDE
#ifdef W3_S
USE W3SERVMD, ONLY : STRACE
#endif
USE W3TIMEMD
USE W3IOGRMD, ONLY: W3IOGR
!
USE W3ODATMD, ONLY: NDSO, NDSE
!
Expand All @@ -91,7 +93,7 @@ PROGRAM W3TRNC
TYPE(NML_TRACK_T) :: NML_TRACK
TYPE(NML_FILE_T) :: NML_FILE
!
INTEGER :: NDSI, NDSINP, &
INTEGER :: NDSI, NDSINP, NDSM, &
NDSOUT, NDSTRC, NTRACE, &
NSPEC, IERR, MK, MTH, IT, &
ILOC, ISPEC, S3, IOUT, &
Expand Down Expand Up @@ -135,6 +137,7 @@ PROGRAM W3TRNC
! 1. IO set-up.
!
NDSI = 10
NDSM = 20
NDSINP = 11
NDSOUT = 51
!
Expand All @@ -148,11 +151,16 @@ PROGRAM W3TRNC
!
WRITE (NDSO,900)
!
!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! 2. Read model definition file.
!
CALL W3IOGR ( 'READ', NDSM )
WRITE (NDSO,920) GNAME


!
!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! 2. Read requests from input file.
! 3. Read requests from input file.
!

!
Expand All @@ -163,13 +171,13 @@ PROGRAM W3TRNC
! Read namelist
CALL W3NMLTRNC (NDSI, TRIM(FNMPRE)//'ww3_trnc.nml', NML_TRACK, NML_FILE, IERR)

! 2.1 Time setup IDTIME, DTREQ, NOUT
! 3.1 Time setup IDTIME, DTREQ, NOUT
READ(NML_TRACK%TIMESTRIDE, *) DTREQ
READ(NML_TRACK%TIMECOUNT, *) NOUT
READ(NML_TRACK%TIMESTART, *) TOUT(1), TOUT(2)


! 2.2 Output type
! 3.2 Output type
NCTYPE = NML_FILE%NETCDF
FILEPREFIX = NML_FILE%PREFIX
S3 = NML_TRACK%TIMESPLIT
Expand All @@ -189,12 +197,12 @@ PROGRAM W3TRNC
WRITE (NDSO,901) COMSTR


! 2.1 Time setup IDTIME, DTREQ, NOUT
! 3.1 Time setup IDTIME, DTREQ, NOUT
CALL NEXTLN ( COMSTR , NDSI , NDSE )
READ (NDSI,*,END=806,ERR=807) TOUT, DTREQ, NOUT


! 2.2 Output type
! 3.2 Output type
CALL NEXTLN ( COMSTR , NDSI , NDSE )
READ (NDSI,*,END=806,ERR=807) NCTYPE
CALL NEXTLN ( COMSTR , NDSI , NDSE )
Expand All @@ -208,7 +216,7 @@ PROGRAM W3TRNC



! 2.1 Time setup IDTIME, DTREQ, NOUT
! 3.3 Time setup IDTIME, DTREQ, NOUT
DTREQ = MAX ( 0. , DTREQ )
IF ( DTREQ.EQ.0. ) NOUT = 1
NOUT = MAX ( 1 , NOUT )
Expand All @@ -227,7 +235,7 @@ PROGRAM W3TRNC
WRITE (NDSO,941) IDTIME, NOUT


! 2.2 Output type
! 3.4 Output type
IF ( NCTYPE.LT.3 .OR. NCTYPE.GT.4 ) THEN
WRITE (NDSE,1010) NCTYPE
CALL EXTCDE ( 1 )
Expand All @@ -239,7 +247,7 @@ PROGRAM W3TRNC

!
!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! 3. Check consistency with input file and track_o.ww3
! 4. Check consistency with input file and track_o.ww3
!
OPEN (NDSINP,FILE=TRIM(FNMPRE)//'track_o.ww3',form='UNFORMATTED', convert=file_endian, &
STATUS='OLD',ERR=800,IOSTAT=IERR)
Expand All @@ -262,7 +270,7 @@ PROGRAM W3TRNC

!
!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! 4. Time management.
! 5. Time management.
!
IOUT = 0
NCID = 0
Expand All @@ -271,7 +279,7 @@ PROGRAM W3TRNC
BACKSPACE (NDSINP)


! 4.1 Loops on track_o.ww3 to read the time and data
! 5.1 Loops on track_o.ww3 to read the time and data
DO
DTEST = DSEC21 ( TIME , TOUT )

Expand Down Expand Up @@ -310,17 +318,17 @@ PROGRAM W3TRNC
END IF


! 4.1.1 Increments the global time counter IOUT
! 5.1.1 Increments the global time counter IOUT
IOUT = IOUT + 1
CALL STME21 ( TOUT , IDTIME )
WRITE (NDSO,971) IDTIME


! 4.1.2 Processes the variable value for the time step IOUT
! 5.1.2 Processes the variable value for the time step IOUT
CALL W3EXNC ( FILEPREFIX, NCTYPE, NCID, S3, STRSTOPDATE, MK, MTH )


! 4.1.3 Defines the stop date
! 5.1.3 Defines the stop date
CALL T2D(TOUT,STOPDATE,IERR)
WRITE(STRSTOPDATE,'(I4.4,A,4(I2.2,A),I2.2)') STOPDATE(1),'-',STOPDATE(2), &
'-',STOPDATE(3),' ',STOPDATE(5),':',STOPDATE(6),':',STOPDATE(7)
Expand All @@ -331,7 +339,7 @@ PROGRAM W3TRNC

444 CONTINUE

! 4.2 Closes the netCDF file
! 5.2 Closes the netCDF file
IF (NCID.NE.0) THEN
IRET = NF90_REDEF(NCID)
CALL CHECK_ERR(IRET)
Expand Down Expand Up @@ -383,6 +391,8 @@ PROGRAM W3TRNC
902 FORMAT ( ' Spectral grid size : ',I3,' by ',I3// &
' Opening file : '/ &
' -----------------------------------------------')
920 FORMAT ( ' Grid name : ',A/)
!
940 FORMAT (/' Output time data : '/ &
' --------------------------------------------------'/ &
' First time : ',A)
Expand Down
10 changes: 5 additions & 5 deletions regtests/ww3_tp2.2/input/track_i.ww3
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
WAVEWATCH III TRACK LOCATIONS DATA
19680606 000000 0 0 S1A
19680606 040000 1 0 S1B
19680606 060000 1 0 S1C
19680606 080000 2 0 S1D
19680606 120000 0.5 0 S1E
20220606 000000 0 0 S1A
20220606 040000 1 0 S1B
20220606 060000 1 0 S1C
20220606 080000 2 0 S1D
20220606 120000 0.5 0 S1E
14 changes: 7 additions & 7 deletions regtests/ww3_tp2.2/input/ww3_multi.inp
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ $ ------------------------------
$
'ww3' 'no' 'no' 'no' 'no' 'no' 'no' 'no' 'no' 'no' 1 1 0.00 1.00 F
$
19680606 000000 19680618 000000
20220606 000000 20220618 000000
$
T T
$
19680606 000000 86400 19680618 000000
20220606 000000 86400 20220618 000000
$
N
HS T0M1 DIR SPR
$
19680606 000000 21600 19680618 000000
20220606 000000 21600 20220618 000000
0.0 0.0 'LEFT'
90.0 0.0 'CENTER'
180.0 0.0 'RIGHT'
0.0 0.0 'STOPSTRING'
19680606 000000 3600 19680618 000000
20220606 000000 3600 20220618 000000
T
19680612 000000 0 19680612 000000
19680606 000000 3600 19680618 000000
19680612 000000 0 19680612 000000
20220612 000000 0 20220612 000000
20220606 000000 3600 20220618 000000
20220612 000000 0 20220612 000000
$
'the_end' 0
$
Expand Down
11 changes: 6 additions & 5 deletions regtests/ww3_tp2.2/input/ww3_multi.nml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
&DOMAIN_NML
DOMAIN%FLGHG1 = T
DOMAIN%FLGHG2 = T
DOMAIN%STOP = '19680618 000000'
DOMAIN%START = '20220606 000000'
DOMAIN%STOP = '20220618 000000'
/

! -------------------------------------------------------------------- !
Expand Down Expand Up @@ -37,10 +38,10 @@
! Define output dates via OUTPUT_DATE_NML namelist
! -------------------------------------------------------------------- !
&OUTPUT_DATE_NML
ALLDATE%FIELD = '19680606 000000' '86400' '19680618 000000'
ALLDATE%POINT = '19680606 000000' '21600' '19680618 000000'
ALLDATE%TRACK = '19680606 000000' '3600' '19680618 000000'
ALLDATE%BOUNDARY = '19680606 000000' '3600' '19680618 000000'
ALLDATE%FIELD = '20220606 000000' '86400' '20220618 000000'
ALLDATE%POINT = '20220606 000000' '21600' '20220618 000000'
ALLDATE%TRACK = '20220606 000000' '3600' '20220618 000000'
ALLDATE%BOUNDARY = '20220606 000000' '3600' '20220618 000000'
/

! -------------------------------------------------------------------- !
Expand Down
2 changes: 1 addition & 1 deletion regtests/ww3_tp2.2/input/ww3_ounf.inp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $--------------------------------------------------------------------- $
$ First output time (yyyymmdd hhmmss), increment of output (s),
$ and number of output times.
$
19680606 000000 10800. 100
20220606 000000 10800. 100
$
$ Fields requested --------------------------------------------------- $
$
Expand Down
2 changes: 1 addition & 1 deletion regtests/ww3_tp2.2/input/ww3_ounf.nml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
! Define the output fields to postprocess via FIELD_NML namelist
! -------------------------------------------------------------------- !
&FIELD_NML
FIELD%TIMESTART = '19680606 000000'
FIELD%TIMESTART = '20220606 000000'
FIELD%TIMESTRIDE = '10800.'
FIELD%TIMECOUNT = '100'
FIELD%LIST = 'HS T01 DIR SPR'
Expand Down
2 changes: 1 addition & 1 deletion regtests/ww3_tp2.2/input/ww3_ounp.inp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $--------------------------------------------------------------------- $
$ First output time (yyyymmdd hhmmss), increment of output (s),
$ and number of output times.
$
19680606 000000 21600. 1000
20220606 000000 21600. 1000
$
$ Points requested --------------------------------------------------- $
$
Expand Down
2 changes: 1 addition & 1 deletion regtests/ww3_tp2.2/input/ww3_ounp.nml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
! Define the output fields to postprocess via POINT_NML namelist
! -------------------------------------------------------------------- !
&POINT_NML
POINT%TIMESTART = '19680606 000000'
POINT%TIMESTART = '20220606 000000'
POINT%TIMESTRIDE = '21600.'
POINT%TIMECOUNT = '1000'
POINT%LIST = '1 2 3'
Expand Down
2 changes: 1 addition & 1 deletion regtests/ww3_tp2.2/input/ww3_outf.inp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ WAVEWATCH III Grid output post-processing
$ -----------------------------------------
19680612 000000 518400. 2
20220612 000000 518400. 2
$
N
HS T01 DIR SPR
Expand Down
2 changes: 1 addition & 1 deletion regtests/ww3_tp2.2/input/ww3_outp_spec.inp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ WAVEWATCH III Point output post-processing
$ ------------------------------------------
19680606 000000 43200. 25
20220606 000000 43200. 25
$
1
2
Expand Down
2 changes: 1 addition & 1 deletion regtests/ww3_tp2.2/input/ww3_outp_tab51.inp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ WAVEWATCH III Point output post-processing
$ ------------------------------------------
19680606 000000 43200. 25
20220606 000000 43200. 25
$
1
-1
Expand Down
2 changes: 1 addition & 1 deletion regtests/ww3_tp2.2/input/ww3_outp_tab52.inp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ WAVEWATCH III Point output post-processing
$ ------------------------------------------
19680606 000000 43200. 25
20220606 000000 43200. 25
$
2
-1
Expand Down
2 changes: 1 addition & 1 deletion regtests/ww3_tp2.2/input/ww3_outp_tab53.inp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ WAVEWATCH III Point output post-processing
$ ------------------------------------------
19680606 000000 43200. 25
20220606 000000 43200. 25
$
3
-1
Expand Down
24 changes: 12 additions & 12 deletions regtests/ww3_tp2.2/input/ww3_shel.inp
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ $ ------------------------------
F
F
$
19680606 000000
19680606 120000
20220606 000000
20220606 120000
$
1
$
19680606 000000 10800 19680608 000000
20220606 000000 10800 20220608 000000
$
N
HS EF T01 DIR SPR
$
19680606 000000 21600 19680608 000000
20220606 000000 21600 20220608 000000
0.0 0.0 'LEFT'
90.0 0.0 'CENTER'
180.0 0.0 'RIGHT'
0.0 0.0 'STOPSTRING'
19680606 000000 14400 19680608 000000
20220606 000000 14400 20220608 000000
T
19680606 000000 0 19680608 000000
19680606 000000 0 19680608 000000
19680606 000000 0 19680608 000000
20220606 000000 0 20220608 000000
20220606 000000 0 20220608 000000
20220606 000000 0 20220608 000000
$
'CUR' 19680606 030000 2.0 45.
'WND' 19680606 000000 20.0 180. 2.
'WND' 19680606 040000 15.0 130. 1.
'WND' 19680606 080000 25.0 90. 3.
'CUR' 20220606 030000 2.0 45.
'WND' 20220606 000000 20.0 180. 2.
'WND' 20220606 040000 15.0 130. 1.
'WND' 20220606 080000 25.0 90. 3.
'STP'
$
$ -------------------------------------------------------------------- $
Expand Down
Loading

0 comments on commit 7bbdaca

Please sign in to comment.