Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DataFrame merge error on id field for HF >= 2.2 #851

Closed
wants to merge 2 commits into from

Conversation

aaraney
Copy link
Member

@aaraney aaraney commented Jan 6, 2025

Problem:

t-route tries to join two dataframes where one dataframe has two columns with the same name, id. A ValueError is raised b.c. the column labels are not unique. This seemingly only affects running t-route with HF 2.2.

HF 2.2 introduced a link field to the flowpath-attributes table. Per the HF schema docs, this field is a duplication of the existing id field needed for t-route (@shorvath-noaa can you provide background on this?). If t-route detects the link field, t-route will rename it from link -> id causing a column name duplication. Later code joins this dataframe using the id field and this causes the aforementioned exception.

Proposed Solution:

If link field is present, drop id field then rename link to id.

This seems to have been addressed in #847 however the change is so minor IMO a smaller PR will be easier to review and resolve issues in using t-route with HF 2.2.

@aaraney aaraney requested a review from shorvath-noaa January 6, 2025 20:13
@aaraney aaraney added the bug Something isn't working label Jan 6, 2025
@shorvath-noaa
Copy link
Contributor

Yeah, this is one of several updates that t-route needs to be able to run on Hydrofabric v2.2. I don't believe I have the authority anymore to approve/merge PRs on this repo though, maybe @kumdonoaa can?

@aaraney
Copy link
Member Author

aaraney commented Jan 7, 2025

Okay! Thanks, @shorvath-noaa! I am going to close this for now then.

@aaraney aaraney closed this Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants