Skip to content

Commit efc73bf

Browse files
committed
return area at m^2
1 parent 4229c7e commit efc73bf

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ The red pins represent the equal distance centerline coordinates produced by cen
232232
* centerline_length (float): Length of the centerline of the river (in km)
233233
* right_bank_length (float): Length of the right bank of the river (in km)
234234
* left_bank_length (float): Length of the left bank of the river (in km)
235-
* area (float): Area contained within river bank polygon (in km^2)
235+
* area (float): Area contained within river bank polygon (in m^2)
236236
* sinuosity (float): Sinuosity of the river based on evenly spaced centerline coordinates
237237
* centerline_voronoi_relative (list of tuples): List of the relative distance coordinates of the centerline generated by Voronoi diagrams
238238
* centerline_equal_distance_relative (list of tuples): List of the relative distance coordinates of the centerline generated by equal distances between coordinates from the Voronoi diagrams
@@ -397,13 +397,13 @@ Return the area contained within the polygon generated the left and right bank l
397397
```
398398
river_object.area
399399
```
400-
Area returned in kilometers^2
400+
Area returned in meters^2
401401
```python
402402
import centerline_width
403403
river_object = centerline_width.CenterlineWidth(csv_data="data/river_coords.csv")
404404
river_area = river_object.area
405405
```
406-
The area of the river returns `334.0398585246558` km^2
406+
The area of the river returns `3132.0671725985594` m^2
407407

408408
### Total Sinuosity of River
409409
Return the total sinuosity of the river

centerline_width/pytests/test_verifyRiverCenterlineClass.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def test_CenterlineWidth_default():
244244
0.09705816897006408)
245245
assert river_class_example.left_bank_length == pytest.approx(
246246
0.10570962276643736)
247-
assert river_class_example.area == pytest.approx(11.4030195647527)
247+
assert river_class_example.area == pytest.approx(11403.0195647527)
248248
assert river_class_example.starting_node == pytest.approx(
249249
(-92.86781887353752, 30.03824341873465))
250250
assert river_class_example.ending_node == pytest.approx(
@@ -722,7 +722,7 @@ def test_CenterlineWidth_futureWarning_functionName():
722722
0.09705816897006408)
723723
assert river_class_example.left_bank_length == pytest.approx(
724724
0.10570962276643736)
725-
assert river_class_example.area == pytest.approx(11.4030195647527)
725+
assert river_class_example.area == pytest.approx(11403.0195647527)
726726
assert river_class_example.starting_node == pytest.approx(
727727
(-92.86781887353752, 30.03824341873465))
728728
assert river_class_example.ending_node == pytest.approx(
@@ -1124,7 +1124,7 @@ def test_CenterlineWidth_futureWarning_variableName():
11241124
0.0291159670403472)
11251125
assert river_class_example.left_bank_length == pytest.approx(
11261126
0.03091855487702919)
1127-
assert river_class_example.area == pytest.approx(3.1320671725985596)
1127+
assert river_class_example.area == pytest.approx(3132.0671725985594)
11281128
assert river_class_example.starting_node == pytest.approx(
11291129
(-92.86792843577895, 30.037755468515407))
11301130
assert river_class_example.ending_node == pytest.approx(
@@ -2223,7 +2223,7 @@ def test_CenterlineWidth_interpolateTrue():
22232223
0.09705816897212159)
22242224
assert river_class_example.left_bank_length == pytest.approx(
22252225
0.1057096227682203)
2226-
assert river_class_example.area == pytest.approx(11.403019517285152)
2226+
assert river_class_example.area == pytest.approx(11403.019517285153)
22272227
assert river_class_example.starting_node == pytest.approx(
22282228
(-92.86782125207236, 30.03827120587997))
22292229
assert river_class_example.ending_node == pytest.approx(

centerline_width/pytests/test_verifyRiverFeatures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_riverFeatures_leftBankLength():
126126

127127

128128
def test_riverFeatures_area():
129-
assert river_class_example.area == pytest.approx(11.4030195647527)
129+
assert river_class_example.area == pytest.approx(11403.0195647527)
130130

131131

132132
def test_riverFeatures_riverSinuosity():

centerline_width/riverFeatures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535

3636
def _calculate_river_area(bank_polygon=None,
3737
ellipsoid: str = "WGS84") -> float:
38-
# Return the area contained within the river polygon (km^2)
38+
# Return the area contained within the river polygon (m^2)
3939
if bank_polygon is None:
4040
return 0
4141
geodesic = Geod(ellps=ellipsoid)
4242
river_area, river_perimeter = geodesic.geometry_area_perimeter(
4343
bank_polygon)
44-
return abs(river_area) / 1000 # km
44+
return abs(river_area) # m^2
4545

4646

4747
def _centerline_length(centerline_coordinates: list = None,

river_centerline_width_example.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@
5454
print(f"ellipsoid = {river.ellipsoid}")
5555
print(river.right_bank_relative_coordinates)
5656
print(river.left_bank_relative_coordinates)
57-
print(f"area = {river.area} km^2")
57+
print(f"area = {river.area} m^2")
5858
print(f"sinuosity = {river.sinuosity}")
5959
incremental_sinuosity = river.incremental_sinuosity(incremental_points=215,
6060
save_to_csv=None)
6161
print(f"incremental sinuosity = {incremental_sinuosity}")
62+
#exit()
6263

6364
#coord_type = "relative DIStance"
6465
coord_type = "decimal degrees"

river_centerline_width_example_deprecation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
print(f"ellipsoid = {river.ellipsoid}")
5656
print(river.right_bank_relative_coordinates)
5757
print(river.left_bank_relative_coordinates)
58-
print(f"area = {river.area} km^2")
58+
print(f"area = {river.area} m^2")
5959
print(f"sinuosity = {river.sinuosity}")
6060
incremental_sinuosity = river.incremental_sinuosity(incremental_points=215,
6161
save_to_csv=None)

0 commit comments

Comments
 (0)