ESMF_CFIOGet Subroutine

public subroutine ESMF_CFIOGet(cfio, cfioObjName, nVars, varObjs, grid, nGrids, grids, fName, title, source, contact, history, convention, institution, references, comment, date, begTime, timeInc, nSteps, prec, attCharNames, nAttChar, attCharCnts, attChars, attRealNames, nAttReal, attRealCnts, attReals, attIntNames, nAttInt, attIntCnts, attInts, attCharName, attCharCnt, attChar, attRealName, attRealCnt, attReal, attIntName, attIntCnt, attInt, isOpen, format, fNameTmplt, rc)

ESMF_CFIOGet – Get meta data from a CFIO object

Get meta data from a CFIO file.

Arguments

Type IntentOptional Attributes Name
type(ESMF_CFIO), intent(in) :: cfio

a CFIO object

character(len=*), intent(out), optional :: cfioObjName

CFIO Obj name

integer, optional :: nVars

number of variable objects

type(ESMF_CFIOVarInfo), optional, pointer :: varObjs(:)

var objects

type(ESMF_CFIOGrid), optional, pointer :: grid
integer, optional :: nGrids

number of grids

type(ESMF_CFIOGrid), optional, pointer :: grids(:)

grid array

character(len=*), intent(out), optional :: fName

File name

character(len=*), intent(out), optional :: title
character(len=*), intent(out), optional :: source

Source of data

character(len=*), intent(out), optional :: contact

Who to contact

character(len=*), intent(out), optional :: history
character(len=*), intent(out), optional :: convention

CFIO or COARDS

character(len=*), intent(out), optional :: institution

File name

character(len=*), intent(out), optional :: references
character(len=*), intent(out), optional :: comment
integer, intent(out), optional :: date

yyyymmdd

integer, intent(out), optional :: begTime

hhmmss

integer, intent(out), optional :: timeInc

time step increment

integer, intent(out), optional :: nSteps

number of time steps

integer, intent(out), optional :: prec

Desired precision of data: 0 = 32 bit; 1 = 64 bit

character(len=*), optional, pointer :: attCharNames(:)

User defined global char attribute names

integer, intent(out), optional :: nAttChar

Number of char attributes

integer, optional, pointer :: attCharCnts(:)

length of attributes

character(len=*), optional, pointer :: attChars(:)

User defined global char attribute

character(len=*), optional, pointer :: attRealNames(:)

User defined global real attribute names

integer, intent(out), optional :: nAttReal

Number of Real attributes

integer, optional, pointer :: attRealCnts(:)

length of attributes

real, optional, pointer :: attReals(:,:)

User defined global real attribute

character(len=*), optional, pointer :: attIntNames(:)

User defined global int attribute names

integer, intent(out), optional :: nAttInt

Number of int attributes

integer, optional, pointer :: attIntCnts(:)

length of attributes

integer, optional, pointer :: attInts(:,:)

User defined global int attribute

character(len=*), intent(in), optional :: attCharName

User defined global char attribute name

integer, intent(out), optional :: attCharCnt
character(len=*), intent(out), optional :: attChar

User defined global char attribute

character(len=*), intent(in), optional :: attRealName

User defined global real attribute name

integer, intent(out), optional :: attRealCnt
real, optional, pointer :: attReal(:)

User defined global real attribute

character(len=*), intent(in), optional :: attIntName

User defined global int attribute name

integer, intent(out), optional :: attIntCnt
integer, optional, pointer :: attInt(:)

User defined global int attribute

logical, intent(out), optional :: isOpen
character(len=*), intent(out), optional :: format
character(len=*), intent(out), optional :: fNameTmplt

File name

integer, intent(out), optional :: rc

Error return code:
0 all is well
-1 can’t allocate memory for grid(s)
-2 can’t allocate memory: varObjs
-3 can’t allocate mem: attCharNames
-4 can’t allocate mem: attRealNames
-5 can’t allocate mem: attIntNames
-6 can’t allocate mem: attCharCnts
-7 can’t allocate mem: attRealCnts
-8 can’t allocate mem: attIntCnts
-9 can’t allocate mem: attChars
-10 can’t allocate mem: attReals
-11 can’t allocate mem: attInts
-12 can’t allocate mem: attInt
rc = -19 unable to identify coordinate variable
rc = -40 error from NF90_INQ_VARID
rc = -41 error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (lat or lon)
rc = -42 error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (lev)
rc = -43 error from NF90_INQ_VARID (time variable)
rc = -47 error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (time)
rc = -48 error from NF90_INQUIRE
rc = -53 error from NF90_GET_ATT


