itacart.hierarchy.get_parent
- itacart.hierarchy.get_parent(index, target_res=None)[source]
Ascend the hierarchy by lexical truncation.
No floating-point work and no negative indices: the parent is a prefix of the child string, which is the property that makes the compositional index cheap to navigate.
The return is a prefix, not necessarily a cell. For most of the grid the two coincide, but a cell that absorbs the domain border reaches past its own column and fathers children spelled under the next column’s prefix; truncating such a child yields a well-formed string that names no cell. Callers that need the stronger claim pass the result to
itacart.boundary.is_valid_cell().- Parameters:
- Return type:
- Returns:
The ancestor prefix for a single cell, or a positionally aligned list. Duplicates are preserved so alignment holds; call
itacart.index.normalize()on the composed result to dedupe.- Raises:
MinResolutionError – If
target_resis above resolution 0.ResolutionError – If
target_resis finer than the input.