Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
All notable changes to this project will be documented in this file.
We follow the [Semantic Versioning 2.0.0](http://semver.org/) format.

## v4.5.x.x - 2024-09-12 - [PR#1284](https://github.com/NOAA-OWP/inundation-mapping/pull/1284)

Segments of levelpaths that terminate in waterbodies are removed from the levelpath. If there is a waterbody downstream of the HUC then the outlet reaches may be trimmed such that the outlet no longer reaches the edge of the DEM, which causes a number of cascading issues originating in the pit-filling such that reverse flow in the DEM-derived reaches can result in erroneous flowlines and inundation. This PR stops trimming levelpaths outside of the HUC.

### Changes

- `src/`
- `derive_level_paths.py`: Adds WBD as an input to `stream_network.trim_branches_in_waterbodies()`
- `stream_network.py`: Selects only segments intersecting the WBD as candidates for removal if they end in waterbodies

<br/><br/>

## v4.5.6.0 - 2024-08-23 - [PR#1253](https://github.com/NOAA-OWP/inundation-mapping/pull/1253)

Upgrades Python packages and dependencies and fixes backwards incompatibilities with new version of `geopandas`. Major changes include:
Expand Down
2 changes: 1 addition & 1 deletion src/derive_level_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def Derive_level_paths(

if out_stream_network_dissolved is not None:
stream_network = stream_network.trim_branches_in_waterbodies(
branch_id_attribute=branch_id_attribute, verbose=verbose
wbd=wbd, branch_id_attribute=branch_id_attribute, verbose=verbose
)

# dissolve by levelpath
Expand Down
10 changes: 9 additions & 1 deletion src/stream_branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def remove_branches_without_catchments(

return self

def trim_branches_in_waterbodies(self, branch_id_attribute, verbose=False):
def trim_branches_in_waterbodies(self, wbd, branch_id_attribute, verbose=False):
"""
Recursively trims the reaches from the ends of the branches if they are in a
waterbody (determined by the Lake attribute).
Expand Down Expand Up @@ -645,6 +645,14 @@ def find_upstream_reaches_in_waterbodies(tmp_self, tmp_IDs=[]):
for branch in self[branch_id_attribute].astype(int).unique():
tmp_self = self[self[branch_id_attribute].astype(int) == branch]

# load waterbodies
if isinstance(wbd, str):
wbd = gpd.read_file(wbd)

# trim only branches in WBD (to prevent outlet from being trimmed)
if isinstance(wbd, gpd.GeoDataFrame):
tmp_self = gpd.sjoin(tmp_self, wbd)

# If entire branch is in waterbody
if all(tmp_self.Lake.values != -9999):
tmp_IDs = tmp_self.From_Node.astype(int)
Expand Down
Loading