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/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4e2da186..d0dd2923 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.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. 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")