stored_byte_layout

function of dascore.utils.hdf5 source

stored_byte_layout(
    dataset ,
)-> ‘tuple[tuple[int, …], int] | None’

Return where plain file reads find a dataset’s rows, if they can.

The offsets are of each chunk along the first axis, in row order, or of the whole array when it is contiguous; the int is the rows each one holds. None unless the dataset is in a local file, stored as the dtype it reads as, unfiltered, wholly written, and in at most MAX_LAYOUT_CHUNKS chunks of whole rows.

Examples

import h5py
from dascore.utils.downloader import fetch
from dascore.utils.hdf5 import stored_byte_layout

with h5py.File(fetch("prodml_2.1.h5"), "r") as h5:
    offsets, rows = stored_byte_layout(h5["Acquisition/Raw[0]/RawData"])
assert rows == 1024 and len(offsets) == 12