spacepy.datamodel.fromHDF5

spacepy.datamodel.fromHDF5(fname, **kwargs)[source]

Create a SpacePy datamodel representation of an HDF5 file or netCDF4 file which is HDF5 compliant

Parameters
filestring

the name of the HDF5/netCDF4 file to be loaded into a datamodel

Returns
outspacepy.datamodel.SpaceData

SpaceData with associated attributes and variables in dmarrays

Notes

Zero-sized datasets will break in h5py. This is kluged by returning a dmarray containing a None.

This function is expected to work with any HDF5-compliant files, including netCDF4 (not netCDF3) and MatLab save files from v7.3 or later, but some datatypes are not supported, e.g., non-string vlen datatypes, and will raise a warning.

Examples

>>> import spacepy.datamodel as dm
>>> data = dm.fromHDF5('test.hdf')