From 5af7f0917b17be3e8f2a07fbc0e798d3a815afbd Mon Sep 17 00:00:00 2001 From: ZahraGhahremani Date: Fri, 6 Dec 2024 23:08:06 +0000 Subject: [PATCH 1/3] fixed osmid and added huc column --- data/bridges/pull_osm_bridges.py | 3 ++- src/aggregate_by_huc.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/data/bridges/pull_osm_bridges.py b/data/bridges/pull_osm_bridges.py index ed6bb79f..f359b981 100644 --- a/data/bridges/pull_osm_bridges.py +++ b/data/bridges/pull_osm_bridges.py @@ -78,6 +78,7 @@ def pull_osm_features_by_huc(huc_bridge_file, huc_num, huc_geom): gdf['railway'] = None # Create the bridge_type column by combining above information + gdf['HUC'] = huc_num gdf['bridge_type'] = gdf.apply( lambda row: ( f"highway-{row['highway']}" if pd.notna(row['highway']) else f"railway-{row['railway']}" @@ -187,7 +188,7 @@ def combine_huc_features(output_dir): section_time = dt.datetime.now(dt.timezone.utc) logging.info(f" .. started: {section_time.strftime('%m/%d/%Y %H:%M:%S')}") - all_bridges_gdf = all_bridges_gdf_raw[['osmid', 'name', 'bridge_type', 'geometry']] + all_bridges_gdf = all_bridges_gdf_raw[['osmid', 'name', 'bridge_type', 'HUC', 'geometry']] all_bridges_gdf.to_file(osm_bridge_file, driver="GPKG") return diff --git a/src/aggregate_by_huc.py b/src/aggregate_by_huc.py index 93c0242b..ba417ea8 100644 --- a/src/aggregate_by_huc.py +++ b/src/aggregate_by_huc.py @@ -205,7 +205,7 @@ def aggregate_bridge_pnts(self, branch_path, branch_id): if not os.path.isfile(bridge_filename): return - bridge_pnts = gpd.read_file(bridge_filename) + bridge_pnts = gpd.read_file(bridge_filename, dtype=self.bridge_dtypes) if bridge_pnts.empty: return hydrotable_filename = join(branch_path, f'hydroTable_{branch_id}.csv') @@ -288,6 +288,7 @@ def agg_function( (c > 1) & (bridge_pnts.feature_id != bridge_pnts.crossing_feature_id), 'is_backwater' ] = 1 # Write file + bridge_pnts = bridge_pnts.astype(self.bridge_dtypes, errors='ignore') bridge_pnts.to_file(bridge_pnts_file, index=False, engine='fiona') # print(f"agg_by_huc for huc id {huc_id} is done") From 366f96301fcb69b24a3f905732466713822b0295 Mon Sep 17 00:00:00 2001 From: ZahraGhahremani Date: Fri, 6 Dec 2024 23:24:56 +0000 Subject: [PATCH 2/3] changelog --- docs/CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 10e942f7..76749601 100755 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,17 @@ 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-12-06 - [PR#1360](https://github.com/NOAA-OWP/inundation-mapping/pull/1360) + +Fixed missing osmid in osm_bridge_centroid.gpkg. Also, HUC column is added to outputs. + +### Changes +- `data/bridges/pull_osm_bridges.py` +- `src/aggregate_by_huc.py` + +

+ + ## v4.5.12.1 - 2024-11-22 - [PR#1328](https://github.com/NOAA-OWP/inundation-mapping/pull/1328) Fixes bug and adds error checking in FIM Performance. Fixes #1326. From 617fec8173949661424d1b40d286858c7589b080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CRobHanna-NOAA=E2=80=9D?= <“Robert.Hanna@NOAA.gov”> Date: Fri, 3 Jan 2025 20:27:27 +0000 Subject: [PATCH 3/3] merge dev, update changelog --- docs/CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3d726d1e..d0dd2923 100755 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,13 +1,17 @@ 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-12-06 - [PR#1360](https://github.com/NOAA-OWP/inundation-mapping/pull/1360) +## v4.5.13.2 - 2025-01-03 - [PR#1360](https://github.com/NOAA-OWP/inundation-mapping/pull/1360) Fixed missing osmid in osm_bridge_centroid.gpkg. Also, HUC column is added to outputs. ### Changes - `data/bridges/pull_osm_bridges.py` - `src/aggregate_by_huc.py` + +

+ + ## v4.5.13.1 - 2024-12-13 - [PR#1361](https://github.com/NOAA-OWP/inundation-mapping/pull/1361) This PR was triggered by two dep-bot PR's. One for Tornado, one for aiohttp. Upon further research, these two exist only as dependencies for Jupyter and Jupyterlab which were very out of date. Upgrading Jupyter/JupyterLab took care of the other two.