spacepy.datamodel.dmcopy

spacepy.datamodel.dmcopy(dobj)[source]

Generic copy utility to return a copy of a (datamodel) object

Parameters
dobjobject

object to return a copy of

Returns
copy_obj: object (same type as input)

copy of input oibject

Examples

>>> import spacepy.datamodel as dm
>>> dat = dm.dmarray([2,3], attrs={'units': 'T'})
>>> dat1 = dm.dmcopy(dat)
>>> dat1.attrs['copy': True]
>>> dat is dat1
False
>>> dat1.attrs
{'copy': True, 'units': 'T'}
>>> dat.attrs
{'units': 'T'}