The NCDF_ATTINQ function returns a structure that contains information about a netCDF attribute. This structure, described below, has the form:
id = NCDF_CREATE('test.nc', /CLOBBER) ; Open a new netCDF file.
id2 = NCDF_CREATE('test2.nc', /CLOBBER) ; Open a second file.
Create two global attributes TITLE and DATE:
NCDF_ATTPUT, id, /GLOBAL, 'TITLE', 'MY TITLE'
;
Insert a global attribute.
NCDF_ATTPUT, id, /GLOBAL, 'DAY', 'July 1,1996'
;
Insert a global attribute.
Suppose we wanted to use DATE instead of DAY. We could use ATTRENAME to rename the attribute:
NCDF_ATTRENAME, id, 'DAY', 'DATE', /GLOBAL
Next, copy both attributes into a duplicate file:
result = NCDF_ATTCOPY(id, 'TITLE', id2, /IN_GLOBAL, /OUT_GLOBAL)
result2 = NCDF_ATTCOPY(id, 'DATE', id2, /IN_GLOBAL, /OUT_GLOBAL)
NCDF_CONTROL, id, /ENDEF ; Put the file into data mode.
name = NCDF_ATTNAME(id, /GLOBAL, 1) ; Get the second attribute's name.
NCDF_ATTGET, id, /GLOBAL, name, date ; Retrieve the date.
result = NCDF_ATTINQ(id, /GLOBAL, name) ; Get info about the attribute.
HELP, name, date, result, /STRUCTURE
** Structure <400dac30>, 2 tags, length=12, refs=1:
Note the length includes the NCDF standard NULL terminator
74 117 108 121 32 49 44 49 57 57 54 0