Feat/nhf upstream flow#81
Closed
dylanlee wants to merge 13 commits intofeat/add-nhf-links-and-nodesfrom
Closed
Conversation
Modify NHF.py to distribute Q into nodes and nexuses rather than as Q_lat into links
This commit fixes a bug that was introduced because _connections was being rebuilt on every routing loop. When virtual segments that are being used for Q_up discrarges were 0 in a loop this was causing an uncaught error
Clean up imports so don't have to export unecessarily from refactored NHF.py
Was previously not distributing upstream flow because virtual segment IDs were overwriting link IDs that were bing included in fp_to_first_link dict. This was causing loss of upstream flow because the flow was being recorded to virtual segments.
sclaw
reviewed
Mar 9, 2026
| geom = row['geometry'] | ||
| if geom is not None: | ||
| fp_geom_lookup[int(row['fp_id'])] = ( | ||
| geom.geoms[0] if geom.geom_type == 'MultiLineString' else geom |
There was a problem hiding this comment.
Should this be geoms[0] or should we do a line_merge here?
I'm thinking about an edge case where you take the first linestring and then one of the virtual nexuses doesn't intersect it?
Another impact might be the difference between fp_geom_length_m = fp_geom.length and length_km = fp['length_km']
sclaw
reviewed
Mar 9, 2026
| has_geometry = fp_geom is not None and tnex_ids | ||
|
|
||
| if has_geometry: | ||
| fp_geom_length_m = fp_geom.length |
There was a problem hiding this comment.
Was there a reason to split this out and not use fp_geom_length_m = length_km * 1000
|
Closing because this has been superseded by #85 |
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.
No description provided.