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: Clean up Python files in FIM pipeline #1382

Merged
merged 7 commits into from
Jan 3, 2025

Conversation

mluck
Copy link
Contributor

@mluck mluck commented Dec 19, 2024

Cleans up Python files within delineate_hydros_and_produce_HAND.sh to improve performance, especially memory management, including removing unused imports, deleting object references when objects are no longer needed, and removing GDAL from the fim_process_unit_wb.sh step of FIM pipeline. Contributes to #1351 and #1376.

Changes

  • data/create_vrt_file.py and tools/pixel_counter.py: Removes unused import
  • src/
    • accumulate_headwaters.py, add_crosswalk.py, adjust_thalweg_lateral.py, filter_catchments_and_add_attributes.py, heal_bridges_osm.py, make_rem.py, make_stages_and_catchlist.py, mitigate_branch_outlet_backpool.py, reachID_grid_to_vector_points.py, split_flows.py, unique_pixel_and_allocation.py: Deletes objects no longer in use
    • delineate_hydros_and_produce_HAND.sh, run_by_branch.sh, run_unit_wb.sh : Updates arguments
    • getRasterInfoNative.py: Refactors in rasterio (removed gdal)
  • tools/evaluate_crosswalk.py: Deletes objects no longer in use

Testing

Ran fim_pipeline.sh -o -jh 2 -jb 7 -n dev-cleanup-gdal -u "03100204 12090301" on my EC2.

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 added bug Something isn't working refactoring Refacting code to obtain the same result High Priority labels Dec 19, 2024
@RobHanna-NOAA RobHanna-NOAA self-requested a review December 20, 2024 16:13
@mluck mluck changed the title WIP [1pt] PR: Clean up Python files in FIM pipeline [1pt] PR: Clean up Python files in FIM pipeline Dec 27, 2024
RobHanna-NOAA
RobHanna-NOAA previously approved these changes Dec 27, 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.

Looks good. Did a fair bit of testing with FIM pipeline and alpha testing. It did not fix the segmentation error but that was expected. Either way, this is an imrovement. I did not explicitly test evalate_crosswalk.py or pixel_counter.py

@mluck
Copy link
Contributor Author

mluck commented Dec 27, 2024

As approved, this PR addresses #1351 for fim_process_unit_wb.sh but not yet for pre- or post-processing so #1351 will stay open at this time.

@CarsonPruitt-NOAA CarsonPruitt-NOAA merged commit 5e20284 into dev Jan 3, 2025
1 check passed
@CarsonPruitt-NOAA CarsonPruitt-NOAA deleted the dev-cleanup-gdal branch January 3, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working High Priority Ready_to_Merge refactoring Refacting code to obtain the same result
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[21pt] Segmentation Fault Avoid importing both rasterio and osgeo
3 participants