Skip to content

Commit ceaf5b2

Browse files
committed
centerlineSmoothed -> centerline_smoothed
1 parent 1ea59d9 commit ceaf5b2

8 files changed

+20
-16
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Find the centerline and width of rivers based on the latitude and longitude posi
2424
* centerline_voronoi
2525
* centerline_equal_distance
2626
* centerline_evenly_spaced
27-
* centerlineSmoothed
27+
* centerline_smoothed
2828
* centerlineLength
2929
* **Return river features**
3030
* rightBankLength
@@ -228,7 +228,7 @@ The red pins represent the equal distance centerline coordinates produced by cen
228228
* centerline_voronoi (list of tuples): List of the latitude and longitude coordinates of the centerline generated by Voronoi diagrams
229229
* 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
230230
* centerline_evenly_spaced (list of tuples): List of the latitude and longitude coordinates of the centerline generated by evenly spacing out points generated by the Voronoi diagrams
231-
* 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
231+
* centerline_smoothed (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
232232
* centerlineLength (float): Length of the centerline of the river (in km)
233233
* rightBankLength (float): Length of the right bank of the river (in km)
234234
* leftBankLength (float): Length of the left bank of the river (in km)
@@ -321,9 +321,9 @@ river_object.centerline_evenly_spaced
321321

322322
Centerline coordinates are formed from Smoothed vertices
323323
```
324-
river_object.centerlineSmoothed
324+
river_object.centerline_smoothed
325325
```
326-
| river_object.centerlineSmoothed | river_object.centerlineSmoothedRelative |
326+
| river_object.centerline_smoothed | river_object.centerlineSmoothedRelative |
327327
| ------------- | ------------- |
328328
| ![centerlineEvenlySpaced+png](https://raw.githubusercontent.com/cyschneck/centerline-width/main/data/doc_examples/smoothed_centerline.png) | ![centerlineEvenlySpacedRelative+png](https://raw.githubusercontent.com/cyschneck/centerline-width/main/data/doc_examples/smoothed_centerline_relative.png) |
329329

@@ -777,7 +777,7 @@ This can be fixed by using the flip_direction optional argument `centerline_widt
777777
![invalid_flipped_banks+png](https://raw.githubusercontent.com/cyschneck/centerline-width/main/data/doc_examples/invalid_flipped_banks.png)
778778

779779
### Invalid Smoothed Centerline
780-
The smoothed centerline (`river_object.centerlineSmoothed`) can end up lying outside the river if the centerline data points are sparse in a narrow river. If more than two points in the smoothed centerline lie outside the river, a warning will be thrown
780+
The smoothed centerline (`river_object.centerline_smoothed`) can end up lying outside the river if the centerline data points are sparse in a narrow river. If more than two points in the smoothed centerline lie outside the river, a warning will be thrown
781781

782782
Example Error: `WARNING: Partially invalid smoothed centerline due to sparse centerline data (6 points lie outside the polygon), fix recommendation: rerun CenterlineWidth to create river object with interpolate_n_centerpoints set to 62+`
783783

centerline_width/plotDiagrams.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def plotCenterlineBackend(
122122
if centerline_type == "Smoothed":
123123
centerline_legend = "Smoothed Centerline Coordinates"
124124
if coordinate_unit == "Decimal Degrees":
125-
centerline_coordinates_by_type = river_object.centerlineSmoothed
125+
centerline_coordinates_by_type = river_object.centerline_smoothed
126126
if coordinate_unit == "Relative Distance":
127127
centerline_coordinates_by_type = river_object.centerlineSmoothedRelative
128128

@@ -329,15 +329,15 @@ def plot_centerline_width(
329329
if apply_smoothing:
330330
right_width_coordinates, left_width_coordinates, num_intersection_coordinates = centerline_width.riverWidthFromCenterlineCoordinates(
331331
river_object=river_object,
332-
centerline_coordinates=river_object.centerlineSmoothed,
332+
centerline_coordinates=river_object.centerline_smoothed,
333333
transect_span_distance=transect_span_distance,
334334
transect_slope=transect_slope,
335335
remove_intersections=remove_intersections,
336336
coordinate_unit=coordinate_unit)
337337
x = []
338338
y = []
339339
if coordinate_unit == "Decimal Degrees":
340-
smoothed_coords = river_object.centerlineSmoothed
340+
smoothed_coords = river_object.centerline_smoothed
341341
if coordinate_unit == "Relative Distance":
342342
smoothed_coords = river_object.centerlineSmoothedRelative
343343
for k, v in smoothed_coords:

centerline_width/pytests/test_verifyRiverCenterlineClass.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def test_CenterlineWidth_default():
448448
pytest.approx((-92.86800697996587, 30.03755139550792)),
449449
pytest.approx((-92.86801289742837, 30.03752504557166))
450450
]
451-
assert river_class_example.centerlineSmoothed == [
451+
assert river_class_example.centerline_smoothed == [
452452
pytest.approx((-92.86781709744432, 30.03824388764834)),
453453
pytest.approx((-92.8678128931592, 30.03821641344848)),
454454
pytest.approx((-92.86781038736042, 30.038189206812227)),
@@ -1914,7 +1914,7 @@ def test_CenterlineWidth_interpolateTrue():
19141914
pytest.approx((-92.86800669645666, 30.03755234944709)),
19151915
pytest.approx((-92.86801289742837, 30.03752504557166))
19161916
]
1917-
assert river_class_example.centerlineSmoothed == [
1917+
assert river_class_example.centerline_smoothed == [
19181918
pytest.approx((-92.86782241200312, 30.038271970539554)),
19191919
pytest.approx((-92.86781637981315, 30.038243329100077)),
19201920
pytest.approx((-92.86781225108764, 30.038214971972298)),

centerline_width/riverCenterlineClass.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ def __init__(self,
173173
river_object=self,
174174
centerline_coordinates=self.centerline_evenly_spaced,
175175
interprolate_num=self.interpolate_n_centerpoints)
176+
self.centerline_smoothed = centerline_width.smoothedCoordinates(
177+
river_object=self,
178+
centerline_coordinates=self.centerline_evenly_spaced,
179+
interprolate_num=self.interpolate_n_centerpoints)
176180

177181
# Relative Distance from bottom left bank point to each Centerline coordinates
178182
self.centerlineVoronoiRelative = centerline_width.relativeCenterlineCoordinates(
@@ -185,7 +189,7 @@ def __init__(self,
185189
self.left_bank_coordinates[0], self.centerline_evenly_spaced,
186190
self.ellipsoid)
187191
self.centerlineSmoothedRelative = centerline_width.relativeCenterlineCoordinates(
188-
self.left_bank_coordinates[0], self.centerlineSmoothed,
192+
self.left_bank_coordinates[0], self.centerline_smoothed,
189193
self.ellipsoid)
190194

191195
# Overall Sinuosity

centerline_width/saveOutput.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def save_centerline_csv(river_object: centerline_width.CenterlineWidth = None,
5959
if centerline_type == "Evenly Spaced":
6060
centerline_coordinates_by_type = river_object.centerline_evenly_spaced
6161
if centerline_type == "Smoothed":
62-
centerline_coordinates_by_type = river_object.centerlineSmoothed
62+
centerline_coordinates_by_type = river_object.centerline_smoothed
6363
if coordinate_unit == "Relative Distance":
6464
if centerline_type == "Voronoi":
6565
centerline_coordinates_by_type = river_object.centerlineVoronoiRelative
@@ -122,7 +122,7 @@ def save_centerline_mat(river_object: centerline_width.CenterlineWidth = None,
122122
if centerline_type == "Evenly Spaced":
123123
centerline_coordinates_by_type = river_object.centerline_evenly_spaced
124124
if centerline_type == "Smoothed":
125-
centerline_coordinates_by_type = river_object.centerlineSmoothed
125+
centerline_coordinates_by_type = river_object.centerline_smoothed
126126
if coordinate_unit == "Relative Distance":
127127
if centerline_type == "Voronoi":
128128
centerline_coordinates_by_type = river_object.centerlineVoronoiRelative

centerline_width/width.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def width(river_object: centerline_width.CenterlineWidth = None,
363363
# if using smoothing, replace left/right coordinates with the smoothed variation
364364
right_width_coordinates, left_width_coordinates, num_intersection_coordinates = centerline_width.riverWidthFromCenterlineCoordinates(
365365
river_object=river_object,
366-
centerline_coordinates=river_object.centerlineSmoothed,
366+
centerline_coordinates=river_object.centerline_smoothed,
367367
transect_span_distance=transect_span_distance,
368368
remove_intersections=remove_intersections,
369369
coordinate_unit="Decimal Degrees")

river_centerline_width_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
river.centerline_equal_distance))
4040
print("centerline_evenly_spaced = {0}".format(
4141
river.centerline_evenly_spaced))
42+
print("centerline_smoothed = {0}".format(river.centerline_smoothed))
4243
'''
4344
print("\nCenterline Length = {0} km".format(river.centerlineLength))
4445
print("Centerline Length = {0} m".format(river.centerlineLength * 1000))
@@ -51,7 +52,6 @@
5152
river.centerlineEqualDistanceRelative))
5253
print("centerlineEvenlySpacedRelative = {0}".format(
5354
river.centerlineEvenlySpacedRelative))
54-
print("centerlineSmoothed = {0}".format(river.centerlineSmoothed))
5555
print("centerlineSmoothedRelative = {0}".format(
5656
river.centerlineSmoothedRelative))
5757
print(river.right_bank_relative_coordinates)

river_centerline_width_example_deprecation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
print("equalDistanceCenterline = {0}".format(
4141
river.centerlineEqualDistance))
4242
print("centerlineEvenlySpaced = {0}".format(river.centerlineEvenlySpaced))
43+
print("centerlineSmoothed = {0}".format(river.centerlineSmoothed))
4344
'''
4445
print("\nCenterline Length = {0} km".format(river.centerlineLength))
4546
print("Centerline Length = {0} m".format(river.centerlineLength * 1000))
@@ -52,7 +53,6 @@
5253
river.centerlineEqualDistanceRelative))
5354
print("centerlineEvenlySpacedRelative = {0}".format(
5455
river.centerlineEvenlySpacedRelative))
55-
print("centerlineSmoothed = {0}".format(river.centerlineSmoothed))
5656
print("centerlineSmoothedRelative = {0}".format(
5757
river.centerlineSmoothedRelative))
5858
print(river.right_bank_relative_coordinates)

0 commit comments

Comments
 (0)