NekUpload.utils.hdf5_reader module
- class NekUpload.utils.hdf5_reader.HDF5Reader(filename: str, mode: str = 'r')[source]
Bases:
object- dump_to_plain_file(target_file_name: str) None[source]
Convert HDF5 contents to a formatted plain-text representation.
- get_attributes(key: str) dict[str, Any][source]
Retrieves attributes for a given key in the HDF5 file.
- Parameters:
key (str) – The key for which to retrieve attributes.
- Returns:
A dictionary of attribute names and their values.
- Return type:
dict[str, Any]
- get_dataset(dataset_key: str) Dataset | None[source]
Reads a dataset from the HDF5 file.
- Parameters:
dataset_key (str) – The name of the dataset to read.
- Returns:
The dataset object if found, otherwise None.
- Return type:
Optional[h5py.Dataset]
- get_dtype(dataset_path: str) str | None[source]
Retrieves the data type of a dataset in the HDF5 file.
- Parameters:
dataset_path (str) – The path to the dataset.
- Returns:
The data type of the dataset if found, otherwise None.
- Return type:
Optional[str]
- get_keys() dict[str, str][source]
Recursively retrieves all keys in the HDF5 file and categorizes them as ‘GROUP’, ‘DATASET’, or ‘ATTRIBUTE’.
- Returns:
A dictionary mapping keys (HDF5 paths) to their types.
- Return type:
dict[str, str]