An attribute, g or z, for a CDF
Warning
This class should not be used directly, but only in its subclasses, gAttr and zAttr. The methods listed here are safe to use in the subclasses.
Represents a CDF attribute, providing access to the Entries in a format that looks like a Python list. General list information is available in the python docs: 1, 2, 3.
An introduction to CDF attributes can be found in section 2.4 of the CDF user’s guide.
Each element of the list is a single Entry of the appropriate type. The index to the elements is the Entry number.
Multi-dimensional slicing is not supported; an Entry with multiple elements will have all elements returned (and can thus be sliced itself). Example:
>>> first_three = attribute[5, 0:3] #will fail
>>> first_three = attribute[5][0:3] #first three elements of 5th Entry
has_entry(number) | Check if this attribute has a particular Entry number |
max_idx() | Maximum index of Entries for this Attr |
new(data[, type, number]) | Create a new Entry in this Attribute |
number() | Find the attribute number for this attribute |
rename(new_name) | Rename this attribute |
type(number[, new_type]) | Find or change the CDF type of a particular Entry number |
Check if this attribute has a particular Entry number
Parameters: | number : int
|
---|---|
Returns: | out : bool
|
Create a new Entry in this Attribute
Note
If number is provide and an Entry with that number already exists, it will be overwritten.
Parameters: | data :
|
---|---|
Other Parameters: | |
type : int
number : int
|
Rename this attribute
Renaming a zAttribute renames it for all zVariables in this CDF!
Parameters: | new_name : str
|
---|
Find or change the CDF type of a particular Entry number
Parameters: | number : int
|
---|---|
Returns: | out : int
|
Other Parameters: | |
new_type :
|
Notes
If changing types, old and new must be equivalent, see CDF User’s Guide section 2.5.5 pg. 57