HDF5 hyperslab
An HDF5 hyperslab is a selection of elements in a multidimensional dataspace expressed through rectangular blocks and their positions.
H5Sselect_hyperslab describes a regular hyperslab with start, stride, count and block arrays, one value per dimension. A NULL stride selects a contiguous hyperslab, a NULL block means single elements, and a stride of 0 is not allowed. In the documented 2-D example, start [1,1], stride [4,4], count [3,7] and block [2,2] select 21 blocks of 2 × 2 elements, or 84 elements. [1]
Selections can be combined. SET replaces the current selection, OR adds to it, AND keeps only the overlap, XOR keeps elements in exactly one of the two, and NOTA and NOTB remove one selection from the other. Selected regions are iterated in C order when I/O is performed. [1]
A hyperslab names logical elements, not storage. With chunked storage an entire chunk is involved even when only one of its elements is needed. h5py suggests chunks of 10 KiB to 1 MiB, and up to 2 to 4 MiB for files in cloud object storage. [2]
Stored selections: a legacy region reference retains a dataset selection, not its historical values. Shrink/re-extension can restore selection validity while returning fill or replacement data. On HDF5 1.14.2 and 1.14.6, unchanged reference bytes selected different values; the fill-only case had no allocated selected chunk and was not a payload checksum pass. [4] [5]
Relations
- related
- HDF5, HDF5 virtual dataset, HDF5 chunked layout
Advantages
- Describes strided and blocked regions compactly, without listing each element coordinate. [1]
Limitations
- A selection that cuts across many chunks can cost far more I/O than its element count suggests. [2]
- Overlapping blocks are not supported with the SET operator. [1]
Citations
- The HDF Group: H5Sselect_hyperslab and dataspace selections
- h5py 3.15.0: slicing and chunked storage
- h5py 3.15.0: Object and Region References
- Hesela: HDF5 region-reference lifetime, two-build native observations
Further reading
Sources & caveats
- h5s is the HDF Group H5S dataspace reference, re-read on 2026-10-22 in H5Sselect_hyperslab and H5Scombine_hyperslab.
- The start, stride, count and block example with 21 blocks of 2 × 2 elements comes from h5s, and 84 elements is 21 × 4.
- h5py-dataset is the h5py 3.15.0 dataset page, re-read on 2026-10-22 in the chunked storage section.
- The 10 KiB to 1 MiB and 2 to 4 MiB chunk-size suggestions come from h5py-dataset.
- Region evidence covers native serial legacy references, 1D int32 and full-chunk shrink boundaries: nine controls per build, not a failure-rate study. Code and 36 retained files: https://hesela.dev/research/hdf5-region-lifetime/bundle.zip