Skip to content
Novus Examples
h59.4 KB

HDF5 Degenerate Shapes — Scalar, Zero-Length and Null (.h5)

Five degenerate but entirely legal datasets — a rank-0 scalar, a zero-length vector, a (0, 5) array, a single-element vector and a NULL dataspace — plus an empty group. None of them is corrupt, and a reader that reports them as errors is the thing being tested.

Preview — schema + first 5 rowsh5
DatasetShapeLegal?Trips up
/scalar() — rank 0yescode that always indexes [0]
/zero_length(0,)yescode that assumes len > 0
/zero_by_five(0, 5)yescode that infers rank from element count
/one_element(1,)yescode that collapses (1,) to a scalar
/null_spaceNULL dataspaceyescode that assumes every dataset has a shape
Every one of these is valid HDF5 — none of them is an error to be reported.

Specifications

Scalar Dataset
true
Zero Length Dataset
true
Zero By Five
(0, 5)
Null Dataspace
true
Empty Group
true
Datasets
5
All Legal
true

Testing contract

Expected to pass
Scenario
Read every dataset in the file and report its shape without special-casing any of them as an error.
Expected result
/scalar has rank 0 and value 6.62607015e-34, /zero_length has shape (0,), /zero_by_five has shape (0, 5), /null_space reports a NULL dataspace, and no read raises.

What is a .h5 file?

HDF5 (.h5) is a binary container format for large, heterogeneous scientific data. It stores multidimensional arrays (datasets) in a hierarchical group structure with attributes and chunked, compressed storage, and is standard in ML, physics, and geoscience.

How to use this file

Use an example .h5 file to test HDF5 readers (h5py, PyTables), group and dataset traversal, and attribute extraction.

How to use this file for testing

“HDF5 Degenerate Shapes — Scalar, Zero-Length and Null (.h5)” is a deterministic Novus Examples fixture for Scientific data, Serialization testing, Error handling. Citation catalogs (BibTeX, RIS), chemistry structures (MDL Molfile, PDB), and gridded binary data (NetCDF, FITS) — for testing reference managers, molecule viewers, and scientific-data loaders.

Documented properties for this file: H5 · 9,672 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Scientific fixtures are small, valid, and fully synthetic — no real organism, patient, sample, or observation. Point your parser or loader at the file and check it reads the documented records, variables, or headers; binary formats ship a readable twin or metadata listing for comparison.

Generated by generation/scientific.py. Free for any use, no attribution required — license.