itacart.topology.grid_disk
- itacart.topology.grid_disk(index, k_distance=1, metric='chebyshev', dedupe=False, flatten=False)[source]
Cells within
kgrid steps of the origin, the origin included.chebyshevadmits diagonal steps, giving a filled rhombus on the lattice;manhattanadmits only axis steps, giving a filled diamond. In the interior the unit disks hold nine and five cells respectively.- Parameters:
index (
str) – Compositional index string.k_distance (
int, default:1) – Ring radius in grid steps.metric (
Literal['chebyshev','manhattan'], default:"chebyshev") – Lattice metric to expand under.dedupe (
bool, default:False) – When the input holds several cells, drop cells that appear in more than one disk. Breaks positional alignment, so it is off by default.flatten (
bool, default:False) – When the input holds several cells,Falsereturns one list per input cell;Truereturns a single flat list.
- Return type:
- Returns:
A cell list for a single origin, or a list of lists aligned with
itacart.index.decompose().- Raises:
ValueError – If
k_distanceis negative ormetricis unknown.DomainError – If the disk reaches the geometric exception set, where a direction is multivalued and composing steps would lose cells silently.
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.