spacepy.pybats.PbData

class spacepy.pybats.PbData(*args, **kwargs)[source]

The base class for all PyBats data container classes. Inherits from spacepy.datamodel.SpaceData but has additional methods for quickly exploring an SWMF dataset.

Just like spacepy.datamodel.SpaceData objects, PbData objects work just like dictionaries except they have special attr dictionary attributes for both the top-level object and most values. This means that the following syntax can be used to explore a generic PbData object:

>>>print obj.keys() >>>print obj.attrs >>>value = obj[key]

Printing PbData objects will produce a tree of contents and attributes; calling self.listunits() will print all values that have the ‘units’ attribute and the associated units. Hence, it is often most instructive to use the following two lines to quickly learn a PbData’s contents:

>>>print obj >>>obj.listunits()

PbData is the main organizational tool for Pybats datasets, so the information here is applicable to nearly all Pybats classes.