diff --git a/centerline_width/centerline.py b/centerline_width/centerline.py index 71e3b23..84f0e77 100644 --- a/centerline_width/centerline.py +++ b/centerline_width/centerline.py @@ -341,7 +341,8 @@ def riverWidthFromCenterline(river_object=None, defined_centerline_coordinates = centerline_width.evenlySpacedCenterline(centerline_coordinates=river_object.centerlineVoronoi, number_of_fixed_points=river_object.interpolate_n_centerpoints) if apply_smoothing: - defined_centerline_coordinates = centerline_width.smoothedCoordinates(centerline_coordinates=river_object.centerlineVoronoi, + defined_centerline_coordinates = centerline_width.smoothedCoordinates(river_object=river_object, + centerline_coordinates=river_object.centerlineVoronoi, interprolate_num=river_object.interpolate_n_centerpoints) # if using smoothing, replace left/right coordinates with the smoothed variation right_width_coord, left_width_coord, _ = centerline_width.riverWidthFromCenterlineCoordinates(river_object=river_object, diff --git a/river_centerline_width_example.py b/river_centerline_width_example.py index 5d8deef..85e1f2c 100644 --- a/river_centerline_width_example.py +++ b/river_centerline_width_example.py @@ -7,10 +7,10 @@ # right_kml="data/rightbank.kml", # text_output_name="data/river_coords.txt") #print("new data with gap: N8_R1/N8_R2.kml") - centerline_width.extractPointsToTextFile(left_kml="data/N8_R1.kml", - right_kml="data/N8_R2.kml", + centerline_width.extractPointsToTextFile(left_kml="data/left.kml", + right_kml="data/right.kml", text_output_name="data/N_output.txt") - centerline_width.convertColumnsToCSV(text_file="data/N_output.txt", flipBankDirection=True) + centerline_width.convertColumnsToCSV(text_file="data/N_output.txt", flipBankDirection=False) # Valid Examples cutoff = None @@ -18,7 +18,7 @@ #cutoff = 15 # valid centerline, valid path, valid polygon, valid starting node, valid ending node #cutoff = 30 #cutoff = 100 # valid centerline, valid path, valid polygon, valid starting node, valid ending node - cutoff = 550 # valid centerline, valid path, valid polygon, valid starting node, valid ending node + #cutoff = 550 # valid centerline, valid path, valid polygon, valid starting node, valid ending node # Invalid Examples #cutoff = 5 # invalid centerline, invalid path, valid polygon, invalid starting node, invalid ending nodes #cutoff = 250 # valid centerline, valid path, invalid polygon, valid starting node, valid ending nodes @@ -26,12 +26,13 @@ #cutoff = 700 # invalid centerline, valid path, valid polgyon, invalid starting node, valid ending node #cutoff = 1000 # invalid centerline, invalid path, invalid polgyon, invalid starting node, valid ending node - river = centerline_width.riverCenterline(csv_data="data/river_coords.csv", + river = centerline_width.riverCenterline(csv_data="data/N_output.csv", optional_cutoff=cutoff, - interpolate_data=False, - interpolate_n_centerpoints=200) + interpolate_data=True, + interpolate_n=10, + interpolate_n_centerpoints=62) #print(river) - print(river.__dict__.keys()) + #print(river.__dict__.keys()) print("Centerline Length = {0} km".format(river.centerlineLength)) print("Right Bank Length = {0} km".format(river.rightBankLength)) print("Left Bank Length = {0} km".format(river.leftBankLength)) @@ -41,16 +42,16 @@ # Plot river bank centerline - river.plotCenterline(save_plot_name=None, - display_all_possible_paths=False, - display_voronoi=False) + #river.plotCenterline(save_plot_name=None, + # display_all_possible_paths=False, + # display_voronoi=False) transect = 3 # Plot river bank width line river.plotCenterlineWidth(save_plot_name=None, plot_title=None, - display_true_centerline=False, + display_true_centerline=True, transect_span_distance=transect, apply_smoothing=True, flag_intersections=False, @@ -63,4 +64,4 @@ units="m", save_to_csv=None) - #print("\nriver width dict = {0}\n".format(river_width_dict)) + print("\nriver width dict = {0}\n".format(river_width_dict)) diff --git a/setup.py b/setup.py index 72425db..3f38f62 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ # Python Package Setup from setuptools import setup, find_namespace_packages -VERSION="0.2.4" +VERSION="0.2.5" DESCRIPTION="A Python package to find the centerline and width of rivers based on the latitude and longitude of the right and left bank" with open("README.md", "r") as f: