ESMF_CFIOFileOpen
– open a CFIO file, and get CFIO meta data into a cfio Object.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ESMF_CFIO), | intent(inout) | :: | cfio |
a CFIO object |
||
integer, | intent(in) | :: | fmode |
0 for READ-WRITE non-zero for READ-ONLY |
||
integer, | intent(out), | optional | :: | rc |
Error return code: 0 all is well -1 invalid count -2 type mismatch -12 error determining default precision -10 ngatts is incompatible with file -11 character string not long enough -19 unable to identify coordinate variable -36 error from NF90_PUT_ATT (global attribute) -39 error from NF90_OPEN (file open) -40 error from NF90_INQ_VARID -41 error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (lat or lon) -42 error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (lev) -43 error from NF90_INQ_VARID (time variable) -47 error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (time) -48 error from NF90_INQUIRE -51 error from NF90_GET_ATT (global attribute) -52 error from NF90_INQUIRE_VARIABLE -53 error from NF90_GET_ATT -57 error from NF90_INQ_ATTNAME -58 error from NF90_INQUIRE_ATTRIBUTE |
|
character(len=*), | intent(in), | optional | :: | expid |
Experiment ID |
|
logical, | intent(in), | optional | :: | cyclic |
cyclic input file |
subroutine ESMF_CFIOFileOpen (cfio, fmode, rc, expid, cyclic) ! ! !INPUT PARAMETERS: ! integer, intent(in) :: fmode !! 0 for READ-WRITE !! non-zero for READ-ONLY character(len=*), intent(in), OPTIONAL :: expid !! Experiment ID logical, intent(in), OPTIONAL :: cyclic !! cyclic input file ! ! !OUTPUT PARAMETERS: ! integer, intent(out), OPTIONAL :: rc !! Error return code: !! 0 all is well !! -1 invalid count !! -2 type mismatch !! -12 error determining default precision !! -10 ngatts is incompatible with file !! -11 character string not long enough !! -19 unable to identify coordinate variable !! -36 error from NF90_PUT_ATT (global attribute) !! -39 error from NF90_OPEN (file open) !! -40 error from NF90_INQ_VARID !! -41 error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (lat or lon) !! -42 error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (lev) !! -43 error from NF90_INQ_VARID (time variable) !! -47 error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (time) !! -48 error from NF90_INQUIRE !! -51 error from NF90_GET_ATT (global attribute) !! -52 error from NF90_INQUIRE_VARIABLE !! -53 error from NF90_GET_ATT !! -57 error from NF90_INQ_ATTNAME !! -58 error from NF90_INQUIRE_ATTRIBUTE ! ! !INPUT/OUTPUT PARAMETERS: ! type(ESMF_CFIO), intent(inout) :: cfio !! a CFIO object ! !------------------------------------------------------------------------------ integer :: rtcode character(len=16) :: dset character(len=16) :: format logical :: ex character(len=MLEN) :: fileName logical :: myCyclic if (present(expid)) call ESMF_CFIOSet(cfio, expid = expid) myCyclic = .false. if (present(cyclic)) then call ESMF_CFIOSet(cfio, isCyclic = cyclic) myCyclic = cyclic end if call ESMF_CFIOGet(cfio, fName=fileName) inquire(file=fileName, EXIST=ex) if ( .not. ex ) then print *, trim(fileName), "doesn't exist" return end if open(11, file=fileName) read(11, '(a)') dset close(11) format = 'SDF' if (index(dset,'DSET') .ge. 1 .or. index(dset,'dset') .ge. 1 & .or. index(dset,'Dset') .ge. 1 ) then call ESMF_CFIOSet(cfio, format='GRADS') format = 'GRADS' end if select case (format) case ('SDF') if ( present(expid) ) then call ESMF_CFIOSdfFileOpen (cfio, fmode, rc=rtcode, expid=expid, cyclic=myCyclic) else call ESMF_CFIOSdfFileOpen (cfio, fmode, rc=rtcode, cyclic=myCyclic) end if if (rtcode .ne. 0) print *, "Error in ESMF_CFIOSdfFileOpen" if ( present(rc) ) rc = rtcode return end select end subroutine ESMF_CFIOFileOpen