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

[1pt] PR: Snap crosswalk to NWM streams #1205

Merged
merged 9 commits into from
Jul 8, 2024
Merged

Conversation

mluck
Copy link
Contributor

@mluck mluck commented Jul 1, 2024

Snaps crosswalk from the midpoint of DEM-derived reaches to the nearest point on NWM streams within a threshold of 100 meters. DEM-derived streams that do not locate any NWM streams within 100 meters of their midpoints are removed from the FIM hydrofabric and their catchments are not inundated. Fixes #1194 and resolves #981.

Changes

  • src/add_crosswalk.py: Locates nearest NWM stream to midpoint of DEM-derived reaches if within 100 meters. Also fixes a couple of minor bugs.

Testing

Deployment Plan (For developer use)

How does the changes affect the product?

  • Code only?
  • 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?
  • If applicable, has a deployment plan be created with the deployment person/team?

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
  • Passes all unit tests locally (inside interactive Docker container, at /foss_fim/, run: pytest unit_tests/)
  • 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
  • Reviewers requested
  • 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 added bug Something isn't working enhancement New feature or request labels Jul 1, 2024
@mluck mluck marked this pull request as ready for review July 1, 2024 20:12
@mluck
Copy link
Contributor Author

mluck commented Jul 1, 2024

Inundation in 18100201 in the oval area was reported to be false (#981). The current feature branch dev-extend-fix-snap-crosswalk corrects the crosswalking error in the DEM-derived reaches (red dashed lines) and removes the inundation.

image

@mluck
Copy link
Contributor Author

mluck commented Jul 1, 2024

The current feature branch dev-snap-crosswalk removes the DEM-derived reaches and catchments if no NWM stream is found within 100 meters of the midpoint of the DEM-derived reach. The effect is that there are areas with no catchments in the HUC (left). However, those areas may be inundated by other branches as displayed in the mosaicked image on the right.

image

ZahraGhahremani
ZahraGhahremani previously approved these changes Jul 5, 2024
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.

I tested a few HUCs (19020602, 21010004, and 1060001), and the code is working as expected. It removes DEM-derived reaches if they’re not within 100 meters of NWM streams.
The red lines show the DEM-derived streams, and the green lines are the NWM streams. For HUC 1060001, the catchment was previously inundated by some DEM-derived reaches (fim_4_5_2_0), but they’re not affected in the current feature branch since they don’t have NWM streams within 100 meters of their midpoints. This PR doesn’t have any unintended effects.
FIM
snap

@mluck
Copy link
Contributor Author

mluck commented Aug 6, 2024

Results of the evaluation of the crosswalk using the intersection method (using tools/evaluate_crosswalk.py) in the BED HUCs (n=2153):

  • The mean evaluation increased from 96.8% to 97.4%
  • Evaluation for 1632 HUCs increased, 11 unchanged, and 510 HUCs decreased

@mluck
Copy link
Contributor Author

mluck commented Aug 7, 2024

More detailed overall stats comparing fim_4_5_2_11 - fim_4_4_15_0:

count    2153
mean        0.006315
std         0.015147
min        -0.078818
25%         0.000048
50%         0.003039
75%         0.007652
max         0.222222

I looked at the HUC that decreased the most. The low performance highlights a known limitation in the evaluation test rather than a reduction in the crosswalk accuracy. For example, in the image below, the midpoint of the DEM-derived reach (dashed red line) is correctly crosswalked to the green NWM feature_id via the snapping method, but the evaluation that compares the number of intersections in the DEM-derived reaches and the NWM streams has more intersections with the solid red NWM stream than the green NWM stream.
image

@CarsonPruitt-NOAA
Copy link
Collaborator

That's great! I'll count this as a pretty big win.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
3 participants