itacart.hierarchy.child_position

itacart.hierarchy.child_position(cell)[source]

Ordinal of a cell among its siblings.

Zero-based against the refinement alphabet of the cell’s resolution: 1-4 for even levels, A1-E5 in row-major order for odd.

Under a border-absorbing parent the alphabet rank is not an ordinal, because two siblings can carry the same code under different column prefixes. There the ordinal is the position in the enumeration of get_children(): own stem before eastern stem, alphabet order within each. Away from the border the two definitions agree, and the cheap one is used.

Parameters:

cell (str) – Compositional index string.

Return type:

int | list[int]

Returns:

An ordinal for a single cell, or a positionally aligned list.

Raises: