Skip to content

Commit

Permalink
update README.md for sinuosity functions, incremental_points=100 defa…
Browse files Browse the repository at this point in the history
…ults
  • Loading branch information
cyschneck committed Jun 10, 2024
1 parent e5bf8d3 commit d18ea0e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Find the centerline and width of rivers based on the latitude and longitude posi
* leftBankLength
* riverArea
* riverSinuosity
* calculateIncrementalSinuosity()
* **Export centerline to .CSV and .MAT files**
* saveCenterlineCSV()
* saveCenterlineMAT()
Expand Down Expand Up @@ -226,6 +227,7 @@ The red pins represent the equal distance centerline coordinates produced by cen
* rightBankLength (float): Length of the right bank of the river (in km)
* leftBankLength (float): Length of the left bank of the river (in km)
* riverArea (float): Area contained within river bank polygon (in km^2)
* riverSinuosity (float): Sinuosity of the river based on evenly spaced centerline coordinates
* centerlineVoronoiRelative (list of tuples): List of the relative distance coordinates of the centerline generated by Voronoi diagrams
* centerlineEqualDistanceRelative (list of tuples): List of the relative distance coordinates of the centerline generated by equal distances between coordinates from the Voronoi diagrams
* centerlineEvenlySpacedRelative (list of tuples): List of the relative distance coordinates of the centerline generated by evenly spacing out points generated by the Voronoi diagrams
Expand Down Expand Up @@ -392,6 +394,36 @@ river_area = river_object.riverArea
```
The area of the river returns `334.0398585246558` km^2

### Total Sinuosity of River
Return the total sinuosity of the river
```
river_object.riverSinuosity
```
Sinuosity of river based on the evenly spaced centerline coordinates
```python
import centerline_width
river_object = centerline_width.riverCenterline(csv_data="data/river_coords.csv")
river_area = river_object.riverSinuosity
```
The sinuosity of the river returns as a float `0.6852533956654481`

### Incremental Sinuosity of River
Return the incremental sinuosity of the river at evenly spaced increments
```
calculateIncrementalSinuosity(
incremental_points = 100,
save_to_csv = None)
```
* **[REQUIRED]** incremental_points: grouping of centerline coordinates, defaults to 100 (must be less than the length of the evenly spaced centerline coordinates)
* [OPTIONAL] save_to_csv (string): CSV filename, requires a .csv extension with headers `["Centerline Latitude Start (Deg)", "Centerline Longitude Start (Deg)", "Centerline Latitude End (Deg)", "Centerline Longitude End (Deg)", "Sinuosity"]`

```python
import centerline_width
river_object = centerline_width.riverCenterline(csv_data="data/river_coords.csv")
river_object.river.calculateIncrementalSinuosity()
```
Returns a dictionary with the start and end centerline coordinates and associated sinuosity `{((-92.87803465419134, 30.04494734395193), (-92.87718084516158, 30.03944640478984)): 0.8164574107802118, ((-92.87714797109666, 30.03944945940497), (-92.87020323809925, 30.039886265891074)): 0.9810773013508994}`

## Plot Centerline in Matplotlib
Plot the centerline created from a list of right and left banks

Expand Down Expand Up @@ -780,8 +812,6 @@ python -m pytest
## Beta :test_tube: Features
These features are not included in pip install because they are still experimental and being tested/debugged. For more information and getting them up and running, contact [email protected] or [email protected] or post a question as a [Github Issue](https://github.com/cyschneck/centerline-width/issues)

- Calculate sinuosity of river, in total and in equal parts

- Calculate the dominant meander wavelength amd its variance

- Research and Contribute to [OpenStreetMap](https://github.com/cyschneck/centerline-width/issues/5) for existing mapped rivers with generated centerlines
Expand Down
2 changes: 1 addition & 1 deletion centerline_width/riverFeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def calculateSinuosity(centerline_evenlySpaced_coordinates: list = None,

def calculateIncrementalSinuosity(
river_object: centerline_width.riverCenterline = None,
incremental_points: int = 10,
incremental_points: int = 100,
save_to_csv: str = None) -> dict:
# Return the sinuosity of the river in increments
# (Centerline Coordinate Start, Centerline Coordinate End Longtiude, Sinuosity)
Expand Down

0 comments on commit d18ea0e

Please sign in to comment.