itacart.hierarchy.get_descendants

itacart.hierarchy.get_descendants(index, target_res)[source]

Stream every descendant at a target resolution.

Cardinality grows fast: from resolution 1 to 13 a base cell away from the border undergoes twelve refinements, six of ratio 4 and six of ratio 25, hence (4 * 25) ** 6 — one million million cells. Always a generator, never a list.

Parameters:
  • index (str) – Compositional index string.

  • target_res (int) – Resolution to expand to.

Yields:

str – Atomic index strings at target_res.

Raises:
  • MaxResolutionError – If target_res exceeds resolution 13.

  • NonExistentCellError – If any addressed cell names no cell.

  • ResolutionError – If target_res is not finer than any input cell.

  • GeometryError – If the descent reaches the cell that holds a pole at resolution 10, whose children cannot be enumerated. A known limitation; see the module’s notes. Raised as the stream is iterated.

Return type:

Iterator[str]