odc.geo.math.edge_index

odc.geo.math.edge_index(shape, closed=False)[source]

Like ndindex in numpy but for edge locations and limited to 2d.

Returns a sequence of indexes along the edge of a 2d array of a given shape. Order is fixed, starting from (0, 0), (0, 1).... See example below

# for shape=(10, 8)
(0, 0), (0, 1) ... (0, 7),
(1, 7), (2, 7) ... (9, 7),
(9, 6), (9, 5) ... (9, 0),
(8, 0), (7, 0) ... (1, 0),
(0, 0) # Back to (0, 0) if closed=True
Return type:

Iterator[Tuple[int, int]]