4# if defined PIO_LIB && defined DISTRIBUTE
7 & nfiles, S, recordless, update, &
8 & LBi, UBi, UBj, UBk, Istr, Iend, Jrec, &
63 logical,
intent(in) :: recordless
64 logical,
intent(out) :: update
66 integer,
intent(in) :: ng, model, ifield, nfiles
67 integer,
intent(in) :: LBi, UBi, UBj, UBk, Istr, Iend, Jrec
68 integer,
intent(inout) :: ncid
70# if defined PIO_LIB && defined DISTRIBUTE
71 TYPE (File_desc_t),
intent(inout) :: pioFile
73 TYPE(
t_io),
intent(inout) :: S(nfiles)
75 real(r8),
intent(inout) :: Fout(LBi:UBi,UBj,UBk)
79 character (len=*),
parameter :: MyFile = &
86 SELECT CASE (s(1)%IOtype)
89 & nfiles, s, recordless, update, &
90 & lbi, ubi, ubj, ubk, istr, iend, jrec, &
93# if defined PIO_LIB && defined DISTRIBUTE
96 & nfiles, s, recordless, update, &
97 & lbi, ubi, ubj, ubk, istr, iend, jrec, &
106 10
FORMAT (
' GET_NGFLDR - Illegal input file type, io_type = ',i0, &
107 & /,12x,
'Check KeyWord ''INP_LIB'' in ''roms.in''.')
114 & nfiles, S, recordless, update, &
115 & LBi, UBi, UBj, UBk, Istr, Iend, Jrec, &
137 logical,
intent(in) :: recordless
138 logical,
intent(out) :: update
140 integer,
intent(in) :: ng, model, ifield, nfiles
141 integer,
intent(in) :: LBi, UBi, UBj, UBk, Istr, Iend, Jrec
142 integer,
intent(inout) :: ncid
144 TYPE(
t_io),
intent(inout) :: S(nfiles)
146 real(r8),
intent(inout) :: Fout(LBi:UBi,UBj,UBk)
150 logical :: Linquire, Liocycle, Lmulti, Lonerec
152 integer :: Nrec, Tid, Tindex, Trec, Vid, Vtype
153 integer :: i, ic, j, job, lend, lstr, npts, nvdim, status
155 integer(i8b) :: Fhash
158 real(r8) :: Aval, Fmax, Fmin
160 real(dp) :: Clength, Tdelta, Tend
161 real(dp) :: Tmax, Tmin, Tmono, Tscale, Tstr
162 real(dp) :: Tsec, Tval
164 real(r8),
dimension((UBi-LBi+1)*UBj) :: Awrk
166 character (len=22) :: t_code
168 character (len=*),
parameter :: MyFile = &
169 & __FILE__//
", get_ngfldr_nf90"
185 IF (
iic(ng).eq.0) linquire=.true.
186 IF (.not.linquire.and. &
187 & ((
iinfo(10,ifield,ng).gt.1).and. &
188 & (
linfo( 5,ifield,ng).or. &
205 CALL inquiry (ng, model, job, ubk, iend, ubi, ifield, ncid, &
208 IF (
linfo(5,ifield,ng))
THEN
209 linfo(5,ifield,ng)=.false.
211 IF (
linfo(6,ifield,ng))
THEN
212 linfo(6,ifield,ng)=.false.
221 tmono=
finfo(7,ifield,ng)
223 IF ((tmono.gt.
time(ng)).or.(
iic(ng).eq.0).or. &
228 liocycle=
linfo( 2,ifield,ng)
229 lonerec =
linfo( 3,ifield,ng)
230 vtype =
iinfo( 1,ifield,ng)
231 vid =
iinfo( 2,ifield,ng)
232 tid =
iinfo( 3,ifield,ng)
233 nrec =
iinfo( 4,ifield,ng)
234 tindex =
iinfo( 8,ifield,ng)
235 trec =
iinfo( 9,ifield,ng)
236 nvdim =
iinfo(11,ifield,ng)
237 tmin =
finfo( 1,ifield,ng)
238 tmax =
finfo( 2,ifield,ng)
239 clength =
finfo( 5,ifield,ng)
240 tscale =
finfo( 6,ifield,ng)
244 trec=mod(trec,nrec)-1
245 IF (trec.le.0) trec=nrec+trec
249 iinfo(9,ifield,ng)=trec
251 IF ((1.le.trec).and.(trec.le.nrec))
THEN
262 iinfo(8,ifield,ng)=tindex
266 IF (.not.recordless.and.(tid.ge.0).and.(tid.ne.vid))
THEN
268 &
rclock%DateNumber, tval, &
270 & start = (/trec/), &
277 vtime(tindex,ifield,ng)=tval
283 IF ((trec.eq.1).and.(tval*
day2sec.ge.
time(ng)))
THEN
284 linfo(5,ifield,ng)=.true.
297 &
vname(1,ifield), awrk, &
300 & total = (/iend-istr+1/))
301 ELSE IF (nvdim.eq.2)
THEN
303 npts=(iend-istr+1)*jrec
305 &
vname(1,ifield), awrk, &
308 & total = (/iend-istr+1,jrec/))
312 &
vname(1,ifield), awrk, &
314 & start = (/1,trec/), &
315 & total = (/iend-istr+1,1/))
317 ELSE IF (nvdim.eq.3)
THEN
318 npts=(iend-istr+1)*jrec
320 &
vname(1,ifield), awrk, &
322 & start = (/1,1,trec/), &
323 & total = (/iend-istr+1,jrec,1/))
329 fmin=awrk(1)*
fscale(ifield,ng)
330 fmax=awrk(1)*
fscale(ifield,ng)
335 aval=awrk(ic)*
fscale(ifield,ng)
338 fout(i,j,tindex)=aval
341 finfo(8,ifield,ng)=fmin
342 finfo(9,ifield,ng)=fmax
348 WRITE (
stdout,60) trim(
vname(2,ifield)), ng, fmin, fmax
350 lstr=scan(
ncfile,
'/',back=.true.)+1
355 & ng, trec, tindex,
ncfile(lstr:lend), &
356 & tmin, tmax, tval, fmin, fmax
371 IF (.not.lonerec.and.(.not.recordless))
THEN
372 tdelta=
vtime(3-tindex,ifield,ng)-
vtime(tindex,ifield,ng)
373 IF (liocycle.and.(tdelta.lt.0.0_r8))
THEN
374 tdelta=tdelta+clength
377 finfo(7,ifield,ng)=tmono
378 tintrp(tindex,ifield,ng)=tmono
382 10
FORMAT (/,
' GET_NGFLDR_NF90 - unable to find dimension ',a, &
383 & /,19x,
'for variable: ',a,/,19x,
'in file: ',a, &
384 & /,19x,
'file is not CF compliant...')
385 20
FORMAT (/,
' GET_NGFLDR_NF90 - too small dimension for variable', &
386 & 1x,a,
': ',i0,2x,i0)
387 30
FORMAT (/,
' GET_NGFLDR_NF90 - unable to find requested', &
388 &
' variable: ',a,/,19x,
'in file: ',a)
389 40
FORMAT (/,
' GET_NGFLDR_NF90 - unable to open input NetCDF', &
391 50
FORMAT (/,
' GET_NGFLDR_NF90 - error while reading variable: ',a, &
392 & 2x,
' at TIME index = ',i0)
393 60
FORMAT (2x,
'GET_NGFLDR_NF90 - ',a,/,22x,
'(Grid = ',i2.2, &
394 &
', Min = ',1pe15.8,
' Max = ',1pe15.8,
')')
395 70
FORMAT (2x,
'GET_NGFLDR_NF90 - ',a,
',',t75,a,/,22x, &
396 &
'(Grid=',i2.2,
', Rec=',i0,
', Index=',i1, &
397 &
', File: ',a,
')',/,22x, &
398 &
'(Tmin= ', f15.4,
' Tmax= ', f15.4,
')', &
399 & t71,
't = ', f15.4 ,/,22x, &
400 &
'(Min = ', 1p,e15.8,0p,
' Max = ',1p,e15.8,0p,
')')
402 80
FORMAT (22x,
'(CheckSum = ',i0,
')')
408# if defined PIO_LIB && defined DISTRIBUTE
412 & nfiles, S, recordless, update, &
413 & LBi, UBi, UBj, UBk, Istr, Iend, Jrec, &
435 logical,
intent(in) :: recordless
436 logical,
intent(out) :: update
438 integer,
intent(in) :: ng, model, ifield, nfiles
439 integer,
intent(in) :: LBi, UBi, UBj, UBk, Istr, Iend, Jrec
441 TYPE (File_desc_t),
intent(inout) :: pioFile
442 TYPE(
t_io),
intent(inout) :: S(nfiles)
444 real(r8),
intent(inout) :: Fout(LBi:UBi,UBj,UBk)
448 logical :: Linquire, Liocycle, Lmulti, Lonerec
450 integer :: Nrec, Tindex, Trec, Vtype
451 integer :: i, ic, j, job, lend, lstr, npts, nvdim, status
453 integer(i8b) :: Fhash
456 real(r8) :: Aval, Fmax, Fmin
458 real(dp) :: Clength, Tdelta, Tend
459 real(dp) :: Tmax, Tmin, Tmono, Tscale, Tstr
460 real(dp) :: Tsec, Tval
462 real(r8),
dimension((UBi-LBi+1)*UBj) :: Awrk
464 character (len=22) :: t_code
466 character (len=*),
parameter :: MyFile = &
467 & __FILE__//
", get_ngfldr_pio"
469 TYPE (My_VarDesc) :: TpioVar, VpioVar
485 IF (
iic(ng).eq.0) linquire=.true.
486 IF (.not.linquire.and. &
487 & ((
iinfo(10,ifield,ng).gt.1).and. &
488 & (
linfo( 5,ifield,ng).or. &
505 CALL inquiry (ng, model, job, ubk, iend, ubi, ifield, piofile, &
508 IF (
linfo(5,ifield,ng))
THEN
509 linfo(5,ifield,ng)=.false.
511 IF (
linfo(6,ifield,ng))
THEN
512 linfo(6,ifield,ng)=.false.
521 tmono=
finfo(7,ifield,ng)
523 IF ((tmono.gt.
time(ng)).or.(
iic(ng).eq.0).or. &
528 liocycle=
linfo( 2,ifield,ng)
529 lonerec =
linfo( 3,ifield,ng)
530 vtype =
iinfo( 1,ifield,ng)
531 vpiovar =
dinfo( 1,ifield,ng)
532 tpiovar =
dinfo( 2,ifield,ng)
533 nrec =
iinfo( 4,ifield,ng)
534 tindex =
iinfo( 8,ifield,ng)
535 trec =
iinfo( 9,ifield,ng)
536 nvdim =
iinfo(11,ifield,ng)
537 tmin =
finfo( 1,ifield,ng)
538 tmax =
finfo( 2,ifield,ng)
539 clength =
finfo( 5,ifield,ng)
540 tscale =
finfo( 6,ifield,ng)
544 trec=mod(trec,nrec)-1
545 IF (trec.le.0) trec=nrec+trec
549 iinfo(9,ifield,ng)=trec
551 IF ((1.le.trec).and.(trec.le.nrec))
THEN
562 iinfo(8,ifield,ng)=tindex
566 IF (.not.recordless.and.(tpiovar%vd%varID.ge.0).and. &
567 & (tpiovar%vd%varID.ne.vpiovar%vd%varID))
THEN
569 &
rclock%DateNumber, tval, &
570 & piofile = piofile, &
571 & start = (/trec/), &
578 vtime(tindex,ifield,ng)=tval
584 IF ((trec.eq.1).and.(tval*
day2sec.ge.
time(ng)))
THEN
585 linfo(5,ifield,ng)=.true.
592 IF (vpiovar%vd%varID.ge.0)
THEN
598 &
vname(1,ifield), awrk, &
599 & piofile = piofile, &
601 & total = (/iend-istr+1/))
602 ELSE IF (nvdim.eq.2)
THEN
604 npts=(iend-istr+1)*jrec
606 &
vname(1,ifield), awrk, &
607 & piofile = piofile, &
609 & total = (/iend-istr+1,jrec/))
613 &
vname(1,ifield), awrk, &
614 & piofile = piofile, &
615 & start = (/1,trec/), &
616 & total = (/iend-istr+1,1/))
618 ELSE IF (nvdim.eq.3)
THEN
619 npts=(iend-istr+1)*jrec
621 &
vname(1,ifield), awrk, &
622 & piofile = piofile, &
623 & start = (/1,1,trec/), &
624 & total = (/iend-istr+1,jrec,1/))
630 fmin=awrk(1)*
fscale(ifield,ng)
631 fmax=awrk(1)*
fscale(ifield,ng)
636 aval=awrk(ic)*
fscale(ifield,ng)
639 fout(i,j,tindex)=aval
642 finfo(8,ifield,ng)=fmin
643 finfo(9,ifield,ng)=fmax
649 WRITE (
stdout,60) trim(
vname(2,ifield)), ng, fmin, fmax
651 lstr=scan(
ncfile,
'/',back=.true.)+1
656 & ng, trec, tindex,
ncfile(lstr:lend), &
657 & tmin, tmax, tval, fmin, fmax
672 IF (.not.lonerec.and.(.not.recordless))
THEN
673 tdelta=
vtime(3-tindex,ifield,ng)-
vtime(tindex,ifield,ng)
674 IF (liocycle.and.(tdelta.lt.0.0_r8))
THEN
675 tdelta=tdelta+clength
678 finfo(7,ifield,ng)=tmono
679 tintrp(tindex,ifield,ng)=tmono
683 10
FORMAT (/,
' GET_NGFLDR_PIO - unable to find dimension ',a, &
684 & /,18x,
'for variable: ',a,/,18x,
'in file: ',a, &
685 & /,18x,
'file is not CF compliant...')
686 20
FORMAT (/,
' GET_NGFLDR_PIO - too small dimension for variable', &
687 & 1x,a,
': ',i0,2x,i0)
688 30
FORMAT (/,
' GET_NGFLDR_PIO - unable to find requested', &
689 &
' variable: ',a,/,18x,
'in file: ',a)
690 40
FORMAT (/,
' GET_NGFLDR_PIO - unable to open input NetCDF', &
692 50
FORMAT (/,
' GET_NGFLDR_PIO - error while reading variable: ',a, &
693 & 2x,
' at TIME index = ',i0)
694 60
FORMAT (2x,
'GET_NGFLDR_PIO - ',a,/,22x,
'(Grid = ',i2.2, &
695 &
', Min = ',1pe15.8,
' Max = ',1pe15.8,
')')
696 70
FORMAT (2x,
'GET_NGFLDR_PIO - ',a,
',',t75,a,/,22x, &
697 &
'(Grid=',i2.2,
', Rec=',i0,
', Index=',i1, &
698 &
', File: ',a,
')',/,22x, &
699 &
'(Tmin= ', f15.4,
' Tmax= ', f15.4,
')', &
700 & t71,
't = ', f15.4 ,/,22x, &
701 &
'(Min = ', 1p,e15.8,0p,
' Max = ',1p,e15.8,0p,
')')
703 80
FORMAT (22x,
'(CheckSum = ',i0,
')')
subroutine get_ngfldr(ng, model, ifield, ncid, piofile, nfiles, s, recordless, update, lbi, ubi, ubj, ubk, istr, iend, jrec, fout)
subroutine get_ngfldr_pio(ng, model, ifield, piofile, nfiles, s, recordless, update, lbi, ubi, ubj, ubk, istr, iend, jrec, fout)
subroutine get_ngfldr_nf90(ng, model, ifield, ncid, nfiles, s, recordless, update, lbi, ubi, ubj, ubk, istr, iend, jrec, fout)
subroutine, public time_string(mytime, date_string)
subroutine, public get_hash(a, asize, hash, lreduce)
character(len=256) ncfile
character(len=256) sourcefile
integer, parameter io_nf90
character(len=256), dimension(:,:), allocatable cinfo
logical, dimension(:,:,:), allocatable linfo
integer, parameter io_pio
type(my_vardesc), dimension(:,:,:), pointer dinfo
real(dp), dimension(:,:,:), allocatable vtime
real(dp), dimension(:,:,:), allocatable tintrp
real(dp), dimension(:,:), allocatable fscale
character(len=46), dimension(0:nv) tname
real(dp), dimension(:,:,:), allocatable finfo
character(len=maxlen), dimension(6, 0:nv) vname
integer, dimension(:,:,:), allocatable iinfo
real(dp), parameter day2sec
integer, dimension(:), allocatable iic
real(dp), dimension(:), allocatable time
integer, dimension(:), allocatable ntstart
logical function, public founderror(flag, noerr, line, routine)