spacepy_logo

Previous topic

spacepy.datamodel.fromCDF

Next topic

spacepy.datamodel.toCDF

This Page

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:

file : string

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

Returns:

out : spacepy.datamodel.SpaceData

SpaceData with associated attributes and variables in dmarrays

Notes

Known issues – 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')