spacepy.datamodel.dmarray — SpacePy v0.1.5 Manual

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- homepage|
- search|
- documentation »
- datamodel - easy to use general data model »

# spacepy.datamodel.dmarray

class `spacepy.datamodel.` `dmarray`

  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

  `addAttribute`(name, value=None)

    Method to add an attribute to a dmarray equivalent to a = datamodel.dmarray([1,2,3]) a.Allowed_Attributes = a.Allowed_Attributes + [‘blabla’]

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- homepage|
- search|
- documentation »
- datamodel - easy to use general data model »