4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21# ifdef FLOATS
23# endif
24# if defined FOUR_DVAR || defined VERIFICATION
26# endif
30
32# ifdef AVERAGES
34# endif
35# ifdef DIAGNOSTICS
37# endif
38# ifdef GRID_EXTRACT
40# endif
41# ifdef FLOATS
43# endif
47# ifdef STATIONS
49# endif
50# ifdef DISTRIBUTE
52# endif
53# ifdef OBSERVATIONS
56# endif
58# ifdef AVERAGES
60# endif
61# ifdef DIAGNOSTICS
63# endif
64# ifdef GRID_EXTRACT
66# endif
67# ifdef FLOATS
69# endif
73# ifdef STATIONS
75# endif
76# if defined AVERAGES && defined AVERAGES_DETIDE && \
77 (defined ssh_tides || defined uv_tides)
79# endif
80
81 implicit none
82
83
84
85 integer, intent(in) :: ng
86
87
88
89 logical :: Ldefine, Lupdate, NewFile
90
91 integer :: Fcount, ifile, status, tile
92
93 character (len=*), parameter :: MyFile = &
94 & __FILE__
95
97
98# ifdef PROFILE
99
100
101
102
103
105# endif
106
107
108
109
110
111
112
113# ifdef DISTRIBUTE
115# else
116 tile=-1
117# endif
118
119
120
123 END IF
124
125
126
127
128# ifdef BIOLOGY
129 lupdate=.true.
130# else
131 lupdate=.false.
132# endif
133
134
135
136
137
144 END IF
145 END IF
149 ldefine=.false.
150 ELSE
151 ldefine=.true.
152 newfile=.false.
153 END IF
159 END IF
160 ldefine=.true.
161 newfile=.true.
162 ELSE
163 ldefine=.false.
164 END IF
165 IF (ldefine) THEN
168 END IF
170 his(ng)%load=
his(ng)%load+1
171 IF (
his(ng)%load.gt.
his(ng)%Nfiles)
THEN
173 WRITE (
stdout,10)
'HIS(ng)%load = ',
his(ng)%load, &
174 &
his(ng)%Nfiles, trim(
his(ng)%base), &
175 & ifile
176 END IF
179 & __line__, myfile)) RETURN
180 END IF
182 his(ng)%Nrec(fcount)=0
184 WRITE (
his(ng)%name,20) trim(
his(ng)%base), ifile
185 END IF
186# ifdef DISTRIBUTE
188# endif
189 his(ng)%files(fcount)=trim(
his(ng)%name)
193 END IF
196 ELSE
198 END IF
199 ELSE
205 END IF
206 END IF
207 END IF
208
209
210
211
215 & (mod(
iic(ng)-1,
nhis(ng)).eq.0))
THEN
218 END IF
220 END IF
221 ELSE
222 IF (mod(
iic(ng)-1,
nhis(ng)).eq.0)
THEN
225 END IF
226 END IF
227 END IF
228
229# ifdef GRID_EXTRACT
230
231
232
233
234
235
236
237
238
245 END IF
246 END IF
250 ldefine=.false.
251 ELSE
252 ldefine=.true.
253 newfile=.false.
254 END IF
260 END IF
261 ldefine=.true.
262 newfile=.true.
263 ELSE
264 ldefine=.false.
265 END IF
266 IF (ldefine) THEN
269 END IF
271 xtr(ng)%load=
xtr(ng)%load+1
272 IF (
xtr(ng)%load.gt.
xtr(ng)%Nfiles)
THEN
274 WRITE (
stdout,10)
'XTR(ng)%load = ',
xtr(ng)%load, &
275 &
xtr(ng)%Nfiles, trim(
xtr(ng)%base), &
276 & ifile
277 END IF
280 & __line__, myfile)) RETURN
281 END IF
283 xtr(ng)%Nrec(fcount)=0
285 WRITE (
xtr(ng)%name,20) trim(
xtr(ng)%base), ifile
286 END IF
287# ifdef DISTRIBUTE
289# endif
290 xtr(ng)%files(fcount)=trim(
xtr(ng)%name)
292 CALL def_extract (ng, newfile)
294 END IF
297 ELSE
299 END IF
300 ELSE
302 CALL def_extract (ng,
ldefout(ng))
306 END IF
307 END IF
308 END IF
309
310
311
312
316 & (mod(
iic(ng)-1,
nxtr(ng)).eq.0))
THEN
318 CALL wrt_extract (ng, tile)
319 END IF
321 END IF
322 ELSE
323 IF (mod(
iic(ng)-1,
nxtr(ng)).eq.0)
THEN
324 CALL wrt_extract (ng, tile)
326 END IF
327 END IF
328 END IF
329# endif
330
331
332
333
334
335
336
337
338
345 END IF
346 END IF
350 ldefine=.false.
351 ELSE
352 ldefine=.true.
353 newfile=.false.
354 END IF
360 END IF
361 ldefine=.true.
362 newfile=.true.
363 ELSE
364 ldefine=.false.
365 END IF
366 IF (ldefine) THEN
369 END IF
371 qck(ng)%load=
qck(ng)%load+1
372 IF (
qck(ng)%load.gt.
qck(ng)%Nfiles)
THEN
374 WRITE (
stdout,10)
'QCK(ng)%load = ',
qck(ng)%load, &
375 &
qck(ng)%Nfiles, trim(
qck(ng)%base), &
376 & ifile
377 END IF
380 & __line__, myfile)) RETURN
381 END IF
383 qck(ng)%Nrec(fcount)=0
385 WRITE (
qck(ng)%name,20) trim(
qck(ng)%base), ifile
386 END IF
387# ifdef DISTRIBUTE
389# endif
390 qck(ng)%files(fcount)=trim(
qck(ng)%name)
394 END IF
397 ELSE
399 END IF
400 ELSE
406 END IF
407 END IF
408 END IF
409
410
411
412
416 & (mod(
iic(ng)-1,
nqck(ng)).eq.0))
THEN
419 END IF
421 END IF
422 ELSE
423 IF (mod(
iic(ng)-1,
nqck(ng)).eq.0)
THEN
426 END IF
427 END IF
428 END IF
429
430# ifdef AVERAGES
431
432
433
434
435
436
437
438
439
448 END IF
449 END IF
453 ldefine=.false.
454 ELSE
455 newfile=.false.
456 ldefine=.true.
457 END IF
463 END IF
464 ldefine=.true.
465 newfile=.true.
466 ELSE
467 ldefine=.false.
468 END IF
469 IF (ldefine) THEN
472 END IF
475 ELSE
477 END IF
478 avg(ng)%load=
avg(ng)%load+1
479 IF (
avg(ng)%load.gt.
avg(ng)%Nfiles)
THEN
481 WRITE (
stdout,10)
'AVG(ng)%load = ',
avg(ng)%load, &
482 &
avg(ng)%Nfiles, trim(
avg(ng)%base), &
483 & ifile
484 END IF
487 & __line__, myfile)) RETURN
488 END IF
490 avg(ng)%Nrec(fcount)=0
492 WRITE (
avg(ng)%name,20) trim(
avg(ng)%base), ifile
493 END IF
494# ifdef DISTRIBUTE
496# endif
497 avg(ng)%files(fcount)=trim(
avg(ng)%name)
502 END IF
503 ELSE
509 END IF
510 END IF
511 END IF
512
513
514
517 & (mod(
iic(ng)-1,
navg(ng)).eq.0)).or. &
521# if defined AVERAGES_DETIDE && (defined SSH_TIDES || defined UV_TIDES)
524# endif
525 END IF
526 END IF
527# endif
528
529# ifdef DIAGNOSTICS
530
531
532
533
534
535
536
537
538
547 END IF
548 END IF
552 ldefine=.false.
553 ELSE
554 newfile=.false.
555 ldefine=.true.
556 END IF
562 END IF
563 ldefine=.true.
564 newfile=.true.
565 ELSE
566 ldefine=.false.
567 END IF
568 IF (ldefine) THEN
571 END IF
574 ELSE
576 END IF
577 dia(ng)%load=
dia(ng)%load+1
578 IF (
dia(ng)%load.gt.
dia(ng)%Nfiles)
THEN
580 WRITE (
stdout,10)
'DIA(ng)%load = ',
dia(ng)%load, &
581 &
dia(ng)%Nfiles, trim(
dia(ng)%base), &
582 & ifile
583 END IF
586 & __line__, myfile)) RETURN
587 END IF
589 dia(ng)%Nrec(fcount)=0
591 WRITE (
dia(ng)%name,20) trim(
dia(ng)%base), ifile
592 END IF
593# ifdef DISTRIBUTE
595# endif
596 dia(ng)%files(fcount)=trim(
dia(ng)%name)
601 END IF
602 ELSE
608 END IF
609 END IF
610 END IF
611
612
613
616 & (mod(
iic(ng)-1,
ndia(ng)).eq.0)).or. &
620 END IF
621 END IF
622# endif
623
624# ifdef STATIONS
625
626
627
628
629
632
633
634
635
640 END IF
641
642
643
644 IF (mod(
iic(ng)-1,
nsta(ng)).eq.0)
THEN
647 END IF
648 END IF
649# endif
650
651# ifdef FLOATS
652
653
654
655
656
659
660
661
662
664 IF (
frrec(ng).eq.0)
THEN
665 newfile=.true.
666 ELSE
667 newfile=.false.
668 END IF
672 END IF
673
674
675
676 IF ((mod(
iic(ng)-1,
nflt(ng)).eq.0).and. &
680 END IF
681 END IF
682# endif
683
684
685
686
687
688
689
690
696 END IF
697
698
699
702 & (mod(
iic(ng)-1,
nrst(ng)).eq.0))
THEN
705 END IF
706 END IF
707
708# if (defined FOUR_DVAR || \
709 defined verification) && \
710
711# ifdef OBSERVATIONS
712
713
714
715
716
717
722# ifdef SP4DVAR
726 END IF
727# else
729# if !(defined R4DVAR || defined VERIFICATION)
731# endif
732# endif
733 ELSE
735 END IF
736# endif
737# endif
738# ifdef PROFILE
739
740
741
742
743
745# endif
746
747 10 FORMAT (/,' OUTPUT - multi-file counter ',a,i0, &
748 & ', is greater than Nfiles = ',i0,1x,'dimension', &
749 & /,10x,'in structure when creating next file: ', &
750 & a,'_',i4.4,'.nc', &
751 & /,10x,'Incorrect OutFiles logic in ''read_phypar''.')
752 20 FORMAT (a,'_',i4.4,'.nc')
753
754 RETURN
subroutine, public close_file(ng, model, s, ncname, lupdate)
subroutine, public def_avg(ng, ldef)
subroutine, public def_diags(ng, ldef)
subroutine, public def_floats(ng, ldef)
subroutine, public def_his(ng, ldef)
subroutine, public def_quick(ng, ldef)
subroutine, public def_rst(ng)
subroutine, public def_station(ng, ldef)
integer, dimension(:), allocatable frrec
logical, dimension(:), allocatable lsadd
logical, dimension(:), allocatable processobs
type(t_io), dimension(:), allocatable his
type(t_io), dimension(:), allocatable xtr
type(t_io), dimension(:), allocatable qck
type(t_io), dimension(:), allocatable avg
character(len=256) sourcefile
type(t_io), dimension(:), allocatable dia
integer, dimension(:), allocatable idefqck
integer, dimension(:), allocatable idefavg
integer, dimension(:), allocatable idefdia
integer, dimension(:), allocatable idefxtr
integer, dimension(:), allocatable idefhis
integer, dimension(:), allocatable nfloats
integer, dimension(:), allocatable nstation
logical, dimension(:), allocatable lwrtqck
logical, dimension(:), allocatable lfloats
logical, dimension(:), allocatable lwrtdia
integer, dimension(:), allocatable nrrec
real(dp), dimension(:), allocatable obstime
integer, dimension(:), allocatable nxtr
integer, dimension(:), allocatable iic
integer, dimension(:), allocatable ndefhis
real(dp), dimension(:), allocatable dt
logical, dimension(:), allocatable lwrtxtr
logical, dimension(:), allocatable ldefflt
logical, dimension(:), allocatable ldefdia
integer, dimension(:), allocatable nrst
integer, dimension(:), allocatable nqck
logical, dimension(:), allocatable ldefavg
logical, dimension(:), allocatable ldefqck
integer, dimension(:), allocatable nflt
integer, dimension(:), allocatable navg
logical, dimension(:), allocatable lwrtavg
logical, dimension(:), allocatable ldefhis
integer, dimension(:), allocatable ntend
integer, dimension(:), allocatable ndefqck
integer, dimension(:), allocatable nsta
integer, dimension(:), allocatable nhis
integer, dimension(:), allocatable ndefavg
logical, dimension(:), allocatable lwrtper
logical, dimension(:), allocatable ldefxtr
integer, dimension(:), allocatable ndefxtr
logical, dimension(:), allocatable lwrthis
logical, dimension(:), allocatable ldefrst
logical, dimension(:), allocatable ldefout
logical, dimension(:), allocatable lwrtrst
real(dp), dimension(:), allocatable time
logical, dimension(:), allocatable ldefsta
logical, dimension(:), allocatable lstations
integer, dimension(:), allocatable ntstart
integer, dimension(:), allocatable ndia
integer, dimension(:), allocatable ntsdia
integer, dimension(:), allocatable ntsavg
integer, dimension(:), allocatable ndefdia
subroutine, public obs_read(ng, model, backward)
subroutine, public obs_write(ng, tile, model)
logical function, public founderror(flag, noerr, line, routine)
subroutine, public wrt_avg(ng, tile)
subroutine, public wrt_diags(ng, tile)
subroutine, public wrt_floats(ng)
subroutine, public wrt_his(ng, tile)
subroutine, public wrt_quick(ng, tile)
subroutine, public wrt_rst(ng, tile)
subroutine, public wrt_station(ng, tile)
subroutine, public wrt_tides(ng, tile)
subroutine obs_cost(ng, model)
recursive subroutine wclock_off(ng, model, region, line, routine)
recursive subroutine wclock_on(ng, model, region, line, routine)