spacepy.datamodel.toHDF5¶
-
spacepy.datamodel.
toHDF5
(fname, SDobject, **kwargs)[source]¶ Create an HDF5 file from a SpacePy datamodel representation
Parameters: fname : str
Filename to write to
SDobject : spacepy.datamodel.SpaceData
SpaceData with associated attributes and variables in dmarrays
Returns: None
Other Parameters: overwrite : bool (optional)
allow overwrite of an existing target file (default True)
mode : str (optional)
HDF5 file open mode (a, w, r) (default ‘a’)
compression : str (optional)
compress all the variables using this method (default None) (gzip, shuffle, fletcher32, szip, lzf)
compression_opts : str (optional)
options to the compression, see h5py documentation for more details
Examples
>>> import spacepy.datamodel as dm >>> a = dm.SpaceData() >>> a['data'] = dm.dmarray(range(100000), dtype=float) >>> dm.toHDF5('test_gzip.h5', a, overwrite=True, compression='gzip') >>> dm.toHDF5('test.h5', a, overwrite=True) >>> # test_gzip.h5 was 118k, test.h5 was 785k