Improve error legibility when locations aren't upstream of specified outlets - #34
Merged
Merged
Conversation
melkurdy96
approved these changes
Jul 21, 2026
| raise Warning( | ||
| f"The point with id = {id} is not contained in the watershed of the first point." | ||
| raise ValueError( | ||
| f"{gages_gdf.loc[id]['name']} is not in the watershed that drains to {gages_gdf.loc[id]['outlet_name']}. Please check locations and amend as needed." |
There was a problem hiding this comment.
name and outlet_name are not in the required columns in the delineator package so I think these could fail if this is called differently than how it is from our repo
There was a problem hiding this comment.
so maybe we can fall back to id and outlet_id ?
Author
There was a problem hiding this comment.
oo thank you for catching & suggesting those fall backs!! Sounds very reasonable to me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two errors that are improved here, so the user gets clear feedback on locations that may be misconfigured:
OTHER_LOCATION_NAME is not in the watershed that drains to OUTLET_NAME. Please check locations and amend as needed.)Delineation found REAL_OUTLET_NAME to be downstream of the basin outlet set by the user (USER_SET_OUTLET_NAME). Please check that this is correct, and if so, update 'outlet_name' for all points in this basin from USER_SET_OUTLET_NAME to REAL_OUTLET_NAME.)Tested end-to-end by calling the setup wizard with a misconfigured set of sites, and seeing that instead of the pretty incomprehensible errors we got before, these bubbled directly up to the user!