Skip to content

[1pt] PR: Remove buffer clipping from streams below HUC #1591

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

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

mluck
Copy link
Contributor

@mluck mluck commented Jul 10, 2025

Clipping of NWM streams below the HUC can cause issues if a stream exits and re-enters the DEM. The buffering causes the outlet to not extend to the edge of the DEM even if the ultimate outlet does. This results in "reverse flow" during the pit-filling operation which causes flat areas in the filled DEM and the loss of catchments as the DEM-derived reaches deviate from the NWM streams. Removing the clipping of the outlet streams anywhere below the HUC corrects the DEM so that the pit-filling produces the correct result. Resolves #1589.

Changes

  • data/wbd/
    • clip_vectors_to_wbd.py: Removes clipping from streams below HUC
    • generate_pre_clip_fim_huc8.py: Fixes spelling errors
  • src/
    • bash_variables.env: Updates pre_clip_huc_dir with new folder date
    • stream_branches.py: Updated logic and cleaned up code (deleted commented code blocks)

Testing

Resolves the issue in HUC 05030106. Previously, the NWM stream that exited and re-entered the DEM below the HUC outlet was clipped, and that clipped stream line was burned into the DEM (left). Now, the stream line is not clipped before it's burned (right).
image

The resulting GMS catchments are once again complete.
image

Deployment Plan (For developer use)

How does the changes affect the product?

  • Code only?
  • If applicable, has a deployment plan be created with the deployment person/team?
  • Require new or adjusted data inputs? Does it have start, end and duration code (in UTC)?
  • If new or updated data sets, has the FIM code been updated and tested with the new/adjusted data (subset is fine, but must be a subset of the new data)?
  • Require new pre-clip set?
  • Has new or updated python packages?

Issuer Checklist (For developer use)

You may update this checklist before and/or after creating the PR. If you're unsure about any of them, please ask, we're here to help! These items are what we are going to look for before merging your code.

  • Informative and human-readable title, using the format: [_pt] PR: <description>
  • Links are provided if this PR resolves an issue, or depends on another other PR
  • If submitting a PR to the dev branch (the default branch), you have a descriptive Feature Branch name using the format: dev-<description-of-change> (e.g. dev-revise-levee-masking)
  • Changes are limited to a single goal (no scope creep)
  • The feature branch you're submitting as a PR is up to date (merged) with the latest dev branch
  • pre-commit hooks were run locally
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • CHANGELOG updated with template version number, e.g. 4.x.x.x
  • Add yourself as an assignee in the PR as well as the FIM Technical Lead

Merge Checklist (For Technical Lead use only)

  • Update CHANGELOG with latest version number and merge date
  • Update the Citation.cff file to reflect the latest version number in the CHANGELOG
  • If applicable, update README with major alterations

@mluck mluck self-assigned this Jul 10, 2025
@mluck mluck added bug Something isn't working Inputs For getting new data, updating data, changing inputs, etc labels Jul 10, 2025
@mluck
Copy link
Contributor Author

mluck commented Jul 11, 2025

Clarification on the explanation above: this issue is caused by the NWM stream line exiting (and thus being clipped by) the wbd_streams_buffer, which is 8 cells inside the 5000 meter wbd_buffer. The stream line exiting the DEM isn't responsible for this issue. Below, the streamline (blue) can be seen extending past the wbd_streams_buffer (gray) and re-entering further downstream.
image

Copy link
Contributor

@ZahraGhahremani ZahraGhahremani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this successfully for the target HUC and a randomly chosen HUC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Inputs For getting new data, updating data, changing inputs, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[5pt] Catchments drop in Ohio River and Illinois River
2 participants