Missing values#

The canonical missing-value test and the recommended fill values, as defined by the convention and explained in the missing values chapter.

h5col.recommended_fill(dtype: Any) → Any[source]#

Return H5Col’s recommended fill value for dtype.

  • Fixed- or variable-length string dtypes → b"".

  • Opaque dtypes → opaque_fill_bytes() for that width.

  • Enumerations with a MISSING member → the integer code of that member (the spec’s enum fill convention).

  • Enumerations without a MISSING member, including the H5Col boolean datatype (which MUST NOT declare a fill value at all) → raises.

  • Integer and float families → the tabulated value for that width.

  • Anything else (e.g. float16) → raises FillValueError.

Parameters:

dtype – Anything numpy.dtype() accepts, including h5py string and enumeration dtypes, whose metadata decides which rule above applies.

h5col.is_missing(values: Any, fill_value: Any) → NDArray[bool][source]#

Apply the canonical missing-value test element-wise.

missing(v, f) = isnan(f) ? isnan(v) : v == f — i.e. when the fill value is a NaN bit pattern the test is isnan(v); otherwise it is bit/value equality.

Parameters:
  • values – The stored values to test, as read from a column.

  • fill_value – The column’s declared fill value. A NaN may be given as a Python float, a NumPy scalar or a 0-d array; all three take the isnan branch.

h5col.validate_fill_outside_range(fill: Any, valid_min: Any | None = None, valid_max: Any | None = None) → None[source]#

Check that fill lies strictly outside [valid_min, valid_max].

Parameters:
  • fill – The column’s fill value.

  • valid_min – Lower bound of the column’s declared valid range, or None for unbounded below.

  • valid_max – Upper bound, or None for unbounded above. With both bounds None there is nothing to check and the call succeeds.

Raises:

FillValueError – If fill falls inside the declared range, where a genuine value could collide with it.