itacart.serialization

Binary encodings of ITACaRT indices.

Three formats, with different invariants:

TreeBlob (itacart.serialization.tree_blob) encodes the compositional tree as a set of cells in canonical prefix-index form. It is content-addressable and reaches 10 bytes for a resolution-13 leaf. Order, ring topology and edge model are all discarded, which makes it the right structure for coverage, ancestry and indexing queries, and the wrong one for identity. The design generalises beyond ITACaRT: any DGGS with a prefix-structured hierarchical index can adopt it.

GeometryBlob (itacart.serialization.geometry_blob) encodes an ordered sequence of vertices with edge model, ring topology, densification parameters and OGC SFA type. It preserves everything TreeBlob drops, and is the form to hash when a geometry has to be identified rather than merely covered.

The two are bridged by geometry_to_tree(), in one direction only: a GeometryBlob determines a TreeBlob, but the same TreeBlob arises from many geometries.

DataTreeBlob (itacart.serialization.data_tree_blob) encodes values on cells: a tree of cells with a fixed set of variables at every node, aggregated from the leaves or observed at any level. It is read and updated in place, a cell and its ancestors in one walk, and it has no canonical form: it is the format for data with a value at every level, where the TreeBlob is the format for a region.

Provenance: itacart_core/binary_index.py and geometry_blob.py.

Submodules

data_tree_blob

DataTreeBlob: values on a tree of cells, read and updated in place.

geometry_blob

GeometryBlob: binary encoding of an ordered ITACaRT vertex sequence.

tree_blob

TreeBlob: dense binary encoding of a compositional index as a cell set.