def METHOD_NAME(options, flags):
    TMPRAST, TMPVECT, DEBUG = [], [], False
    atexit.register(cleanup, raster=TMPRAST, vector=TMPVECT, debug=DEBUG)
    elevation = options["elevation"]
    river = options["river"]  # raster
    discharge = options["discharge"]  # vec
    len_plant = float(options["len_plant"])
    len_min = float(options["len_min"])
    distance = float(options["distance"])
    efficiency = float(options["efficiency"])
    output_plant = options["output_plant"]
    output_point = options["output_point"]
    if options["p_max"]:
        p_max = float(options["p_max"])
    else:
        p_max = None
    p_min = float(options["p_min"])
    DEBUG = flags["d"]
    c = flags["c"]
    msgr = get_msgr()
    # import ipdb; ipdb.set_trace()
    if c:
        msgr.message("\Clean rivers\n")
        TMPVECT = [("tmprgreen_%i_cleanb" % os.getpid())]
        pid = os.getpid()
        dissolve_lines(river, "tmprgreen_%i_cleanb" % os.getpid())
        river = "tmprgreen_%i_cleanb" % pid
        # number of cell of the river
    # range for the solution
    msgr.message("\Loop on the category of segments\n")
    range_plant = (len_min, len_plant)
    plants = find_segments(river, discharge, elevation, range_plant, distance, p_max)
    # add l_min
    if output_point:
        write_points(plants, output_point, efficiency, p_min)
    write_plants(plants, output_plant, efficiency, p_min)