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
Intent
Optional
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
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Source Code
subroutine CFIO_AttInquire(fid,name,type,count,rc)!! !USES:!Implicit NONE!! !INPUT PARAMETERS:!integer fid!! File handlecharacter(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 = otherinteger 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 nctyperc=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=0elseif(nctype.EQ.NF90_FLOAT)then type=1elseif(nctype.EQ.NCCHAR)then type=2elseif(nctype.EQ.NF90_DOUBLE)then type=3else type=-1endifrc=0return end subroutine CFIO_AttInquire