Skip to content

Commit

Permalink
centerlineEqualDistance -> centerline_equal_distance
Browse files Browse the repository at this point in the history
  • Loading branch information
cyschneck committed Aug 17, 2024
1 parent f5a430d commit 8ca0a47
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Find the centerline and width of rivers based on the latitude and longitude posi
* plot_centerline_width()
* width()
* centerline_voronoi
* centerlineEqualDistance
* centerline_equal_distance
* centerlineEvenlySpaced
* centerlineSmoothed
* centerlineLength
Expand Down Expand Up @@ -226,7 +226,7 @@ The red pins represent the equal distance centerline coordinates produced by cen
**Object (class) useful attributes:**

* centerline_voronoi (list of tuples): List of the latitude and longitude coordinates of the centerline generated by Voronoi diagrams
* centerlineEqualDistance (list of tuples): List of the latitude and longitude coordinates of the centerline generated by equal distances between coordinates from the Voronoi diagrams
* centerline_equal_distance (list of tuples): List of the latitude and longitude coordinates of the centerline generated by equal distances between coordinates from the Voronoi diagrams
* centerlineEvenlySpaced (list of tuples): List of the latitude and longitude coordinates of the centerline generated by evenly spacing out points generated by the Voronoi diagrams
* centerlineSmoothed (list of tuples): List of the latitude and longitude coordinates of the centerline generated by smoothing out the evenly spaced-out points generated by the Voronoi diagrams
* centerlineLength (float): Length of the centerline of the river (in km)
Expand All @@ -248,8 +248,8 @@ The red pins represent the equal distance centerline coordinates produced by cen
<li>left_bank_relative_coordinates (list of tuples): list of relative distances coordinates of the left bank, measured as the distance in meters from the first point on the left bank (`[(x, y), (x, y)]`)</li>
<li>right_bank_relative_coordinates (list of tuples): list of relative distances coordinates of the right bank, measured as the distance in meters from the first point on the left bank (`[(x, y), (x, y)]`)</li>
<li>df_len (int): Length of the data frame of the csv data (spliced by the cutoff)</li>
<li>equal_distance (int): Distance between points (in meters) used in centerlineEqualDistance, defaults to points every 10 meters</li>
<li>ellipsoid (string): Built-in ellipsoid definition of Earth to determine how degrees are converted to meters used by centerlineEqualDistance, defaults to "WGS84"</li>
<li>equal_distance (int): Distance between points (in meters) used in centerline_equal_distance, defaults to points every 10 meters</li>
<li>ellipsoid (string): Built-in ellipsoid definition of Earth to determine how degrees are converted to meters used by centerline_equal_distance, defaults to "WGS84"</li>
<li>bank_polygon (Shapley Polygon): Multi-sided polygon generated to encapsulate the latitude/longitude coordinate riverbank (used to define an inside and an outside of the river)</li>
<li>bank_polygon_relative (Shapley Polygon): Multi-sided polygon generated to encapsulate the relative distance coordinate riverbank (used to define an inside and an outside of the river)</li>
<li>top_bank (Shapley Linestring): Linestring that represents the top of the river/polygon for the latitude/longitude coordinate system</li>
Expand Down Expand Up @@ -305,9 +305,9 @@ river_object.centerline_voronoi

