Skip to content

Commit

Permalink
v1.2.0 coordinate_type -> coordinate_unit
Browse files Browse the repository at this point in the history
  • Loading branch information
cyschneck committed Aug 2, 2023
1 parent 581e155 commit 5a18e3b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 26 additions & 24 deletions river_centerline_width_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

# Valid Examples
cutoff = None
#cutoff = 10
cutoff = 10
#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
Expand All @@ -27,32 +27,34 @@
river = centerline_width.riverCenterline(csv_data="data/river_coords.csv",
optional_cutoff=cutoff,
interpolate_data=False,
interpolate_n=10,
interpolate_n_centerpoints=None,
equal_distance=20,
interpolate_n=200,
interpolate_n_centerpoints=200,
equal_distance=10,
ellipsoid="WGS84")

#print(river)
#print(river.__dict__.keys())
print("\nCenterline Length = {0} km".format(river.centerlineLength))
print("Centerline Length = {0} m".format(river.centerlineLength*1000))
print("Right Bank Length = {0} km".format(river.rightBankLength))
print("Left Bank Length = {0} km".format(river.leftBankLength))
#print("\nCenterline Length = {0} km".format(river.centerlineLength))
#print("Centerline Length = {0} m".format(river.centerlineLength*1000))
#print("Right Bank Length = {0} km".format(river.rightBankLength))
#print("Left Bank Length = {0} km".format(river.leftBankLength))
#print("ellipsoid = {0}".format(river.ellipsoid))
#print("centerlineVoronoi = {0}".format(river.centerlineVoronoi))
#print("centerlineVoronoiRelative = {0}".format(river.centerlineVoronoiRelative))
#print("equalDistanceCenterline = {0}".format(river.centerlineEqualDistance))
#print("equalDistanceCenterlineRelative = {0}".format(river.centerlineEqualDistanceRelative))
#print("centerlineEvenlySpaced = {0}".format(river.centerlineEvenlySpaced))
#print("centerlineEvenlySpacedRelative = {0}".format(river.centerlineEvenlySpacedRelative))
#print("centerlineSmoothed = {0}".format(river.centerlineSmoothed))
#print("centerlineVoronoi = {0}".format(len(river.centerlineVoronoi)))
#print("equalDistanceCenterline = {0}".format(len(river.centerlineEqualDistance)))
#print("centerlineEvenlySpaced = {0}".format(len(river.centerlineEvenlySpaced)))
#print("centerlineSmoothed = {0}".format(len(river.centerlineSmoothed)))
#print("centerlineSmoothedRelative = {0}".format(river.centerlineSmoothedRelative))
#print(river.left_bank_relative_coordinates)

coord_type = "reLATIVE DiSTANCE"
#coord_type = "relative DIStance"
coord_type = "Decimal Degrees"
center_type = "Voronoi"

river.saveCenterlineCSV(save_to_csv="centerline_for_csv.csv", centerline_type=center_type, coordinate_type=coord_type)
river.saveCenterlineMAT(save_to_mat="centerline_for_matlab.mat", centerline_type=center_type, coordinate_type=coord_type)
river.saveCenterlineCSV(save_to_csv="centerline_for_csv.csv", centerline_type=center_type, coordinate_unit=coord_type)
river.saveCenterlineMAT(save_to_mat="centerline_for_matlab.mat", centerline_type=center_type, coordinate_unit=coord_type)
#river.saveCenterlineCSV(save_to_csv="centerline_for_csv.csv", latitude_header="lat", longitude_header="long", centerline_type="Equal Distance")
#river.saveCenterlineMAT(save_to_mat="centerline_for_matlab.mat", latitude_header="lat", longitude_header="long", centerline_type="Evenly Spaced")

Expand All @@ -61,27 +63,27 @@
centerline_type=center_type,
marker_type="scatter",
centerline_color="black",
display_all_possible_paths=True,
display_all_possible_paths=False,
display_voronoi=False,
plot_title=None,
coordinate_type=coord_type)
coordinate_unit=coord_type)
transect = 3

# Plot river bank width line
river.plotCenterlineWidth(save_plot_name=None,
plot_title=None,
display_true_centerline=True,
display_true_centerline=False,
transect_span_distance=transect,
apply_smoothing=True,
flag_intersections=True,
remove_intersections=True,
coordinate_type=coord_type)
remove_intersections=False,
coordinate_unit=coord_type)

# Return width line for each centerline coordinates
river_width_dict = river.riverWidthFromCenterline(transect_span_distance=transect,
apply_smoothing=True,
remove_intersections=True,
save_to_csv="width_for_csv.csv",
coordinate_type=coord_type)
remove_intersections=False,
save_to_csv=None,
coordinate_unit=coord_type)

print("\nriver width dict = {0}\n".format(river_width_dict))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Python Package Setup
from setuptools import setup, find_namespace_packages

VERSION="1.1.0"
VERSION="1.2.0"
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:
Expand Down

0 comments on commit 5a18e3b

Please sign in to comment.