def get_profile(areas, binary, ref, loc_max, time, minref, output_splits_merges=False):
    """
    This function returns the identified cells in a dataframe including their x,y
    locations, location of their maxima, maximum reflectivity and contours.
    Optionally, the dataframe can include columns for storing information regarding
    splitting and merging of cells.
    """
    cells = areas * binary
    cell_labels = cells[loc_max]
    labels = np.zeros(cells.shape)
    cells_id = []
    for n, cell_label in enumerate(cell_labels):
        this_id = n + 1
        x = np.where(cells == cell_label)[1]
        y = np.where(cells == cell_label)[0]
        cell_unique = np.zeros(cells.shape)
        cell_unique[cells == cell_label] = 1
        maxref = np.nanmax(ref[y, x])
        contours = skime.find_contours(cell_unique, 0.8)
        cells_id.append(
            {
                "ID": this_id,
                "time": time,
                "x": x,
                "y": y,
                "cen_x": np.round(np.nanmean(x)).astype(int),
                "cen_y": np.round(np.nanmean(y)).astype(int),
                "max_ref": maxref,
                "cont": contours,
                "area": len(x),
            }
        )
        if output_splits_merges:
            cells_id[-1].update(
                {
                    "splitted": None,
                    "split_IDs": None,
                    "merged": None,
                    "merged_IDs": None,
                    "results_from_split": None,
                    "will_merge": None,
                }
            )
        labels[cells == cell_labels[n]] = this_id

    columns = [
        "ID",
        "time",
        "x",
        "y",
        "cen_x",
        "cen_y",
        "max_ref",
        "cont",
        "area",
    ]
    if output_splits_merges:
        columns.extend(
            [
                "splitted",
                "split_IDs",
                "merged",
                "merged_IDs",
                "results_from_split",
                "will_merge",
            ]
        )
    cells_id = pd.DataFrame(
        data=cells_id,
        index=range(len(cell_labels)),
        columns=columns,
    )
    if output_splits_merges:
        cells_id["split_IDs"] = cells_id["split_IDs"].astype("object")
        cells_id["merged_IDs"] = cells_id["merged_IDs"].astype("object")
    return cells_id, labels
This function returns the identified cells in a dataframe including their x,y
locations, location of their maxima, maximum reflectivity and contours.
Optionally, the dataframe can include columns for storing information regarding
splitting and merging of cells.
pysteps/feature/tstorm.py