Calls

proc~~esmf_cfioget~~CallsGraph proc~esmf_cfioget ESMF_CFIOGet proc~err err proc~esmf_cfioget->proc~err

Called by

proc~~esmf_cfioget~~CalledByGraph proc~esmf_cfioget ESMF_CFIOGet proc~esmf_cfiofileclose ESMF_CFIOFileClose proc~esmf_cfiofileclose->proc~esmf_cfioget proc~esmf_cfiofileopen ESMF_CFIOFileOpen proc~esmf_cfiofileopen->proc~esmf_cfioget proc~esmf_cfiosdffilecreate ESMF_CFIOSdfFileCreate proc~esmf_cfiosdffilecreate->proc~esmf_cfioget proc~mapl_cfiocreatefromfile MAPL_CFIOCreateFromFile proc~mapl_cfiocreatefromfile->proc~esmf_cfioget none~find~33 CFIOCollection%find proc~mapl_cfiocreatefromfile->none~find~33 program~test test program~test->proc~esmf_cfioget program~test->proc~esmf_cfiofileclose program~test->proc~esmf_cfiofileopen program~test~10 test program~test~10->proc~esmf_cfioget program~test~10->proc~esmf_cfiofileclose program~test~10->proc~esmf_cfiofileopen program~test~11 test program~test~11->proc~esmf_cfioget program~test~11->proc~esmf_cfiofileclose proc~esmf_cfiofilecreate ESMF_CFIOFileCreate program~test~11->proc~esmf_cfiofilecreate program~test~12 test program~test~12->proc~esmf_cfioget program~test~12->proc~esmf_cfiofileclose program~test~12->proc~esmf_cfiofilecreate program~test~14 test program~test~14->proc~esmf_cfioget program~test~14->proc~esmf_cfiofileclose program~test~14->proc~esmf_cfiofilecreate program~test~2 test program~test~2->proc~esmf_cfioget program~test~2->proc~esmf_cfiofileclose program~test~2->proc~esmf_cfiofileopen program~test~2->proc~esmf_cfiofilecreate program~test~3 test program~test~3->proc~esmf_cfioget program~test~3->proc~esmf_cfiofileclose program~test~3->proc~esmf_cfiofilecreate program~test~4 test program~test~4->proc~esmf_cfioget program~test~4->proc~esmf_cfiofileclose program~test~4->proc~esmf_cfiofileopen program~test~5 test program~test~5->proc~esmf_cfioget program~test~5->proc~esmf_cfiofileclose program~test~5->proc~esmf_cfiofilecreate program~test~7 test program~test~7->proc~esmf_cfioget program~test~7->proc~esmf_cfiofileclose program~test~7->proc~esmf_cfiofilecreate program~test~8 test program~test~8->proc~esmf_cfioget program~test~8->proc~esmf_cfiofileclose program~test~8->proc~esmf_cfiofilecreate program~test~9 test program~test~9->proc~esmf_cfioget program~test~9->proc~esmf_cfiofileclose program~test~9->proc~esmf_cfiofilecreate none~find~33->proc~esmf_cfiofileopen proc~esmf_cfiofilecreate->proc~esmf_cfiosdffilecreate proc~mapl_cfioclose MAPL_CFIOClose proc~mapl_cfioclose->proc~esmf_cfiofileclose proc~mapl_cfiodestroy MAPL_CFIODestroy proc~mapl_cfiodestroy->proc~esmf_cfiofileclose proc~mapl_cfioopenwrite MAPL_CFIOOpenWrite proc~mapl_cfioopenwrite->proc~esmf_cfiofileopen program~test~6 test program~test~6->proc~esmf_cfiofileclose program~test~6->proc~esmf_cfiofilecreate interface~esmf_iodestroy ESMF_ioDestroy interface~esmf_iodestroy->proc~mapl_cfiodestroy proc~mapl_cfiocreatewrite MAPL_CFIOCreatewrite proc~mapl_cfiocreatewrite->proc~esmf_cfiofilecreate proc~mapl_cfioreadbundleread MAPL_CFIOReadBundleRead proc~mapl_cfioreadbundleread->none~find~33 proc~test_main~5 test_main proc~test_main~5->interface~esmf_iodestroy

