Skip to content

Commit

Permalink
v4.5.4.3 Unmask leveed areas update (#1136)
Browse files Browse the repository at this point in the history
  • Loading branch information
mluck authored Aug 2, 2024
1 parent 3423757 commit b47e4fa
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
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.4.3 - 2024-08-02 - [PR#1136](https://github.com/NOAA-OWP/inundation-mapping/pull/1136)

Levee-protected areas are associated with levelpaths based on a 1000 m buffer on each side of the levee line. However, not all levees are designed to protect against all associated levelpaths, especially where the levelpath flows through the levee-protected area. Levee-protected areas are unmasked by removing levelpaths from association that don't intersect levees but instead flow around them which allows inundation by these branches.

### Changes

- `src/associate_levelpaths_with_levees.py`: Finds levelpaths that don't intersect levees and removes them from their association with their levee-protected area.

<br/><br/>


## v4.5.4.2 - 2024-08-02 - [PR#1125](https://github.com/NOAA-OWP/inundation-mapping/pull/1125)

This PR focuses on updating the preprocess_bathymetry.py for 3 issues: 1) the capability of preprocessing SurveyJobs that have negative depth values, 2) changing the SurveyDateStamp format, and 3) the capability of including multiple SurveyJobs for one NWM feature-id if needed.
Expand Down
17 changes: 15 additions & 2 deletions src/associate_levelpaths_with_levees.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def associate_levelpaths_with_levees(
out_filename: str,
):
"""
Finds the level path associated with each levee. Ignores level paths that cross a levee exactly once.
Finds the levelpath(s) associated with each levee. Ignores levelpaths that cross a levee exactly once.
Parameters
----------
Expand Down Expand Up @@ -177,7 +177,6 @@ def associate_levelpaths_with_levees(
.reset_index(drop=True)
)

# Remove levelpaths that cross the levee exactly once
for j, row in out_df.iterrows():
# Intersect levees and levelpaths
row_intersections = gpd.overlay(
Expand All @@ -193,9 +192,23 @@ def associate_levelpaths_with_levees(
# Select Point geometry type
row_intersections = row_intersections[row_intersections.geom_type == 'Point']

# Remove levelpaths that cross the levee exactly once
if len(row_intersections) == 1:
out_df = out_df.drop(j)

# Find associated levelpaths that don't intersect levees
elif row_intersections.empty:
# Get levelpaths that intersect leveed areas
leveed_area_levelpaths = gpd.overlay(
levelpaths[levelpaths[branch_id_attribute] == row[branch_id_attribute]],
leveed_areas[leveed_areas[levee_id_attribute] == row[levee_id_attribute]],
how='intersection',
keep_geom_type=False,
)

if not leveed_area_levelpaths.empty:
out_df = out_df.drop(j)

out_df.to_csv(out_filename, columns=[levee_id_attribute, branch_id_attribute], index=False)


Expand Down

0 comments on commit b47e4fa

Please sign in to comment.