ngff_zarr.rfc4_conformance¶
RFC 4 conformance output for the ngff-zarr CLI.
ngff-zarr conformance <input> prints one JSON verdict per input – the shape
a tool-agnostic conformance driver feeds against its manifest to check that an
implementation follows RFC 4:
{"input": ..., "format": "ome-zarr", "rfc4_valid": bool,
"axes": {name: value}, "violations": [code, ...], "warnings": [code, ...]}
It reads the raw axes, so malformed metadata is still classifiable – the
high-level reader would reject it before it could be reported. Findings are
reported with the conformance contract’s code names: RFC 4 defines no error codes,
and the package’s own :class:~ngff_zarr.structural_validation.SpecRule
identifiers are a different vocabulary, so the classification here is deliberately
expressed in the contract’s terms while applying the same RFC 4 rules as
- func:
~ngff_zarr.rfc4_validation.validate_rfc4_orientation.
Module Contents¶
Functions¶
Pull |
|
Parse metadata JSON, classifying a decode failure as an unreadable input. |
|
Read the raw axis dicts from an OME-Zarr directory or |
|
Classify RFC 4 findings using the conformance contract’s code vocabulary. |
|
Build the canonical conformance verdict for one OME-Zarr input. |
Data¶
API¶
- ngff_zarr.rfc4_conformance._METADATA_NAMES¶
(‘zarr.json’, ‘.zattrs’)
- exception ngff_zarr.rfc4_conformance._UnreadableInput(code: str, message: str)¶
Bases:
ExceptionThe input is not a readable OME-Zarr carrying an axes list.
Holds the conformance
codeto surface as the verdict violation, so an unreadable or non-OME-Zarr input is reported as invalid rather than silently treated as an empty (and therefore “valid”) axes list.Initialization
Initialize self. See help(type(self)) for accurate signature.
- ngff_zarr.rfc4_conformance._axes_from_metadata(meta: Any) list[dict[str, Any]]¶
Pull
multiscales[0].axesout of a v2.zattrsor v3zarr.jsonblob.
- ngff_zarr.rfc4_conformance._load_json(raw: bytes | str, source: str) Any¶
Parse metadata JSON, classifying a decode failure as an unreadable input.
- ngff_zarr.rfc4_conformance._read_axes(path: str) list[dict[str, Any]]¶
Read the raw axis dicts from an OME-Zarr directory or
.zip.Raises :class:
_UnreadableInputwhen no readable OME-Zarr metadata carrying an axes list is found, so the caller can emit an invalid verdict instead of an empty axes list.
- ngff_zarr.rfc4_conformance._classify(axes: list[dict[str, Any]]) tuple[list[str], list[str]]¶
Classify RFC 4 findings using the conformance contract’s code vocabulary.
RFC 4 defines no error codes, so the names below belong to the conformance contract rather than to the specification. The rules applied are the RFC’s:
orientationMUST only be used on spatial axes;an
orientationobject MUST carry atype(only"anatomical"is defined) and avaluedrawn from the controlled vocabulary;a set of axes MUST only carry one direction of each antonym pair.
Orientation is optional per spatial axis, and an absent orientation is equivalent to an explicit
null– neither is a violation – but a writer SHOULD omit the field rather than serializenull, which is reported as a warning. A code may repeat, once per offending axis.