diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 30a351c3..2b86bedf 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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. + +

+ + ## 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. diff --git a/src/associate_levelpaths_with_levees.py b/src/associate_levelpaths_with_levees.py index 29c069ba..9f07aa37 100644 --- a/src/associate_levelpaths_with_levees.py +++ b/src/associate_levelpaths_with_levees.py @@ -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 ---------- @@ -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( @@ -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)