itacart.intervals.intervals_union

itacart.intervals.intervals_union(first, second)[source]

Every position in either list.

Lists of different depths are brought to the finer depth first.

Raises:
  • InvalidIndexError – If either is not a list of ranges of one resolution.

  • NonExistentCellError – If the coarser list covers an address that names no cell, which its refinement finds.

Parameters:
Return type:

list[tuple[int, int]]

Example

>>> a = cells_to_intervals("NE(0625/0451(1))")
>>> b = cells_to_intervals("NE(0625/0451(2))")
>>> intervals_to_cells(intervals_union(a, b))
'NE(0625/0451(1,2))'
Parameters:
Return type:

list[tuple[int, int]]