fluiddyn.io.hdf5

IO for HDF5 files (fluiddyn.io.hdf5)

class fluiddyn.io.hdf5.H5File(name, mode='r', driver=None, libver=None, userblock_size=None, swmr=False, rdcc_nslots=None, rdcc_nbytes=None, rdcc_w0=None, track_order=None, fs_strategy=None, fs_persist=False, fs_threshold=1, fs_page_size=None, page_buf_size=None, min_meta_keep=0, min_raw_keep=0, locking=None, alignment_threshold=1, alignment_interval=1, meta_block_size=None, **kwds)[source]

Bases: File

HDF5 file.

save_dict(keydict, dicttosave)[source]

Save the dictionnary dicttosave in the file.

load_dict(keydict)[source]

Load a group as a dictionnary.

save_dict_of_ndarrays(dicttosave, dtype=<class 'numpy.float32'>)[source]

Save ndarrays in the file.

load(times_slice=None)[source]

Load data.

fluiddyn.io.hdf5.save_variables_h5(path, variables, names=None)[source]

Save data in variables in the file path.

Parameters:
pathstr

Path of the file where the data are saved (has to end with ‘.py’).

variablesdict

Contains the variables to be saved.

namesNone or sequence of str.

If None, all variables in variables are saved, else, only the variables with name in names of the variables to be saved.

Examples

a = 1
b = 'str'
c = np.ones(2)

save_variables_h5('myfile.h5', locals(), ('a', 'b', 'c'))

or from a dictionary:

d = {'a': 1, 'b': 'str', 'c': np.ones(2)}
save_variables_h5('myfile.h5', d)
fluiddyn.io.hdf5.load_variables_h5(path)[source]

Load files created with the function save_variables_h5.

Parameters:
pathstr

Path towards a hdf5 file saved with save_variables_h5.

Functions

load_variables_h5(path)

Load files created with the function save_variables_h5.

save_variables_h5(path, variables[, names])

Save data in variables in the file path.

Classes

H5File(name[, mode, driver, libver, ...])

HDF5 file.