x = vertices[0][0]
transitions, i = get_same_row_vert(0, vertices)
while i < len(vertices):
    while x < vertices[i][0]:
        for cell in row(x, transitions):
            yield cell
x += 1
vert, i = get_same_row_vert(i, vertices)
transitions = update_transitions(transitions, vert)
vertices = [(0, 0), (0, 3), (4, 3), (4, 0), (3, 0), (3, 2), (1, 2), (1, 1),
    (2, 1), (2, 0)]
for cell in polygon(vertices):
    pass
Find irregular region in 4D numpy array of gridded data (lat/lon)