def advect(cells_id, labels, V1, output_splits_merges=False):
    """
    This function advects all identified cells with the estimated flow.
    """
    columns = [
        "ID",
        "x",
        "y",
        "cen_x",
        "cen_y",
        "max_ref",
        "cont",
        "t_ID",
        "frac",
        "flowx",
        "flowy",
    ]
    if output_splits_merges:
        columns.extend(["splitted", "split_IDs", "split_fracs"])
    cells_ad = pd.DataFrame(
        data=None,
        index=range(len(cells_id)),
        columns=columns,
    )
    for ID, cell in cells_id.iterrows():
        if cell.ID == 0 or np.isnan(cell.ID):
            continue
        ad_x = np.round(np.nanmean(V1[0, cell.y, cell.x])).astype(int)
        ad_y = np.round(np.nanmean(V1[1, cell.y, cell.x])).astype(int)
        new_x = cell.x + ad_x
        new_y = cell.y + ad_y
        new_x[new_x > labels.shape[1] - 1] = labels.shape[1] - 1
        new_y[new_y > labels.shape[0] - 1] = labels.shape[0] - 1
        new_x[new_x < 0] = 0
        new_y[new_y < 0] = 0
        new_cen_x = cell.cen_x + ad_x
        new_cen_y = cell.cen_y + ad_y

        cells_ad.loc[ID, "x"] = new_x
        cells_ad.loc[ID, "y"] = new_y
        cells_ad.loc[ID, "flowx"] = ad_x
        cells_ad.loc[ID, "flowy"] = ad_y
        cells_ad.loc[ID, "cen_x"] = new_cen_x
        cells_ad.loc[ID, "cen_y"] = new_cen_y
        cells_ad.loc[ID, "ID"] = cell.ID

        cell_unique = np.zeros(labels.shape)
        cell_unique[new_y, new_x] = 1
        cells_ad.loc[ID, "cont"] = skime.find_contours(cell_unique, 0.8)

    return cells_ad
This function advects all identified cells with the estimated flow.
pysteps/tracking/tdating.py