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

[2pt] PR: fixed hydrotable nan values #1414

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

Conversation

hhs732
Copy link
Contributor

@hhs732 hhs732 commented Jan 27, 2025

This PR fixes Hydrotables that have hydroIDs with nan values. These hydroids are associated with very small reaches which are linked to one-pixel catchments. Thus, those small reaches were removed in filter_catchments_and_add_attributes.py. This PR also removes the GMS catchments whose main streams are less than 1 m.
Also, tiny housekeeping has been done in filter_flows.py, no code change though.
This PR will close issue #1339.

Changes

  • src:
    • filter_catchments_and_add_attributes.py: Lines of code have been added to the function filter_catchments_and_add_attributes to find streams that do NOT have upstream branches and they are so tiny.

    • split_flows.py: Reorganization of functions and script description.

Testing

This PR has been tested successfully on 25 HUC8s, including 04040002, 01010009, 01050002, 01060001, 01100003, 01100004, 01100006, 02030202, 02070011, 03010205, 03050111, 03090203, 04010102, 04080103, 04140101, 04290001, 07020012, 08010202, 09020104, 09030003, 10130205, 16060010, 17120005, 21010005, and 04040003.

Deployment Plan (For developer use)

How does the changes affect the product?

  • Code only?
  • [N/A] If applicable, has a deployment plan be created with the deployment person/team?
  • [N/A] Require new or adjusted data inputs? Does it have start, end and duration code (in UTC)?
  • [N/A] 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)?
  • [N/A] Require new pre-clip set?
  • [N/A] 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
  • [N/A] New functions are documented (with a description, list of inputs, and expected output)
  • [N/A] 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

@hhs732 hhs732 self-assigned this Jan 27, 2025
@hhs732 hhs732 added bug Something isn't working Rating Curves FIM4 labels Jan 27, 2025
@hhs732 hhs732 linked an issue Jan 27, 2025 that may be closed by this pull request
@hhs732
Copy link
Contributor Author

hhs732 commented Jan 28, 2025

I checked some other HUC8s with lakes including 03100208, 02050103, 04030101, 04050002, 04040003, 04060101, and 16050101 to find the same issue. I am developing a script to find them CONUS-wise.

@hhs732
Copy link
Contributor Author

hhs732 commented Jan 28, 2025

The issue is generated in split_flows.py, but for almost all HUC8 it is resolved in filter_catchments_and_add_attributes.py and gdal_rasterize, except 04040002.

HUC8 04040002 -- DEV
demDerived_reaches_0.gpkg, input of split_flows.py
image

demDerived_reaches_split_0.gpkg (issue generated here, output of split_flows.py).
image

demDerived_reaches_split_filtered_0.gpkg (issue still here, the output of filter_catchments_and_add_attributes.py)
image

@hhs732
Copy link
Contributor Author

hhs732 commented Jan 28, 2025

This PR fixes this issue in filter_catchments_and_add_attributes.py. The image below shows demDerived_reaches_split_filtered_0.gpkg after fixing the issue.
image

By fixing this issue, the nan values are also removed from the hydrotables.

@hhs732 hhs732 requested review from CarsonPruitt-NOAA and RobHanna-NOAA and removed request for RobHanna-NOAA January 28, 2025 19:50
@hhs732 hhs732 marked this pull request as ready for review January 29, 2025 17:03
@hhs732
Copy link
Contributor Author

hhs732 commented Jan 30, 2025

Here is the list of catchments/huc8 that have single tiny reaches (no upstream).
https://docs.google.com/spreadsheets/d/10fN6_Zt3piH7vZEFdBh2WxjnzlFS-Ru0OmR8Pq6hyWQ/edit?usp=sharing

@hhs732
Copy link
Contributor Author

hhs732 commented Jan 30, 2025

Interestingly, some gms catchments are built around just one tiny stream, like catchment #617000007 in HUC 01100003:
image
image

@hhs732 hhs732 changed the title [1pt] PR: fixed hydrotable nan values [2pt] PR: fixed hydrotable nan values Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FIM4 Rating Curves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[8pt] Hydrotable with row with hydroID but mostly nulls after it
1 participant