spacepy.datamodel.dmarray¶
-
class
spacepy.datamodel.
dmarray
[source]¶ Container for data within a SpaceData object
Raises: NameError
raised is the request name was not added to the allowed attributes list
Examples
>>> import spacepy.datamodel as datamodel >>> position = datamodel.dmarray([1,2,3], attrs={'coord_system':'GSM'}) >>> position dmarray([1, 2, 3]) >>> position.attrs {'coord_system': 'GSM'}a
The dmarray, like a numpy ndarray, is versatile and can store any datatype; dmarrays are not just for arrays.
>>> name = datamodel.dmarray('TestName') dmarray('TestName')
To extract the string (or scalar quantity), use the tolist method
>>> name.tolist() 'TestName'
addAttribute
(name[, value])Method to add an attribute to a dmarray