2 SUBROUTINE get_2dfld (ng, model, ifield, ncid, &
3#if defined PIO_LIB && defined DISTRIBUTE
7 & LBi, UBi, LBj, UBj, Iout, Irec, &
29#if defined PIO_LIB && defined DISTRIBUTE
65 logical,
intent(out) :: update
67 integer,
intent(in) :: ng, model, ifield, nfiles, Iout, Irec
68 integer,
intent(in) :: LBi, UBi, LBj, UBj
69 integer,
intent(inout) :: ncid
71#if defined PIO_LIB && defined DISTRIBUTE
72 TYPE (File_desc_t),
intent(inout) :: pioFile
74 TYPE(
t_io),
intent(inout) :: S(nfiles)
77 real(r8),
intent(in) :: Fmask(LBi:UBi,LBj:UBj)
79 real(r8),
intent(inout) :: Fout(LBi:UBi,LBj:UBj,Iout)
83 character (len=*),
parameter :: MyFile = &
90 SELECT CASE (s(1)%IOtype)
93 & update, lbi, ubi, lbj, ubj, iout, irec, &
99#if defined PIO_LIB && defined DISTRIBUTE
102 & update, lbi, ubi, lbj, ubj, iout, irec, &
114 10
FORMAT (
' GET_2DFLD - Illegal input file type, io_type = ',i0, &
115 & /,13x,
'Check KeyWord ''INP_LIB'' in ''roms.in''.')
122 & nfiles, S, update, &
123 & LBi, UBi, LBj, UBj, Iout, Irec, &
147 logical,
intent(out) :: update
149 integer,
intent(in) :: ng, model, ifield, nfiles, Iout, Irec
150 integer,
intent(in) :: LBi, UBi, LBj, UBj
151 integer,
intent(inout) :: ncid
153 TYPE(
t_io),
intent(inout) :: S(nfiles)
156 real(r8),
intent(in) :: Fmask(LBi:UBi,LBj:UBj)
158 real(r8),
intent(inout) :: Fout(LBi:UBi,LBj:UBj,Iout)
162 logical :: Lgridded, Linquire, Liocycle, Lmulti, Lonerec, Lregrid
165 integer :: Nrec, Tid, Tindex, Trec, Vid, Vtype
166 integer :: gtype, job, lend, lstr, lvar, status
169 integer(i8b) :: Fhash
172 real(r8) :: Fmax, Fmin, Fval
174 real(dp) :: Clength, Tdelta, Tend
175 real(dp) :: Tmax, Tmin, Tmono, Tscale, Tstr
176 real(dp) :: Tsec, Tval
178 character (len= 1) :: Rswitch
179 character (len=22) :: t_code
181 character (len=*),
parameter :: MyFile = &
182 & __FILE__//
", get_2dfld_nf90"
198 IF (
iic(ng).eq.0) linquire=.true.
199 IF (.not.linquire.and. &
200 & ((
iinfo(10,ifield,ng).gt.1).and. &
201 & (
linfo( 6,ifield,ng).or. &
218 CALL inquiry (ng, model, job, iout, irec, 1, ifield, ncid, &
221 IF (
linfo(6,ifield,ng))
THEN
222 linfo(6,ifield,ng)=.false.
232 tmono=
finfo(7,ifield,ng)
234 IF ((tmono.lt.
time(ng)).or.(
iic(ng).eq.0).or. &
239 lgridded=
linfo(1,ifield,ng)
240 liocycle=
linfo(2,ifield,ng)
241 lonerec =
linfo(3,ifield,ng)
242 special =
linfo(4,ifield,ng)
243 vtype =
iinfo(1,ifield,ng)
244 vid =
iinfo(2,ifield,ng)
245 tid =
iinfo(3,ifield,ng)
246 nrec =
iinfo(4,ifield,ng)
247 vsize(1)=
iinfo(5,ifield,ng)
248 vsize(2)=
iinfo(6,ifield,ng)
249 tindex =
iinfo(8,ifield,ng)
250 trec =
iinfo(9,ifield,ng)
251 tmin =
finfo(1,ifield,ng)
252 tmax =
finfo(2,ifield,ng)
253 clength =
finfo(5,ifield,ng)
254 tscale =
finfo(6,ifield,ng)
258 trec=mod(trec,nrec)+1
262 iinfo(9,ifield,ng)=trec
264 IF (trec.le.nrec)
THEN
272 IF (.not.special.and.(irec.eq.1))
THEN
278 iinfo(8,ifield,ng)=tindex
283 IF (.not.special.and.(tid.ge.0))
THEN
285 &
rclock%DateNumber, tval, &
287 & start = (/trec/), &
294 vtime(tindex,ifield,ng)=tval
300 IF ((trec.eq.nrec).and.(tval*
day2sec.le.
time(ng)))
THEN
301 linfo(6,ifield,ng)=.true.
315 &
vname(1,ifield), vid, &
317 & lbi, ubi, lbj, ubj, 1, irec, &
318 &
fscale(ifield,ng), fmin, fmax, &
330 &
vname(1,ifield), vid, &
331 & trec, vtype, vsize, &
332 & lbi, ubi, lbj, ubj, &
333 &
fscale(ifield,ng), fmin, fmax, &
337 & fout(:,:,tindex), &
339 & checksum = fhash, &
346 &
vname(1,ifield), fval, &
348 & start = (/trec/), &
350 fval=fval*
fscale(ifield,ng)
351 fpoint(tindex,ifield,ng)=fval
359 finfo(8,ifield,ng)=fmin
360 finfo(9,ifield,ng)=fmax
363 WRITE (
stdout,50) trim(
vname(2,ifield)), ng, fmin, fmax
365 lstr=scan(
ncfile,
'/',back=.true.)+1
367 lvar=min(46,len_trim(
vname(2,ifield)))
375 WRITE (
stdout,60)
vname(2,ifield)(1:lvar), t_code, &
376 & ng, trec, tindex,
ncfile(lstr:lend), &
377 & tmin, tmax, tval, fmin, fmax, rswitch
392 IF (.not.lonerec.and.(.not.special))
THEN
393 tdelta=
vtime(tindex,ifield,ng)-
vtime(3-tindex,ifield,ng)
394 IF (liocycle.and.(tdelta.lt.0.0_r8))
THEN
395 tdelta=tdelta+clength
398 finfo(7,ifield,ng)=tmono
399 tintrp(tindex,ifield,ng)=tmono
403 10
FORMAT (/,
' GET_2DFLD_NF90 - unable to find dimension ',a, &
404 & /,18x,
'for variable: ',a,/,18x,
'in file: ',a, &
405 & /,18x,
'file is not CF compliant...')
406 20
FORMAT (/,
' GET_2DFLD_NF90 - unable to find requested variable:', &
407 & 1x,a,/,18x,
'in ',a)
408 30
FORMAT (/,
' GET_2DFLD_NF90 - unable to open input NetCDF', &
410 40
FORMAT (/,
' GET_2DFLD_NF90 - error while reading variable: ',a, &
411 & 2x,
' at TIME index = ',i0)
412 50
FORMAT (2x,
'GET_2DFLD_NF90 - ',a,/,22x,
'(Grid = ',i2.2, &
413 &
', Min = ',1p,e15.8,0p,
' Max = ',1p,e15.8,0p,
')')
414 60
FORMAT (2x,
'GET_2DFLD_NF90 - ',a,
',',t75,a,/,22x, &
415 &
'(Grid=',i2.2,
', Rec=',i0,
', Index=',i1, &
416 &
', File: ',a,
')',/,22x, &
417 &
'(Tmin= ', f15.4,
' Tmax= ', f15.4,
')', &
418 & t71,
't = ', f15.4 ,/, 22x, &
419 &
'(Min = ', 1p,e15.8,0p,
' Max = ',1p,e15.8,0p,
')', &
420 & t71,
'regrid = ',a)
422 70
FORMAT (22x,
'(CheckSum = ',i0,
')')
428#if defined PIO_LIB && defined DISTRIBUTE
432 & nfiles, S, update, &
433 & LBi, UBi, LBj, UBj, Iout, Irec, &
457 logical,
intent(out) :: update
459 integer,
intent(in) :: ng, model, ifield, nfiles, Iout, Irec
460 integer,
intent(in) :: LBi, UBi, LBj, UBj
462 TYPE (File_desc_t),
intent(inout) :: pioFile
463 TYPE(
t_io),
intent(inout) :: S(nfiles)
466 real(r8),
intent(in) :: Fmask(LBi:UBi,LBj:UBj)
468 real(r8),
intent(inout) :: Fout(LBi:UBi,LBj:UBj,Iout)
472 logical :: Lgridded, Linquire, Liocycle, Lmulti, Lonerec, Lregrid
475 integer :: Nrec, Tindex, Trec, Vtype
476 integer :: i, job, lend, lstr, lvar, status
479 integer(i8b) :: Fhash
482 real(r8) :: Fmax, Fmin, Fval
484 real(dp) :: Clength, Tdelta, Tend
485 real(dp) :: Tmax, Tmin, Tmono, Tscale, Tstr
486 real(dp) :: Tsec, Tval
488 character (len= 1) :: Rswitch
489 character (len=22) :: t_code
491 character (len=*),
parameter :: MyFile = &
492 & __FILE__//
", get_2dfld_pio"
494 TYPE (IO_Desc_t),
pointer :: ioDesc
495 TYPE (My_VarDesc) :: TpioVar, VpioVar
511 IF (
iic(ng).eq.0) linquire=.true.
512 IF (.not.linquire.and. &
513 & ((
iinfo(10,ifield,ng).gt.1).and. &
514 & (
linfo( 6,ifield,ng).or. &
531 CALL inquiry (ng, model, job, iout, irec, 1, ifield, piofile, &
534 IF (
linfo(6,ifield,ng))
THEN
535 linfo(6,ifield,ng)=.false.
545 tmono=
finfo(7,ifield,ng)
547 IF ((tmono.lt.
time(ng)).or.(
iic(ng).eq.0).or. &
552 lgridded=
linfo(1,ifield,ng)
553 liocycle=
linfo(2,ifield,ng)
554 lonerec =
linfo(3,ifield,ng)
555 special =
linfo(4,ifield,ng)
556 vtype =
iinfo(1,ifield,ng)
557 vpiovar =
dinfo(1,ifield,ng)
558 tpiovar =
dinfo(2,ifield,ng)
559 nrec =
iinfo(4,ifield,ng)
560 vsize(1)=
iinfo(5,ifield,ng)
561 vsize(2)=
iinfo(6,ifield,ng)
562 tindex =
iinfo(8,ifield,ng)
563 trec =
iinfo(9,ifield,ng)
564 tmin =
finfo(1,ifield,ng)
565 tmax =
finfo(2,ifield,ng)
566 clength =
finfo(5,ifield,ng)
567 tscale =
finfo(6,ifield,ng)
571 trec=mod(trec,nrec)+1
575 iinfo(9,ifield,ng)=trec
577 IF (trec.le.nrec)
THEN
585 IF (.not.special.and.(irec.eq.1))
THEN
591 iinfo(8,ifield,ng)=tindex
596 IF (.not.special.and.(tpiovar%vd%varID.ge.0))
THEN
598 &
rclock%DateNumber, tval, &
599 & piofile = piofile, &
600 & start = (/trec/), &
607 vtime(tindex,ifield,ng)=tval
613 IF ((trec.eq.nrec).and.(tval*
day2sec.le.
time(ng)))
THEN
614 linfo(6,ifield,ng)=.true.
623 IF (special) vtype=vtype+4
625 IF (vpiovar%vd%varID.ge.0)
THEN
628 IF (kind(fout).eq.8)
THEN
634 IF (kind(fout).eq.8)
THEN
640 IF (kind(fout).eq.8)
THEN
646 IF (kind(fout).eq.8)
THEN
651# if defined SSH_TIDES || defined UV_TIDES
653 IF (kind(fout).eq.8)
THEN
666 &
vname(1,ifield), vpiovar, &
667 & 0, iodesc, vsize, &
668 & lbi, ubi, lbj, ubj, 1, irec, &
669 &
fscale(ifield,ng), fmin, fmax, &
681 &
vname(1,ifield), vpiovar, &
682 & trec, iodesc, vsize, &
683 & lbi, ubi, lbj, ubj, &
684 &
fscale(ifield,ng), fmin, fmax, &
688 & fout(:,:,tindex), &
690 & checksum = fhash, &
697 &
vname(1,ifield), fval, &
698 & piofile = piofile, &
699 & start = (/trec/), &
701 fval=fval*
fscale(ifield,ng)
702 fpoint(tindex,ifield,ng)=fval
710 finfo(8,ifield,ng)=fmin
711 finfo(9,ifield,ng)=fmax
714 WRITE (
stdout,50) trim(
vname(2,ifield)), ng, fmin, fmax
716 lstr=scan(
ncfile,
'/',back=.true.)+1
718 lvar=min(46,len_trim(
vname(2,ifield)))
726 WRITE (
stdout,60)
vname(2,ifield)(1:lvar), t_code, &
727 & ng, trec, tindex,
ncfile(lstr:lend), &
728 & tmin, tmax, tval, fmin, fmax, rswitch
743 IF (.not.lonerec.and.(.not.special))
THEN
744 tdelta=
vtime(tindex,ifield,ng)-
vtime(3-tindex,ifield,ng)
745 IF (liocycle.and.(tdelta.lt.0.0_r8))
THEN
746 tdelta=tdelta+clength
749 finfo(7,ifield,ng)=tmono
750 tintrp(tindex,ifield,ng)=tmono
754 10
FORMAT (/,
' GET_2DFLD_PIO - unable to find dimension ',a, &
755 & /,17x,
'for variable: ',a,/,17x,
'in file: ',a, &
756 & /,17x,
'file is not CF compliant...')
757 20
FORMAT (/,
' GET_2DFLD_PIO - unable to find requested variable:', &
758 & 1x,a,/,17x,
'in ',a)
759 30
FORMAT (/,
' GET_2DFLD_PIO - unable to open input NetCDF', &
761 40
FORMAT (/,
' GET_2DFLD_PIO - error while reading variable: ',a, &
762 & 2x,
' at TIME index = ',i0)
763 50
FORMAT (2x,
'GET_2DFLD_PIO - ',a,/,22x,
'(Grid = ',i2.2, &
764 &
', Min = ',1p,e15.8,0p,
' Max = ',1p,e15.8,0p,
')')
765 60
FORMAT (2x,
'GET_2DFLD_PIO - ',a,
',',t75,a,/,22x, &
766 &
'(Grid=',i2.2,
', Rec=',i0,
', Index=',i1, &
767 &
', File: ',a,
')',/,22x, &
768 &
'(Tmin= ', f15.4,
' Tmax= ', f15.4,
')', &
769 & t71,
't = ', f15.4 ,/,22x, &
770 &
'(Min = ', 1p,e15.8,0p,
' Max = ',1p,e15.8,0p,
')', &
771 & t71,
'regrid = ',a)
773 70
FORMAT (22x,
'(CheckSum = ',i0,
')')
subroutine get_2dfld_nf90(ng, model, ifield, ncid, nfiles, s, update, lbi, ubi, lbj, ubj, iout, irec, fmask, fout)
subroutine get_2dfld(ng, model, ifield, ncid, piofile, nfiles, s, update, lbi, ubi, lbj, ubj, iout, irec, fmask, fout)
subroutine get_2dfld_pio(ng, model, ifield, piofile, nfiles, s, update, lbi, ubi, lbj, ubj, iout, irec, fmask, fout)
subroutine, public time_string(mytime, date_string)
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 fpoint
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
integer, parameter u2dvar
integer, parameter p2dvar
integer, parameter r2dvar
integer, parameter v2dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_u2dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_r2dvar
type(io_desc_t), dimension(:), pointer iodesc_dp_rtides
type(io_desc_t), dimension(:), pointer iodesc_dp_u2dvar
type(io_desc_t), dimension(:), pointer iodesc_dp_p2dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_rtides
type(io_desc_t), dimension(:), pointer iodesc_dp_v2dvar
type(io_desc_t), dimension(:), pointer iodesc_dp_r2dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_p2dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_v2dvar
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)