HDF5¶
ddacs.open_h5 and ddacs.inspect_h5 are the top level helpers for reading and inspecting a single simulation. Both are re-exported at the package root (ddacs.open_h5, ddacs.inspect_h5); the implementation lives in ddacs.h5_tools.
ddacs.open_h5¶
open_h5(sim_id: int, source: str | Path | None = None, data_dir: str | Path | None = DEFAULT_DATA_DIR, dataset=None, spec: DatasetSpec = DDACS_SPEC) -> h5py.File
¶
Return an h5py.File for the requested simulation.
Looks the manifest up, walks the locally mapped zips and reads the h5
member matching <sim_id>.h5 into a BytesIO. The returned object is
read-only, supports the with idiom and can be indexed like any other
h5py.File.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sim_id
|
int
|
The simulation id (matches the h5 filename inside the zip). |
required |
source
|
str | Path | None
|
Override the Croissant manifest URL / path. Falls back to
|
None
|
data_dir
|
str | Path | None
|
Override the directory searched for already-downloaded
zips. Defaults to |
DEFAULT_DATA_DIR
|
dataset
|
A pre-loaded |
None
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
No locally mapped zip contained the requested h5. |
Source code in ddacs/h5_tools.py
ddacs.inspect_h5¶
inspect_h5(file_or_path: h5py.File | str | Path) -> None
¶
Pretty-print the group/dataset hierarchy of an HDF5 file.
Accepts either an open h5py.File (e.g. from ddacs.open_h5) or a path
on disk. Prints to stdout and returns nothing.