Source Code

      subroutine ESMF_CFIOGet (cfio, cfioObjName, nVars, varObjs, grid,     &
                              nGrids, grids, fName, title, source, contact, &
                              history, convention, institution, references, &
                              comment, date, begTime, timeInc, nSteps, prec,&
                              attCharNames, nAttChar, attCharCnts, attChars,&
                              attRealNames, nAttReal, attRealCnts, attReals,&
                              attIntNames, nAttInt, attIntCnts, attInts,    &
                              attCharName, attCharCnt, attChar, attRealName,&
                              attRealCnt, attReal, attIntName, attIntCnt,   &
                              attInt, isOpen, format, fNameTmplt, rc )
!
! !INPUT PARAMETERS:
!
       type(ESMF_CFIO), intent(in) :: cfio       !! a CFIO object
       character(len=*), intent(in), OPTIONAL :: attCharName !! User defined global char attribute name
       character(len=*), intent(in), OPTIONAL :: attRealName !! User defined global real attribute name
       character(len=*), intent(in), OPTIONAL :: attIntName !! User defined global int attribute name
!
! !OUTPUT PARAMETERS:
!
       character(len=*), intent(out), OPTIONAL :: cfioObjName !! CFIO Obj name
       integer, OPTIONAL :: nVars          !! number of variable objects
       type(ESMF_CFIOVarInfo), pointer, OPTIONAL :: varObjs(:)!! var objects
       integer, OPTIONAL :: nGrids                   !! number of grids
       type(ESMF_CFIOGrid), pointer, OPTIONAL :: grids(:)    !! grid array
       type(ESMF_CFIOGrid), pointer, OPTIONAL :: grid
       character(len=*), intent(out), OPTIONAL :: fName      !! File name
       character(len=*), intent(out), OPTIONAL :: fNameTmplt !! File name
       character(len=*), intent(out), OPTIONAL :: title
       character(len=*), intent(out), OPTIONAL :: source     !! Source of data
       character(len=*), intent(out), OPTIONAL :: contact    !! Who to contact
       character(len=*), intent(out), OPTIONAL :: history    !!
       character(len=*), intent(out), OPTIONAL :: convention !! CFIO or COARDS
       character(len=*), intent(out), OPTIONAL :: institution!! File name
       character(len=*), intent(out), OPTIONAL :: references
       character(len=*), intent(out), OPTIONAL :: comment
       integer, intent(out), OPTIONAL :: date          !! yyyymmdd
       integer, intent(out), OPTIONAL :: begTime       !! hhmmss
       integer, intent(out), OPTIONAL :: timeInc      !! time step increment
       integer, intent(out), OPTIONAL :: nSteps       !! number of time steps
       integer, intent(out), OPTIONAL :: prec     !! Desired precision of data:
                                                  !! 0 = 32 bit; 1 = 64 bit
       integer, intent(out), OPTIONAL :: nAttChar !! Number of char attributes
       integer, intent(out), OPTIONAL :: nAttReal !! Number of Real attributes
       integer, intent(out), OPTIONAL :: nAttInt  !! Number of int attributes
       character(len=*), pointer, OPTIONAL :: attCharNames(:) !! User defined global char attribute names
       character(len=*), pointer, OPTIONAL :: attRealNames(:) !! User defined global real attribute names
       character(len=*), pointer, OPTIONAL :: attIntNames(:) !! User defined global int attribute names
       integer, pointer, OPTIONAL :: attCharCnts(:)!! length of attributes
       integer, pointer, OPTIONAL :: attRealCnts(:)!! length of attributes
       integer, pointer, OPTIONAL :: attIntCnts(:) !! length of attributes
       character(len=*), pointer, OPTIONAL :: attChars(:) !! User defined global char attribute
       real,      pointer, OPTIONAL :: attReals(:,:) !! User defined global real attribute
       integer,   pointer, OPTIONAL :: attInts(:,:) !! User defined global int attribute

       integer, intent(out), OPTIONAL :: attIntCnt
       integer, intent(out), OPTIONAL :: attRealCnt
       integer, intent(out), OPTIONAL :: attCharCnt
       character(len=*), intent(out), OPTIONAL :: attChar !! User defined global char attribute
       real,    pointer, OPTIONAL :: attReal(:) !! User defined global real attribute
       integer, pointer, OPTIONAL :: attInt(:) !! User defined global int attribute
       logical, intent(out), OPTIONAL :: isOpen
       character(len=*), intent(out), OPTIONAL :: format

       integer, intent(out), OPTIONAL :: rc      !! Error return code:    
                         !!  0   all is well  
                         !! -1  can't allocate memory for grid(s)  
                         !! -2  can't allocate memory: varObjs    
                         !! -3  can't allocate mem: attCharNames    
                         !! -4  can't allocate mem: attRealNames    
                         !! -5  can't allocate mem: attIntNames    
                         !! -6  can't allocate mem: attCharCnts    
                         !! -7  can't allocate mem: attRealCnts    
                         !! -8  can't allocate mem: attIntCnts    
                         !! -9  can't allocate mem: attChars    
                         !! -10  can't allocate mem: attReals    
                         !! -11  can't allocate mem: attInts    
                         !! -12  can't allocate mem: attInt    
                         !!  rc = -19  unable to identify coordinate variable    
                         !!  rc = -40  error from NF90_INQ_VARID    
                         !!  rc = -41  error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (lat or lon)    
                         !!  rc = -42  error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (lev)    
                         !!  rc = -43  error from NF90_INQ_VARID (time variable)    
                         !!  rc = -47  error from NF90_INQ_DIMID or NF90_INQUIRE_DIMENSION (time)    
                         !!  rc = -48  error from NF90_INQUIRE    
                         !!  rc = -53  error from NF90_GET_ATT    