Centerline coordinates are formed by Equally Distanced vertices, set by `equal_distance`
```
river_object.centerlineEqualDistance
river_object.centerline_equal_distance
```
| river_object.centerlineEqualDistance | river_object.centerlineEqualDistanceRelative |
| river_object.centerline_equal_distance | river_object.centerlineEqualDistanceRelative |
| ------------- | ------------- |
| ![centerlineEqualDistance+png](https://raw.githubusercontent.com/cyschneck/centerline-width/main/data/doc_examples/equal_distance_centerline.png) | ![centerlineEqualDistanceRelative+png](https://raw.githubusercontent.com/cyschneck/centerline-width/main/data/doc_examples/equal_distance_centerline_relative.png) |

Expand Down
2 changes: 1 addition & 1 deletion centerline_width/plotDiagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def plotCenterlineBackend(
if centerline_type == "Equal Distance":
centerline_legend = "Equal Distance Centerline Coordinates"
if coordinate_unit == "Decimal Degrees":
centerline_coordinates_by_type = river_object.centerlineEqualDistance
centerline_coordinates_by_type = river_object.centerline_equal_distance
if coordinate_unit == "Relative Distance":
centerline_coordinates_by_type = river_object.centerlineEqualDistanceRelative

Expand Down
4 changes: 2 additions & 2 deletions centerline_width/pytests/test_verifyRiverCenterlineClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def test_CenterlineWidth_default():
assert river_class_example.centerlineLength == pytest.approx(
0.08284102060354828)
assert river_class_example.equal_distance == 10
assert river_class_example.centerlineEqualDistance == [
assert river_class_example.centerline_equal_distance == [
pytest.approx((-92.86781887353752, 30.03824341873465)),
pytest.approx((-92.86781040076286, 30.03815351096445)),
pytest.approx((-92.867813429355, 30.038063339971036)),
Expand Down Expand Up @@ -1872,7 +1872,7 @@ def test_CenterlineWidth_interpolateTrue():
assert river_class_example.centerlineLength == pytest.approx(
0.08592777952584983)
assert river_class_example.equal_distance == 10
assert river_class_example.centerlineEqualDistance == [
assert river_class_example.centerline_equal_distance == [
pytest.approx((-92.86782125207236, 30.03827120587997)),
pytest.approx((-92.86781202566551, 30.03818135428244)),
pytest.approx((-92.86780971432128, 30.038091167213576)),
Expand Down
4 changes: 4 additions & 0 deletions centerline_width/riverCenterlineClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ def __init__(self,
centerline_coordinates=self.centerline_voronoi,
equal_distance=self.equal_distance,
ellipsoid=self.ellipsoid)
self.centerline_equal_distance = centerline_width.equalDistanceCenterline(
centerline_coordinates=self.centerline_voronoi,
equal_distance=self.equal_distance,
ellipsoid=self.ellipsoid)
self.centerlineEvenlySpaced = centerline_width.evenlySpacedCenterline(
centerline_coordinates=self.centerline_voronoi,
number_of_fixed_points=self.interpolate_n_centerpoints)
Expand Down
4 changes: 2 additions & 2 deletions centerline_width/saveOutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def save_centerline_csv(river_object: centerline_width.CenterlineWidth = None,
if centerline_type == "Voronoi":
centerline_coordinates_by_type = river_object.centerline_voronoi
if centerline_type == "Equal Distance":
centerline_coordinates_by_type = river_object.centerlineEqualDistance
centerline_coordinates_by_type = river_object.centerline_equal_distance
if centerline_type == "Evenly Spaced":
centerline_coordinates_by_type = river_object.centerlineEvenlySpaced
if centerline_type == "Smoothed":
Expand Down Expand Up @@ -118,7 +118,7 @@ def save_centerline_mat(river_object: centerline_width.CenterlineWidth = None,
if centerline_type == "Voronoi":
centerline_coordinates_by_type = river_object.centerline_voronoi
if centerline_type == "Equal Distance":
centerline_coordinates_by_type = river_object.centerlineEqualDistance
centerline_coordinates_by_type = river_object.centerline_equal_distance
if centerline_type == "Evenly Spaced":
centerline_coordinates_by_type = river_object.centerlineEvenlySpaced
if centerline_type == "Smoothed":
Expand Down
4 changes: 2 additions & 2 deletions river_centerline_width_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#print(river)
#print(river.__dict__.keys())
print("centerline_voronoi = {0}".format(river.centerline_voronoi))
print("centerline_equal_distance = {0}".format(
river.centerline_equal_distance))
'''
print("\nCenterline Length = {0} km".format(river.centerlineLength))
print("Centerline Length = {0} m".format(river.centerlineLength * 1000))
Expand All @@ -43,8 +45,6 @@
print("ellipsoid = {0}".format(river.ellipsoid))
print("centerlineVoronoiRelative = {0}".format(
river.centerlineVoronoiRelative))
print("equalDistanceCenterline = {0}".format(
river.centerlineEqualDistance))
print("equalDistanceCenterlineRelative = {0}".format(
river.centerlineEqualDistanceRelative))
print("centerlineEvenlySpaced = {0}".format(river.centerlineEvenlySpaced))
Expand Down
4 changes: 2 additions & 2 deletions river_centerline_width_example_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#print(river)
#print(river.__dict__.keys())
print("centerlineVoronoi = {0}".format(river.centerlineVoronoi))
print("equalDistanceCenterline = {0}".format(
river.centerlineEqualDistance))
'''
print("\nCenterline Length = {0} km".format(river.centerlineLength))
print("Centerline Length = {0} m".format(river.centerlineLength * 1000))
Expand All @@ -45,8 +47,6 @@
print("ellipsoid = {0}".format(river.ellipsoid))
print("centerlineVoronoiRelative = {0}".format(
river.centerlineVoronoiRelative))
print("equalDistanceCenterline = {0}".format(
river.centerlineEqualDistance))
print("equalDistanceCenterlineRelative = {0}".format(
river.centerlineEqualDistanceRelative))
print("centerlineEvenlySpaced = {0}".format(river.centerlineEvenlySpaced))
Expand Down

0 comments on commit 8ca0a47

Please sign in to comment.