93 CHARACTER*34,
PARAMETER :: &
94 idtst =
'WAVEWATCH III TRACK OUTPUT SPECTRA'
96 INTEGER :: ndsi, ndsinp, &
97 ndsout, ndstrc, ntrace, nk, nth, &
98 nspec, ierr, mk, mth, &
99 nrec, iloc, ispec, time(2), ttst(2), &
100 ilast, nzero, ik, ith, iwzero, ich, &
103 INTEGER,
SAVE :: ient = 0
105 INTEGER :: lineln = 81
106 REAL :: th1, dth, x, y, dw, cx, cy, wx, wy, &
108 REAL :: scale = 0.001
110 REAL,
ALLOCATABLE :: sig(:), dsip(:), spec(:,:)
111 CHARACTER :: comstr*1, idstr*34, tststr*3, &
112 stime*23, string*81, empty*81, &
113 part*9, zeros*9, trckid*32
115 DATA empty(01:40) /
' ' /
116 DATA empty(41:81) /
' ' /
126 CALL w3seto ( 1, 6, 6 )
136 CALL itrace ( ndstrc, ntrace )
139 CALL strace ( ient,
'W3TRCK' )
145 OPEN (ndsi,
file=fnmpre(:j)//
'ww3_trck.inp',status=
'OLD', &
147 READ (ndsi,
'(A)',
END=806,ERR=807) comstr
148 IF (comstr.EQ.
' ') comstr =
'$'
149 WRITE (ndso,901) comstr
151 CALL nextln ( comstr , ndsi , ndse )
152 READ (ndsi,*,
END=806,ERR=807) NK, nth
154 WRITE (ndso,902) nk, nth
161 OPEN (ndsinp,
file=fnmpre(:j)//
'track_o.ww3',form=
'UNFORMATTED', convert=
file_endian, &
162 status=
'OLD',err=800,iostat=ierr)
163 READ (ndsinp,err=801,iostat=ierr) idstr, flagll, mk, mth, xfr
171 IF ( idstr .NE. idtst )
GOTO 810
172 IF ( nk.NE.mk .OR. nth.NE.mth )
GOTO 811
174 ALLOCATE ( sig(mk), dsip(mk), spec(mk,mth) )
176 READ (ndsinp,err=801,iostat=ierr) th1, dth, sig, dsip
183 OPEN (ndsout,
file=fnmpre(:j)//
'track.ww3', &
184 form=
'FORMATTED',err=802,iostat=ierr)
186 WRITE (ndsout,980,err=803,iostat=ierr) idstr
187 WRITE (ndsout,981,err=803,iostat=ierr) mk, mth, th1, dth
188 WRITE (ndsout,982,err=803,iostat=ierr) sig
189 WRITE (ndsout,983,err=803,iostat=ierr) dsip
196 READ (ndsinp,
END=444, ERR=801,IOSTAT=IERR) ttst
204 READ (ndsinp,
END=444, ERR=801,IOSTAT=IERR) TIME, X, Y, TSTSTR, &
207 WRITE (ndsout,984,err=803,iostat=ierr) &
208 time, factor*x, factor*y, tststr, trckid
210 WRITE (ndsout,974,err=803,iostat=ierr) &
211 time, factor*x, factor*y, tststr, trckid
214 IF ( time(1).EQ.ttst(1) .AND. time(2).EQ.ttst(2) )
THEN
216 IF ( tststr .EQ.
'SEA' ) ispec = ispec + 1
218 IF ( time(1).NE.ttst(1) .OR. time(2).NE.ttst(2) )
THEN
219 CALL stme21 ( ttst , stime )
220 WRITE (ndso,941) stime, iloc, ispec
223 IF ( tststr .EQ.
'SEA' ) ispec = ispec + 1
230 IF ( tststr .NE.
'SEA' )
GOTO 400
234 READ (ndsinp,err=801,iostat=ierr) dw, cx, cy, wx, wy, ust, as, &
236 IF ( ust .LT. 0. ) ust = -1.0
240 WRITE (ndsout,985,err=803,iostat=ierr) &
241 dw, cx, cy, wx, wy, ust, as, scale
253 VALUE = max( 0.1 , 1.1*spec(ik,ith)/scale )
254 iwdth = 2 + max( 0 , int( alog10(
VALUE) ) )
258 IF ( iwdth .GT. 9 )
THEN
262 WRITE (part,987) nint(spec(ik,ith)/scale)
263 IF ( part(11-iwdth:11-iwdth) .EQ.
' ' ) &
269 IF ( part(8:9) .EQ.
' 0' )
THEN
275 IF ( nzero .NE. 0 )
THEN
276 IF ( nzero .EQ. 1 )
THEN
280 WRITE (zeros,
'(I7,A2)') nzero,
'*0'
284 IF ( zeros(ich:ich) .NE.
' ' )
THEN
291 IF ( ilast+iwzero .GT. lineln )
THEN
292 WRITE (ndsout,986,err=803,iostat=ierr) &
297 string(ilast+1:ilast+iwzero) = &
299 ilast = ilast + iwzero
305 IF ( ilast+iwdth .GT. lineln )
THEN
306 WRITE (ndsout,986,err=803,iostat=ierr) &
312 string(ilast+1:ilast+iwdth) = part(10-iwdth:9)
313 ilast = ilast + iwdth
324 IF ( nzero .NE. 0 )
THEN
325 IF ( nzero .EQ. 1 )
THEN
329 WRITE (zeros,
'(I7,A2)') nzero,
'*0'
333 IF ( zeros(ich:ich) .NE.
' ' )
THEN
340 IF ( ilast+iwzero .GT. lineln )
THEN
341 WRITE (ndsout,986,err=803,iostat=ierr) &
346 string(ilast+1:ilast+iwzero) = zeros(10-iwzero:9)
347 ilast = ilast + iwzero
353 IF ( ilast .NE. 0 )
THEN
354 WRITE (ndsout,986,err=803,iostat=ierr) string(2:ilast)
365 CALL stme21 ( ttst , stime )
366 WRITE (ndso,941) stime, iloc, ispec
373 WRITE (ndse,1000) ierr
377 WRITE (ndse,1001) ierr
381 WRITE (ndse,1002) ierr
385 WRITE (ndse,1003) ierr
389 WRITE (ndse,1004) ierr
393 WRITE (ndse,1005) ierr
397 WRITE (ndse,1006) ierr
401 WRITE (ndse,1010) idstr, idtst
405 WRITE (ndse,1011) mk, mth, nk, nth
414 900
FORMAT (/15x,
' *** WAVEWATCH III Track output post.*** '/ &
415 15x,
'==============================================='/)
416 901
FORMAT (
' Comment character is ''',a,
''''/)
417 902
FORMAT (
' Spectral grid size is ',i3,
' by ',i3// &
418 ' Opening files : '/ &
419 ' -----------------------------------------------')
420 920
FORMAT (
' Input file ...')
421 930
FORMAT (
' Output file ...')
422 940
FORMAT (/
' Processing data : '/ &
423 ' -----------------------------------------------')
424 941
FORMAT (
' ',a,
' :',i6,
' points and',i6,
' spectra.')
427 981
FORMAT (2i6,2e13.5)
430 984
FORMAT (i8.8,i7.6,2f9.3,2x,a3,2x,a32)
431 974
FORMAT (i8.8,i7.6,2(f9.2,
'E3'),2x,a3,2x,a32)
432 985
FORMAT (f8.1,2f6.2,2f8.2,f9.5,f7.2,e12.5)
436 999
FORMAT (/
' End of program '/ &
437 ' ========================================='/ &
438 ' WAVEWATCH III Track output '/)
440 1000
FORMAT (/
' *** WAVEWATCH III ERROR IN W3TRCK : '/ &
441 ' ERROR IN OPENING INPUT DATA FILE'/ &
444 1001
FORMAT (/
' *** WAVEWATCH III ERROR IN W3TRCK : '/ &
445 ' ERROR IN READING FROM INPUT DATA FILE'/ &
448 1002
FORMAT (/
' *** WAVEWATCH III ERROR IN W3TRCK : '/ &
449 ' ERROR IN OPENING OUTPUT DATA FILE'/ &
452 1003
FORMAT (/
' *** WAVEWATCH III ERROR IN W3TRCK : '/ &
453 ' ERROR IN WRITING TO OUTPUT FILE'/ &
456 1004
FORMAT (/
' *** WAVEWATCH III ERROR IN W3TRCK : '/ &
457 ' ERROR IN OPENING INPUT FILE'/ &
460 1005
FORMAT (/
' *** WAVEWATCH III ERROR IN W3TRCK : '/ &
461 ' ERROR IN READING FROM INPUT FILE'/ &
464 1006
FORMAT (/
' *** WAVEWATCH III ERROR IN W3TRCK : '/ &
465 ' ERROR IN OPENING OUTPUT FILE'/ &
468 1010
FORMAT (/
' *** WAVEWATCH III ERROR IN W3TRCK : '/ &
469 ' UNEXPECTED ID STRING IN INPUT : ',a/ &
472 1011
FORMAT (/
' *** WAVEWATCH III ERROR IN W3TRCK : '/ &
473 ' UNEXPECTED SPECTRAL DIMENSIONS : ',2i4/ &
474 ' SHOULD BE : ',2i4/)