itacart.hierarchy.get_children
- itacart.hierarchy.get_children(index, target_res=None, flatten=False)[source]
Project descendants of an index down to a target resolution.
Yields 4 children when descending into an even resolution and 25 when descending into an odd one — away from the domain border. A cell whose outer side has been carried onto the border was measured to hold between two and six children instead, so the count comes from enumeration and never from
itacart.resolutions.refinement_ratio().- Parameters:
index (
str) – Compositional index string.target_res (
int|None, default:None) – Resolution to descend to. Defaults to one level down.flatten (
bool, default:False) –False, the default, yields one list per cell of the input, preserving positional alignment.Trueyields a single flat stream. The shape does not depend on how many cells the input holds.
- Yields:
Lists of child index strings, one list per cell of the input, when
flattenisFalse; child index strings when it isTrue.The grouping does not collapse for a single cell, and that is worth stating because the neighbours do collapse:
get_parent()answers a scalar andget_ancestors()answers a flat chain when handed one cell. Herelist(get_children(cell))is a list holding one list, whose length is one and not the child count. Passflatten=Trueto read the children directly.- Raises:
MaxResolutionError – If
target_resexceeds resolution 13.ResolutionError – If
target_resis not finer than the input.NonExistentCellError – If any cell of the index names no cell. The predicate is the arbiter and the contract ends there: a spelling it denies is refused rather than answered for the cell it would otherwise fold onto.
GeometryError – For the cell that holds a pole at resolution 10, whose children cannot be enumerated: the cells found leave part of its ring uncovered. A known limitation; see the module’s notes. Raised as the result is iterated, not when the function is called.
- Return type: