31 character (len=*) :: task
35 integer :: Iunder, ifile, lstr, ng
38 character (len=*),
parameter :: MyFile = &
55 SELECT CASE (trim(adjustl(task)))
61 fwd(ng)%IOtype=
his(ng)%IOtype
68 fwd(ng)%files(ifile)=trim(
his(ng)%files(ifile))
70 fwd(ng)%name=trim(
fwd(ng)%files(1))
74#if defined PIO_LIB && defined DISTRIBUTE
76 fwd(ng)%pioFile=
his(ng)%pioFile
79 fwd(ng)%name=trim(
his(ng)%name)
80 fwd(ng)%files(1)=trim(
his(ng)%name)
88 blk(ng)%IOtype=
his(ng)%IOtype
95 blk(ng)%files(ifile)=trim(
his(ng)%files(ifile))
97 blk(ng)%name=trim(
blk(ng)%files(1))
101#if defined PIO_LIB && defined DISTRIBUTE
103 blk(ng)%pioFile%fh=-1
106 blk(ng)%name=trim(
his(ng)%name)
107 blk(ng)%files(1)=trim(
his(ng)%name)
115 blk(ng)%IOtype=
qck(ng)%IOtype
122 blk(ng)%files(ifile)=trim(
qck(ng)%files(ifile))
124 blk(ng)%name=trim(
blk(ng)%files(1))
128#if defined PIO_LIB && defined DISTRIBUTE
130 blk(ng)%pioFile%fh=-1
133 blk(ng)%name=trim(
qck(ng)%name)
134 blk(ng)%files(1)=trim(
qck(ng)%name)
142 blk(ng)%IOtype=
fwd(ng)%IOtype
143 nfiles=
fwd(ng)%Nfiles
144 IF (nfiles.gt.1)
THEN
148 blk(ng)%files(ifile)=trim(
fwd(ng)%files(ifile))
150 blk(ng)%name=trim(
blk(ng)%files(1))
154#if defined PIO_LIB && defined DISTRIBUTE
156 blk(ng)%pioFile%fh=-1
159 blk(ng)%name=trim(
fwd(ng)%name)
160 blk(ng)%files(1)=trim(
fwd(ng)%name)
163#ifdef RBL4DVAR_FCT_SENSITIVITY
172 his(ng)%IOtype=
fwd(ng)%IOtype
173 nfiles=
fwd(ng)%Nfiles
174 IF (nfiles.gt.1)
THEN
178 his(ng)%files(ifile)=trim(
fwd(ng)%files(ifile))
180 his(ng)%name=trim(
his(ng)%files(1))
181 istring=index(
his(ng)%name,
'_outer',back=.false.)
182 IF (istring.gt.0)
THEN
184 his(ng)%head=trim(adjustl(
his(ng)%name(1:lstr)))
185 fwd(ng)%head=trim(adjustl(
his(ng)%name(1:lstr)))
187 istring=index(
his(ng)%name,char(95),back=.true.)
188 IF (istring.gt.0)
THEN
190 his(ng)%base=trim(adjustl(
his(ng)%name(1:lstr)))
191 fwd(ng)%base=trim(adjustl(
his(ng)%name(1:lstr)))
196#if defined PIO_LIB && defined DISTRIBUTE
198 his(ng)%pioFile=
fwd(ng)%pioFile
201 his(ng)%files(1)=trim(
fwd(ng)%files(1))
202 his(ng)%name=trim(
his(ng)%files(1))
203 istring=index(
his(ng)%name,
'_outer',back=.false.)
204 IF (istring.gt.0)
THEN
206 his(ng)%head=trim(adjustl(
his(ng)%name(1:lstr)))
207 his(ng)%base=trim(adjustl(
his(ng)%name(1:lstr)))
216 nfiles=
fcta(ng)%Nfiles
217 IF (nfiles.gt.1)
THEN
221 fwd(ng)%files(ifile)=trim(
fcta(ng)%files(ifile))
223 fwd(ng)%name=trim(
fwd(ng)%files(1))
227#if defined PIO_LIB && defined DISTRIBUTE
229 fwd(ng)%pioFile=
fcta(ng)%pioFile
232 fwd(ng)%name=trim(
fcta(ng)%name)
233 fwd(ng)%files(1)=trim(
fcta(ng)%name)
242 nfiles=
fcta(ng)%Nfiles
243 IF (nfiles.gt.1)
THEN
247 blk(ng)%files(ifile)=trim(
fcta(ng)%files(ifile))
249 blk(ng)%name=trim(
blk(ng)%files(1))
253#if defined PIO_LIB && defined DISTRIBUTE
255 blk(ng)%pioFile%fh=-1
258 blk(ng)%name=trim(
fcta(ng)%name)
259 blk(ng)%files(1)=trim(
fcta(ng)%name)
267 nfiles=
fctb(ng)%Nfiles
268 IF (nfiles.gt.1)
THEN
272 fwd(ng)%files(ifile)=trim(
fctb(ng)%files(ifile))
274 fwd(ng)%name=trim(
fwd(ng)%files(1))
278#if defined PIO_LIB && defined DISTRIBUTE
280 fwd(ng)%pioFile=
fctb(ng)%pioFile
283 fwd(ng)%name=trim(
fctb(ng)%name)
284 fwd(ng)%files(1)=trim(
fctb(ng)%name)
293 nfiles=
fctb(ng)%Nfiles
294 IF (nfiles.gt.1)
THEN
298 blk(ng)%files(ifile)=trim(
fctb(ng)%files(ifile))
300 blk(ng)%name=trim(
blk(ng)%files(1))
304#if defined PIO_LIB && defined DISTRIBUTE
306 blk(ng)%pioFile%fh=-1
309 blk(ng)%name=trim(
fctb(ng)%name)
310 blk(ng)%files(1)=trim(
fctb(ng)%name)
319 fwd(ng)%IOtype=
tlm(ng)%IOtype
326 fwd(ng)%files(ifile)=trim(
tlm(ng)%files(ifile))
328 fwd(ng)%name=trim(
fwd(ng)%files(1))
332#if defined PIO_LIB && defined DISTRIBUTE
334 fwd(ng)%pioFile=
tlm(ng)%pioFile
337 fwd(ng)%name=trim(
tlm(ng)%name)
338 fwd(ng)%files(1)=trim(
tlm(ng)%name)
372 integer,
intent(in) :: ng, Nfiles
374 TYPE(
t_io),
intent(inout) :: S(Ngrids)
378 integer :: i, j, lstr
380 character (len= 1),
parameter :: blank =
' '
390 IF (s(ng)%Nfiles.ne.nfiles)
THEN
391 IF (
associated(s(ng)%Nrec))
deallocate (s(ng)%Nrec)
392 IF (
associated(s(ng)%time_min))
deallocate (s(ng)%time_min)
393 IF (
associated(s(ng)%time_max))
deallocate (s(ng)%time_max)
394 IF (
associated(s(ng)%files))
deallocate (s(ng)%files)
396 allocate ( s(ng)%Nrec(nfiles) )
397 allocate ( s(ng)%time_min(nfiles) )
398 allocate ( s(ng)%time_max(nfiles) )
399 allocate ( s(ng)%files(nfiles) )
406 s(ng)%name(i:i)=blank
410 s(ng)%files(j)(i:i)=blank
423#if defined PIO_LIB && defined DISTRIBUTE
426 s(ng)%pioVar(i)%vd%varID=-1
427 s(ng)%pioVar(i)%dkind=-1
428 s(ng)%pioVar(i)%gtype=0
431 s(ng)%pioTrc(i)%vd%varID=-1
432 s(ng)%pioTrc(i)%dkind=-1
433 s(ng)%pioTrc(i)%gtype=0
437 s(ng)%time_min=0.0_dp
438 s(ng)%time_max=0.0_dp
440 10
FORMAT (a,
'_',i4.4,
'.nc')
subroutine edit_file_struct(ng, nfiles, s)
subroutine edit_multifile(task)
subroutine, public close_file(ng, model, s, ncname, lupdate)
type(t_io), dimension(:), allocatable his
type(t_io), dimension(:), allocatable fcta
type(t_io), dimension(:), allocatable fctb
type(t_io), dimension(:), allocatable tlm
type(t_io), dimension(:), allocatable blk
type(t_io), dimension(:), allocatable qck
type(t_io), dimension(:), allocatable fwd
character(len=256) sourcefile
integer, parameter io_nf90
integer, parameter io_pio
integer, dimension(:), allocatable ntimes
integer, dimension(:), allocatable ndefhis
integer, dimension(:), allocatable ntlm
integer, dimension(:), allocatable nqck
integer, dimension(:), allocatable ndeftlm
integer, dimension(:), allocatable ndefqck
integer, dimension(:), allocatable nhis