spacepy.pycdf.AttrList¶
-
class
spacepy.pycdf.
AttrList
(cdf_file, special_entry=None)[source]¶ Object representing a list of attributes.
Warning
This class should not be used directly, but only via its subclasses,
gAttrList
andzAttrList
. Methods listed here are safe to use from the subclasses.clone
(master[, name, new_name])Clones another attribute list, or one attribute from it, into this list. copy
()Create a copy of this attribute list from_dict
(in_dict)Fill this list of attributes from a dictionary new
(name[, data, type])Create a new Attr in this AttrList rename
(old_name, new_name)Rename an attribute in this list -
clone
(master, name=None, new_name=None)[source]¶ Clones another attribute list, or one attribute from it, into this list.
Parameters: master : AttrList
the attribute list to copy from. This can be any dict-like object.
Other Parameters: name : str (optional)
name of attribute to clone (default: clone entire list)
new_name : str (optional)
name of the new attribute, default
name
-
copy
()[source]¶ Create a copy of this attribute list
Returns: out : dict
copy of the entries for all attributes in this list
-
from_dict
(in_dict)[source]¶ Fill this list of attributes from a dictionary
Deprecated since version 0.1.5: Use
clone()
instead; it supports cloning from dictionaries.Parameters: in_dict : dict
Attribute list is populated entirely from this dictionary; all existing attributes are deleted.
-
new
(name, data=None, type=None)[source]¶ Create a new Attr in this AttrList
Parameters: name : str
name of the new Attribute
Other Parameters: data
data to put into the first entry in the new Attribute
type
CDF type of the first entry from
const
. Only used if data are specified.Raises: KeyError : if the name already exists in this list
-