!
!------------------------------------------------------------------------------
       integer :: rtcode
       integer :: i

       if ( present(cfioObjName) ) cfioObjName =cfio%cfioObjName

       if ( present(fName) ) fName =cfio%fName 
       if ( present(fNameTmplt) ) fNameTmplt =cfio%fNameTmplt
       if ( present(title) ) title = cfio%title
       if ( present(source) ) source = cfio%source 
       if ( present(contact) ) contact = cfio%contact
       if ( present(history) ) history = cfio%history 
       if ( present(convention) ) convention = cfio%convention
       if ( present(institution) ) institution = cfio%institution 
       if ( present(references) ) references = cfio%references 
       if ( present(comment) ) comment = cfio%comment 
       if ( present(date) ) date = cfio%date 
       if ( present(begTime) ) begTime = cfio%begTime
       if ( present(timeInc) ) timeInc = cfio%timeInc
       if ( present(prec) ) prec = cfio%prec
       if ( present(isOpen) ) isOpen = cfio%isOpen
       if ( present(format) ) format = cfio%format
       if ( present(nSteps) ) nSteps = cfio%tSteps
       if ( present(nVars) ) nVars  = cfio%mVars   
       if ( present(nGrids) ) nGrids = cfio%mGrids  
       if ( present(grids) ) then
          allocate(grids(size(cfio%grids)), stat=rtcode)
          if (err("can't allocate memory for grids",rtcode,-1) .lt. 0 ) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          grids = cfio%grids
       end if
       if ( present(grid) ) then
          allocate(grid, stat=rtcode)
          if (err("can't allocate memory for grid",rtcode,-1) .lt. 0 ) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          grid = cfio%grids(1)
       end if
                                                                                     
       if ( present(varObjs) ) then
          allocate(varObjs(size(cfio%varObjs)), stat=rtcode)
          if (err("can't allocate memory: varObjs",rtcode,-2) .lt. 0 ) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          varObjs = cfio%varObjs
       end if

       if ( present(nAttChar) ) nAttChar = cfio%nAttChar
       if ( present(nAttReal) ) nAttReal = cfio%nAttReal
       if ( present(nAttInt) ) nAttInt = cfio%nAttInt

