CFIO_AttInquire Subroutine

public subroutine CFIO_AttInquire(fid, name, type, count, rc)

CFIO_AttInquire – Get information about an attribute

This routine allows the user to get information about a global attribute of an open CFIO file. This is most useful for determining the number of values stored in an attribute.

@note Note The returned integer “type” for 64-bit integer is not supported in the current implementation of netCDF/HDF. When a user writes a 64-bit integer attribute using PutIntAtt, it is actually saved as a 64-bit real by the HDF library. Thus, upon reading the attribute, there is no way for HDF/CFIO to distinguish it from a REAL number. The user must realize this variable is really an integer and call GetIntAtt to read it. Even for a 64-bit integer, type=4 will never be returned unless there are changed to HDF/netCDF.

History

  • 1998.07.30 Lucchesi Initial interface design.
  • 1998.07.30 Lucchesi Initial coding.
  • 1998.09.24 Lucchesi Changed error codes, added type assignment.

Arguments

Type IntentOptional Attributes Name
integer :: fid

File handle

character(len=*) :: name

Name of attribute

integer :: type

Code for attribute type 0 = integer 1 = real 2 = character 3 = 64-bit real 4 = 64-bit integer -1 = other

integer :: count

Number of items (length of array)

integer :: rc

Error return code: rc = 0 all is well

NetCDF Errors


rc = -58 error from NF90_INQUIRE_ATTRIBUTE


Calls

proc~~cfio_attinquire~~CallsGraph proc~cfio_attinquire CFIO_AttInquire nf90_inquire_attribute nf90_inquire_attribute proc~cfio_attinquire->nf90_inquire_attribute proc~err err proc~cfio_attinquire->proc~err

Called by

proc~~cfio_attinquire~~CalledByGraph proc~cfio_attinquire CFIO_AttInquire proc~esmf_cfiosdffileopen ESMF_CFIOSdfFileOpen proc~esmf_cfiosdffileopen->proc~cfio_attinquire proc~esmf_cfiofileopen ESMF_CFIOFileOpen proc~esmf_cfiofileopen->proc~esmf_cfiosdffileopen none~find~4 CFIOCollection%find none~find~4->proc~esmf_cfiofileopen proc~mapl_cfioopenwrite MAPL_CFIOOpenWrite proc~mapl_cfioopenwrite->proc~esmf_cfiofileopen program~test~11 test program~test~11->proc~esmf_cfiofileopen program~test~2 test program~test~2->proc~esmf_cfiofileopen program~test~4 test program~test~4->proc~esmf_cfiofileopen program~test~6 test program~test~6->proc~esmf_cfiofileopen proc~mapl_cfiocreatefromfile MAPL_CFIOCreateFromFile proc~mapl_cfiocreatefromfile->none~find~4 proc~mapl_cfioreadbundleread MAPL_CFIOReadBundleRead proc~mapl_cfioreadbundleread->none~find~4

Source Code

      subroutine CFIO_AttInquire ( fid, name, type, count, rc )
!
! !USES:
!
      Implicit NONE
!
! !INPUT PARAMETERS:
!
      integer        fid        !! File handle
      character(len=*)  name       !! Name of attribute
!
! !OUTPUT PARAMETERS:
!
      integer type       !! Code for attribute type
                         !!   0 = integer
                         !!   1 = real
                         !!   2 = character
                         !!   3 = 64-bit real
                         !!   4 = 64-bit integer
                         !!  -1 = other
      integer count      !! Number of items (length of array)
      integer rc         !! Error return code:
                         !!   rc = 0    all is well
                         !!
                         !!  NetCDF Errors
                         !!  -------------
                         !!   rc = -58  error from NF90_INQUIRE_ATTRIBUTE

!
!-------------------------------------------------------------------------

      integer nctype

      rc = NF90_INQUIRE_ATTRIBUTE (fid, NF90_GLOBAL, name, nctype, count)
      if (err("AttInquire: error reading attribute info",rc,-58) &
           .NE. 0) return
      if (nctype .EQ. NF90_INT) then
        type = 0
      elseif (nctype .EQ. NF90_FLOAT) then
        type = 1
      elseif (nctype .EQ. NCCHAR) then
        type = 2
      elseif (nctype .EQ. NF90_DOUBLE) then
        type = 3
      else
        type = -1
      endif

      rc = 0
      return
      end subroutine CFIO_AttInquire