Skip to content

Commit

Permalink
v4.4.9.2 Add index to aggregated crosswalk table (#1066)
Browse files Browse the repository at this point in the history
  • Loading branch information
mluck authored Feb 2, 2024
1 parent 85c77e9 commit 682c15b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.4.9.2 - 2024-02-02 - [PR#1066](https://github.com/NOAA-OWP/inundation-mapping/pull/1066)

Adds an index to the aggregated `crosswalk_table.csv`. The index is a consecutive integer that starts at 1. Columns have been reordered, renamed, and sorted.

### Changes

`tools/combine_crosswalk_tables.py`: Adds index and sorts and renames columns

<br/><br/>

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

Dependabot requested two fixes. One for an upgrade to pillow [#1068](https://github.com/NOAA-OWP/inundation-mapping/pull/1068) and the other for juypterlab #[1067 ](https://github.com/NOAA-OWP/inundation-mapping/pull/1067)
Expand Down
12 changes: 11 additions & 1 deletion tools/combine_crosswalk_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def combine_crosswalk_tables(data_directory, output_filename):
filename, usecols=['HUC', 'HydroID', 'feature_id', 'LakeID'], dtype={'HUC': str}
)
file_df = file_df.drop_duplicates()
file_df = file_df.rename(columns={'HUC': 'huc8'})
file_df['BranchID'] = os.path.split(os.path.dirname(filename))[1]

dfs.append(file_df)
Expand All @@ -32,6 +31,17 @@ def combine_crosswalk_tables(data_directory, output_filename):
if len(dfs) > 1:
df = pd.concat(dfs)

df = df.rename(
columns={'HUC': 'huc8', 'HydroID': 'hydro_id', 'LakeID': 'lake_id', 'BranchID': 'branch_id'}
)

df = df.sort_values(by=['feature_id', 'huc8', 'branch_id', 'hydro_id'])

df = df.reset_index(drop=True)
df['hand_id'] = df.index + 1

df = df[['hand_id', 'feature_id', 'huc8', 'branch_id', 'hydro_id', 'lake_id']]

df.to_csv(output_filename, index=False)


Expand Down

0 comments on commit 682c15b

Please sign in to comment.