### Navigation

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

# spacepy.datamodel.dmfilled

`spacepy.datamodel.``dmfilled`(shape, fillval=0, dtype=None, order='C', attrs=None)

  Return a new dmarray of given shape and type, filled with a specified value (default=0).

  See also

  `numpy.ones`

  Examples

      >>> import spacepy.datamodel as dm
      >>> dm.dmfilled(5, attrs={'units': 'nT'})
      dmarray([ 0.,  0.,  0.,  0.,  0.])

      >>> dm.dmfilled((5,), fillval=1, dtype=np.int)
      dmarray([1, 1, 1, 1, 1])

      >>> dm.dmfilled((2, 1), fillval=np.nan)
      dmarray([[ nan],
             [ nan]])

      >>> a = dm.dmfilled((2, 1), np.nan, attrs={'units': 'nT'})
      >>> a
      dmarray([[ nan],
             [ nan]])
      >>> a.attrs
      {'units': 'nT'}

### Navigation

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