- class spacepy.pycdf.zAttrList(zvar)[source]¶
Object representing all the zAttributes in a zVariable.
Normally accessed as an attribute of a
Varin an open CDF:
>>> epoch_attribs = cdffile['Epoch'].attrs
Appears as a dictionary: keys are attribute names, values are the value of the zEntry associated with the appropriate zVariable. Each vAttribute in a CDF may only have a single entry associated with each variable. The entry may be a string, a single numerical value, or a series of numerical values. Entries with multiple values are returned as an entire list; direct access to the individual elements is not possible.
Example: finding the first dependency of (ISTP-compliant) variable
>>> print cdffile['Flux'].attrs['DEPEND_0']
zAttributes are shared among zVariables, one zEntry allowed per zVariable. (pyCDF hides this detail.) Deleting the last zEntry for a zAttribute will delete the underlying zAttribute.
zEntries are created and destroyed by the usual dict methods on the zAttrlist:
>>> epoch_attribs['new_entry'] = [1, 2, 4] #assign a list to new zEntry >>> del epoch_attribs['new_entry'] #delete the zEntry
The type of the zEntry is guessed from data provided. The type is chosen to match the data; subject to that constraint, it will try to match (in order):
existing zEntry corresponding to this zVar
other zEntries in this zAttribute
the type of this zVar
data-matching constraints described in