HDF5NDSource¶
HDF5NDSource exposes an HDF5 dataset through ProxyNDSource using
kerchunk metadata pre-indexing. Individual chunks are fetched on demand
and converted to Blosc2-compressed chunks stored in the surrounding
Proxy or RemoteArray cache.
The source is assumed immutable (assume_immutable=True). It supports fixed-size
boolean, integer, floating-point, complex, and fixed-length string arrays.
HDF5 filters such as Blosc2 (via hdf5plugin), gzip, and uncompressed datasets
are supported.
Install local support with pip install "blosc2[hdf5]". Remote datasets also
need blosc2[fsspec] and the protocol driver, such as s3fs for S3.
- blosc2.available_datasets(url, storage_options: dict | None = None) list[str][source]¶
Return all dataset paths within an HDF5 file or reference dictionary.
- Parameters:
- Returns:
Sorted list of dataset paths (e.g.
['d0/a0', 'd0/d1/a2']).- Return type:
list[str]
- class blosc2.HDF5NDSource(urlpath, dataset: str, *, refs: dict | str | PathLike | None = None, storage_options: dict | None = None, max_concurrency: int = 8, blocks=None, cparams=None, _traffic: Traffic | None = None, _filesystem=None)[source]¶
Read an immutable HDF5 dataset as Blosc2-compressed logical chunks via kerchunk.
Replacing data beneath the same store identity violates this adapter’s contract and may leave previously converted chunks stale. Peak working memory includes concurrently decoded Zarr chunks and their Blosc2 conversion buffers;
max_cache_bytesonly limits retained compressed chunks.- Parameters:
urlpath¶ (str or path-like) – URL or file path to the HDF5 file.
dataset¶ (str) – Path to the dataset within the HDF5 file (e.g.
"d0/d1/a2").refs¶ (dict, str, or path-like, optional) – Pre-computed kerchunk reference dictionary or path to a JSON reference file. If omitted, the HDF5 metadata will be scanned using kerchunk.
storage_options¶ (dict, optional) – Parameters passed to fsspec or kerchunk when accessing remote files.
max_concurrency¶ (int, optional) – Maximum number of concurrent remote requests.
blocks¶ (tuple, optional) – Blosc2 block shape for chunk caching.
cparams¶ (dict or CParams, optional) – Blosc2 compression parameters for chunk conversion.
- Attributes:
attrsThe user attributes of the remote dataset.
blocksThe block shape of the source.
chunksThe chunk shape of the source.
cparamsThe compression parameters of the source.
dtypeThe dtype of the source.
metaThe fixed-length metadata of the source.
shapeThe shape of the source.
vlmetaThe variable-length metadata of the source.
Methods
aget_chunk(nchunk)Return the compressed chunk in
selfasynchronously.get_chunk(nchunk)Return the compressed chunk in
self.