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 and zAttrList. 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
masterAttrList

the attribute list to copy from. This can be any dict-like object.

Other Parameters
namestr (optional)

name of attribute to clone (default: clone entire list)

new_namestr (optional)

name of the new attribute, default name

copy()[source]

Create a copy of this attribute list

Returns
outdict

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_dictdict

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
namestr

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
KeyErrorif the name already exists in this list
rename(old_name, new_name)[source]

Rename an attribute in this list

Renaming a zAttribute renames it for all zVariables in this CDF!

Parameters
old_namestr

the current name of the attribute

new_namestr

the new name of the attribute