Skip to content

Commit

Permalink
retreiving the point output prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
AliS-Noaa committed Feb 20, 2025
1 parent 2c8a1ff commit aaf7fa2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions model/inp/ww3_outp.inp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ $ WAVEWATCH III Point output post-processing $
$--------------------------------------------------------------------- $
$ First output time (yyyymmdd hhmmss), increment of output (s),
$ and number of output times, optional per-time-step (1) or single (0)
$ point output
$ point output, optional point output prefix
$
19680606 060000 3600. 7 1
19680606 060000 3600. 7 1 gfswave
$
$ Points requested --------------------------------------------------- $
$ Define points for which output is to be generated.
Expand Down
25 changes: 18 additions & 7 deletions model/src/ww3_outp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ PROGRAM W3OUTP
CHARACTER(LEN=25) :: IDSRCE(7)
CHARACTER :: HSTR*6, HTYPE*3
CHARACTER(LEN=256) :: LINEIN
CHARACTER(LEN=32) :: WORDS(5)
CHARACTER(LEN=32) :: WORDS(6)
CHARACTER(LEN=32) :: prefix
INTEGER :: dynpnt
LOGICAL :: PROCESS_POINT_ONLY
INTEGER :: ACTIVE_POINT, J_START, J_END
Expand All @@ -287,6 +288,7 @@ PROGRAM W3OUTP
FLSRCE = .FALSE.

! Default values
prefix = "" ! Default to empty for point output prefix
dynpnt = 0 ! Default value for point output nameing
!
#ifdef W3_NCO
Expand Down Expand Up @@ -369,7 +371,7 @@ PROGRAM W3OUTP
!
!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! 3. Read general data and first fields from file
! Output time, time step, number of steps, optional dynpnt
! Output time, time step, number of steps, optional dynpnt and prefix
!
CALL NEXTLN ( COMSTR , NDSI , NDSE )
WORDS = ''
Expand All @@ -380,10 +382,19 @@ PROGRAM W3OUTP
READ(WORDS(3), *, IOSTAT=IERR) DTREQ
READ(WORDS(4), *, IOSTAT=IERR) NOUT
IF (WORDS(5) /= '') READ(WORDS(5), *, IOSTAT=IERR) dynpnt
IF (WORDS(6) /= '') prefix = TRIM(WORDS(6))

DTREQ = MAX ( 0. , DTREQ )
IF ( DTREQ.EQ.0 ) NOUT = 1
NOUT = MAX ( 1 , NOUT )

prefix = TRIM(ADJUSTL(prefix))
! Ensure prefix ends with a dot
IF (LEN_TRIM(prefix) > 0) THEN
prefix = TRIM(prefix) // '.'
END IF
!

IF (dynpnt == 0) THEN
#if W3_BIN2NC
CALL W3IOPON ( 'READ', NDSOP, IOTEST )
Expand Down Expand Up @@ -551,7 +562,7 @@ PROGRAM W3OUTP
WRITE (NDSO,943) 'Transfer file for each point'
DO IJ = 1, NOPTS
IF (FLREQ(IJ)) THEN
TFNAME = TRIM(PTNME(IJ))//'.spec'
TFNAME = TRIM(prefix)//TRIM(PTNME(IJ))//'.spec'
WRITE (NDSO,1943) TRIM(TFNAME), 'Transfer File'
J = LEN_TRIM(FNMPRE)
IF (FLFORM) THEN
Expand Down Expand Up @@ -763,11 +774,11 @@ PROGRAM W3OUTP
DO IJ = 1,NOPTS
IF (FLREQ(IJ)) THEN
NDSBUL = NDSTAB + (IJ - 1)
OPEN(NDSBUL,FILE=TRIM(PTNME(IJ))//'.bull',ERR=803,IOSTAT=IERR)
OPEN(NDSBUL,FILE=TRIM(prefix)//TRIM(PTNME(IJ))//'.bull',ERR=803,IOSTAT=IERR)
WRITE (NDSO,1947) TRIM(PTNME(IJ))//'.bull'
#ifdef W3_NCO
NDSCBUL = NDSTAB + (IJ - 1) + NOPTS
OPEN(NDSCBUL,FILE=TRIM(PTNME(IJ))//'.cbull',ERR=803,IOSTAT=IERR)
OPEN(NDSCBUL,FILE=TRIM(prefix)//TRIM(PTNME(IJ))//'.cbull',ERR=803,IOSTAT=IERR)
WRITE (NDSO,1947) TRIM(PTNME(IJ))//'.cbull'
#endif
ENDIF
Expand Down Expand Up @@ -806,7 +817,7 @@ PROGRAM W3OUTP
NDSCBUL = NDSTAB + (IJ - 1) + NOPTS
#endif
NDSCSV = NDSTAB + (IJ - 1) + 2*NOPTS
OPEN(NDSCSV,FILE=TRIM(PTNME(IJ))//&
OPEN(NDSCSV,FILE=TRIM(prefix)//TRIM(PTNME(IJ))//&
'.csv',ERR=803,IOSTAT=IERR)
WRITE (NDSO,1947) TRIM(PTNME(IJ))//'.csv'
ENDIF
Expand Down Expand Up @@ -921,7 +932,7 @@ PROGRAM W3OUTP
IF (ITYPE .EQ. 1 .AND. OTYPE .EQ. 3 .AND. dynpnt .EQ. 1) THEN
DO IJ = 1, NOPTS
IF (FLREQ(IJ)) THEN
TFNAME = TRIM(PTNME(IJ))//'.spec'
TFNAME = TRIM(prefix)//TRIM(PTNME(IJ))//'.spec'
J = LEN_TRIM(FNMPRE)
IF (FLFORM) THEN
OPEN(NDSTAB, FILE=TRIM(TFNAME), STATUS='OLD', &
Expand Down
4 changes: 2 additions & 2 deletions regtests/ww3_ufs1.1/input_unstr/ww3_outp_bull.inp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ $ WAVEWATCH III Point output post-processing $
$--------------------------------------------------------------------- $
$ First output time (yyyymmdd hhmmss), increment of output (s),
$ and number of output times, optional per-time-step (1) or single (0)
$ point output
$ point output, optional point output prefix
$
20210401 000000 3600. 25 1
20210401 000000 3600. 25 1 gfswave
$
$ Points requested --------------------------------------------------- $
$ Define points for which output is to be generated.
Expand Down
4 changes: 2 additions & 2 deletions regtests/ww3_ufs1.1/input_unstr/ww3_outp_spec.inp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ $ WAVEWATCH III Point output post-processing $
$--------------------------------------------------------------------- $
$ First output time (yyyymmdd hhmmss), increment of output (s),
$ and number of output times, optional per-time-step (1) or single (0)
$ point output
$ point output, optional point output prefix
$
20210401 000000 3600. 25 1
20210401 000000 3600. 25 1 gfswave
$
$ Points requested --------------------------------------------------- $
$ Define points for which output is to be generated.
Expand Down
4 changes: 2 additions & 2 deletions regtests/ww3_ufs1.1/input_unstr/ww3_outp_tab.inp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ $ WAVEWATCH III Point output post-processing $
$--------------------------------------------------------------------- $
$ First output time (yyyymmdd hhmmss), increment of output (s),
$ and number of output times, optional per-time-step (1) or single (0)
$ point output
$ point output, optional point output prefix
$
20210401 000000 3600. 25 1
20210401 000000 3600. 25 1 gfswave
$
$ Points requested --------------------------------------------------- $
$ Define points for which output is to be generated.
Expand Down

0 comments on commit aaf7fa2

Please sign in to comment.