spacepy.datamodel.unflatten — SpacePy v0.1.5 Manual

### Navigation

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

# spacepy.datamodel.unflatten

`spacepy.datamodel.` `unflatten`(dobj, marker='<--')

  Collapse datamodel to one level deep

  Examples

      >>> import spacepy.datamodel as dm
      >>> import spacepy.toolbox as tb
      >>> a = dm.SpaceData()
      >>> a['1'] = dm.SpaceData(dog = 5, pig = dm.SpaceData(fish=dm.SpaceData(a='carp', b='perch')))
      >>> a['4'] = dm.SpaceData(cat = 'kitty')
      >>> a['5'] = 4
      >>> a.tree()
      +
      |____1
           |____dog
           |____pig
                |____fish
                     |____a
                     |____b
      |____4
           |____cat
      |____5

      >>> b = dm.flatten(a)
      >>> b.tree()
      +
      |____1<--dog
      |____1<--pig<--fish<--a
      |____1<--pig<--fish<--b
      |____4<--cat
      |____5

      >>> c = dm.unflatten(b)
      >>> c.tree()
      +
      |____1
           |____dog
           |____pig
                |____fish
                     |____a
                     |____b
      |____4
           |____cat
      |____5

### Navigation

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