!      get global attribute names as an array.
       if ( present(attCharNames) ) then
          allocate(attCharNames(cfio%nAttChar), stat=rtcode)
          if (err("can't allocate mem: attCharNames",rtcode,-3) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          attCharNames = cfio%attCharNames
       end if
       if ( present(attRealNames) ) then
          allocate(attRealNames(cfio%nAttReal), stat=rtcode)
          if (err("can't allocate mem: attRealNames",rtcode,-4) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          attRealNames = cfio%attRealNames
       end if
       if ( present(attIntNames) ) then
          allocate(attIntNames(cfio%nAttInt), stat=rtcode)
          if (err("can't allocate mem: attIntNames",rtcode,-5) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          attIntNames = cfio%attIntNames
       end if

!      get global attribute counts as an array.
       if ( present(attCharCnts) ) then
          allocate(attCharCnts(cfio%nAttChar), stat=rtcode)
          if (err("can't allocate mem: attCharCnts",rtcode,-6) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          attCharCnts = cfio%attCharCnts
       end if
       if ( present(attRealCnts) ) then
          allocate(attRealCnts(cfio%nAttReal), stat=rtcode)
          if (err("can't allocate mem: attRealCnts",rtcode,-7) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          attRealCnts = cfio%attRealCnts
       end if
       if ( present(attIntCnts) ) then
          allocate(attIntCnts(cfio%nAttInt), stat=rtcode)
          if (err("can't allocate mem: attIntCnts",rtcode,-8) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          attIntCnts = cfio%attIntCnts
       end if

!      get global attributes as an array.
       if ( present(attChars) ) then
          allocate(attChars(cfio%nAttChar), stat=rtcode)
          if (err("can't allocate mem: attChars",rtcode,-9) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          attChars= cfio%attChars
       end if
       if ( present(attReals) ) then
          allocate(attReals(cfio%nAttReal,size(cfio%attReals)/  &
                   cfio%nAttReal), stat=rtcode)
          if (err("can't allocate mem: attReals",rtcode,-10) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          attReals= cfio%attReals
       end if
       if ( present(attInts) ) then
          allocate(attInts(cfio%nAttInt,size(cfio%attInts)/  &
                   cfio%nAttInt), stat=rtcode)
          if (err("can't allocate mem: attInts",rtcode,-11) .lt. 0) then  
             if ( present(rc) ) rc = rtcode
             return
          end if

          attInts= cfio%attInts
       end if

!      provide attIntName and get its count and data
       if ( present(attIntName) ) then
          if ( present(attIntCnt) ) then
             do i = 1, cfio%nAttInt
                if (trim(attIntName) .eq. trim(cfio%attIntNames(i))) &
                    then
                   attIntCnt = cfio%attIntCnts(i)
                end if
             end do
          end if
          if ( present(attInt) ) then
             do i = 1, cfio%nAttInt
                if (trim(attIntName) .eq. trim(cfio%attIntNames(i)))&
                    then
                   allocate(attInt(cfio%attIntCnts(i)))
                   if (err("can't allocate mem: attInt",rtcode,-12) .lt. 0) &
                      then  
                      if ( present(rc) ) rc = rtcode
                      return
                   end if

                   attInt = cfio%attInts(i,1:cfio%attIntCnts(i))
                end if
             end do
          end if
       end if

!      provide attRealName and get its count and data
       if ( present(attRealName) ) then
          if ( present(attRealCnt) ) then
             do i = 1, cfio%nAttReal
                if (trim(attRealName) .eq. trim(cfio%attRealNames(i))) &
                    then
                   attRealCnt = cfio%attRealCnts(i)
                end if
             end do
          end if
          if ( present(attReal) ) then
             do i = 1, cfio%nAttReal
                if (trim(attRealName) .eq. trim(cfio%attRealNames(i)))&
                    then
                   allocate(attReal(cfio%attRealCnts(i)))
                   attReal = cfio%attReals(i,1:cfio%attRealCnts(i))
                end if
             end do
          end if
       end if

!      provide attCharName and get its count and data
       if ( present(attCharName) ) then
          if ( present(attCharCnt) ) then
             do i = 1, cfio%nAttChar
                if (trim(attCharName) .eq. trim(cfio%attCharNames(i))) &
                    then
                   attCharCnt = cfio%attCharCnts(i)
                end if
             end do
          end if
          if ( present(attChar) ) then
             do i = 1, cfio%nAttChar
                if (trim(attCharName) .eq. trim(cfio%attCharNames(i)))&
                    then
                   attChar = trim(cfio%attChars(i))
                end if
             end do
          end if
       end if

       rtcode = 0
       if ( present(rc) ) rc = rtcode

      end subroutine ESMF_CFIOGet