Skip to content
Snippets Groups Projects

L2SS-1114: Add some improvements in how to use the HDF file reader

Merged Hannes Feldt requested to merge L2SS-1114-hdf5_reader_wrapper_improvement into main
4 files
+ 26
39
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -66,14 +66,9 @@ these attributes. Therefor `attribute` allows to specify another member in the c
## Read a HDF file
A file can be read using the `Hdf5FileReader` class:
A file can be read using `read_hdf5`:
```python
with read_hdf5('file_name.h5') as f:
data = f.read(Data)
with read_hdf5('file_name.h5', Data) as data:
a = data.first_attr
```
It should always be used in a `with` block to make sure the HDF5 file handles are cleand up properly.
Currently, the data object read from the file is only usable within the `with` block since the data is lazily loaded.
If needed eager loading could be added in the future.
Loading