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: Tool to evaluate crosswalk accuracy #1061

Merged
merged 23 commits into from
Jan 12, 2024

Conversation

mluck
Copy link
Contributor

@mluck mluck commented Jan 5, 2024

Adds a post-processing tool to compare crosswalked (conflated) feature_ids between NWM stream network to DEM-derived reaches. The tool is run if the -x flag is added to fim_pipeline.sh. Results are computed for branch 0 and saved in a summary file in the HUC output folder. Closes #1000 and closes #1013 and closes #1020.

Three different crosswalking methods were evaluated with this tool: midpoint, majority catchment, and the ras2fim conflation developed by A. Carter. Two HUCs were tested -- the midpoint and ras2fim had similar results with midpoint performing slightly better as shown below (highest in each category in bold)

HUC method   correct total proportion   correct total proportion
12040101 midpoint intersections 2939 3037 0.97 tree 360 684 0.53
  catchment   2805 3037 0.92   316 696 0.45
  ras2fim   2935 3037 0.97   351 680 0.52
12090301 midpoint   5041 5347 0.94   402 893 0.45
  catchment   4922 5347 0.92   359 898 0.40
  ras2fim   5113 5347 0.96   382 881 0.43

Additions

  • tools/evaluate_crosswalk.py: evaluates crosswalk accuracy using two methods:
    • intersections: the number of intersections between streamlines
    • network (or tree): compares the feature_ids of the immediate upstream segments

Changes

  • Dockerfile: added toolsDir environment variable
  • fim_pipeline.sh: added -x flag to run crosswalk evaluation tool
  • fim_post_processing.sh: changed hardcoded /foss_fim/tools to toolsDir environment variable
  • fim_pre_processing.sh: added evaluateCrosswalk environment variable
  • src/
    • add_crosswalk.py: fix bug
    • delineate_hydros_and_produce_HAND.sh: added a call to verify_crosswalk.py if evaluateCrosswalk is True.

Testing

Ran the following pipeline.sh with -x flag to produce crosswalk_evaluation_0.csv in HUC folder in /outputs/dev-verify-crosswalk

fim_pipeline.sh -c /foss_fim/config/params_template.env -o -jh 2 -jb 3 -n dev-verify-crosswalk -u "12090301 12040101" -x

Example output for /outputs/dev-verify-crosswalk/12040101/crosswalk_evaluation_0.csv:

huc method correct total proportion
12040101 intersections 2939 3037 0.96773131379651
12040101 network 360 684 0.526315789473684

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 enhancement New feature or request testing Evaluation and testing related labels Jan 5, 2024
@mluck mluck requested a review from RobHanna-NOAA January 5, 2024 21:39
RobHanna-NOAA
RobHanna-NOAA previously approved these changes Jan 10, 2024
Copy link
Contributor

@RobHanna-NOAA RobHanna-NOAA left a comment

Choose a reason for hiding this comment

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

I checked out a couple of combinations of the x arg and it looks good

@CarsonPruitt-NOAA CarsonPruitt-NOAA merged commit 5478554 into dev Jan 12, 2024
1 check passed
@CarsonPruitt-NOAA CarsonPruitt-NOAA deleted the dev-verify-crosswalk branch January 12, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request testing Evaluation and testing related
Projects
None yet
3 participants