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

Remove unused functionality and tests #286

Merged
merged 10 commits into from
Jan 5, 2024
Merged

Conversation

forrestfwilliams
Copy link
Contributor

@forrestfwilliams forrestfwilliams commented Jan 4, 2024

This PR will be the first of several, which will attempt to modernize hyp3lib for its current usage. This first PR removes all functionality not currently being using by one of these GitHub orgs:

ASFHyP3, asfadmin, ASFOpenSARLab, access-cloud-based-insar, dbekaert, ASFBinderRecipes

All code in the ASFHyP3/scratch directory was excluded.

All of the remaining tests are passing.

Removed files include:

  • hyp3lib/apply_wb_mask.py
  • hyp3lib/area2point.py
  • hyp3lib/copy_metadata.py
  • hyp3lib/cutGeotiffs.py
  • hyp3lib/cutGeotiffsByLine.py
  • hyp3lib/dem2isce.py
  • hyp3lib/draw_polygon_on_raster.py
  • hyp3lib/enh_lee_filter.py
  • hyp3lib/extendDateline.py
  • hyp3lib/file_subroutines.py
  • hyp3lib/geotiff_lut.py
  • hyp3lib/getBursts.py
  • hyp3lib/getDemFor.py
  • hyp3lib/getSubSwath.py
  • hyp3lib/get_bb_from_shape.py
  • hyp3lib/get_bounding.py
  • hyp3lib/get_dem.py
  • hyp3lib/ingest_S1_granule.py
  • hyp3lib/iscegeo2geotif.py
  • hyp3lib/makeChangeBrowse.py
  • hyp3lib/makeColorPhase.py
  • hyp3lib/makeKml.py
  • hyp3lib/make_arc_thumb.py
  • hyp3lib/metadata.py
  • hyp3lib/offset_xml.py
  • hyp3lib/ps2dem.py
  • hyp3lib/rasterMask.py
  • hyp3lib/rtc2colordiff.py
  • hyp3lib/simplify_shapefile.py
  • hyp3lib/subset_geotiff_shape.py
  • hyp3lib/tileList2shape.py
  • hyp3lib/utm2dem.py
  • hyp3lib/verify_opod.py
  • hyp3lib/etc/init.py
  • hyp3lib/etc/config/get_dem.cfg
  • hyp3lib/etc/lut/change.lut
  • hyp3lib/etc/lut/glacier_tracking.lut
  • tests/test_getSubSwath.py
  • tests/test_get_bounding.py
  • tests/test_get_dem.py

@forrestfwilliams forrestfwilliams requested a review from a team as a code owner January 4, 2024 15:26
Copy link
Contributor

@jhkennedy jhkennedy left a comment

Choose a reason for hiding this comment

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

When looking at the deletions, I see at least 5 (I stopped here) modules being removed that are used in one of our repositories:

  1. createAmp.py: https://github.com/ASFHyP3/hyp3-gamma/blob/develop/hyp3_gamma/rtc/rtc_sentinel.py#L20
  2. make_cogs.py: https://github.com/ASFHyP3/hyp3-gamma/blob/develop/hyp3_gamma/rtc/rtc_sentinel.py#L25
  3. raster_boundary2shape.py: https://github.com/ASFHyP3/hyp3-gamma/blob/develop/hyp3_gamma/rtc/rtc_sentinel.py#L26
  4. rtc2color.py: https://github.com/ASFHyP3/hyp3-gamma/blob/develop/hyp3_gamma/rtc/rtc_sentinel.py#L27
  5. system.py: https://github.com/ASFHyP3/hyp3-gamma/blob/develop/hyp3_gamma/rtc/rtc_sentinel.py#L28

We should revisit the methodology used to determine what modules/functions are used across the orgs.

@forrestfwilliams
Copy link
Contributor Author

Thanks for the catch @jhkennedy. My script failed to find all the results because of this bug in the GitHub CLI.

@forrestfwilliams
Copy link
Contributor Author

Everything has been added back!

Copy link
Contributor

@jhkennedy jhkennedy left a comment

Choose a reason for hiding this comment

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

I caught one more removed-but-used module

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Notably, ifm_sentinel.py also had many hyp3lib imports

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this is mentioned in insarlab/MintPy documentation (the only hit for hyp3lib):
https://github.com/search?q=org%3Ainsarlab%20hyp3lib&type=code

I don't think that's enough to keep the file, but we'll want to make a PR there to change it -- maybe as part of this (?): insarlab/MintPy#1004

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that's bad information anyway. I think we should remove the functionality and change the docs.

setup.py Outdated
'extendDateline.py = hyp3lib.extendDateline:main',
'geotiff_lut.py = hyp3lib.geotiff_lut:main',
'get_bounding.py = hyp3lib.get_bounding:main',
'getDemFor.py = hyp3lib.getDemFor:main',
'get_asf.py = hyp3lib.get_asf:main',
Copy link
Contributor

Choose a reason for hiding this comment

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

What's still using get_asf.py?

Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, what's still using metadata.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, both of those can be removed.

@forrestfwilliams
Copy link
Contributor Author

@jhkennedy this is ready for your re-review!

Copy link
Contributor

@jhkennedy jhkennedy left a comment

Choose a reason for hiding this comment

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

Everything looks good now! PyCharm inspection also doesn't find anything worrying specific to these changes (thought here's a lot we should clean up):
image

@forrestfwilliams did you update the PR comment to reflect the final changes?

@forrestfwilliams
Copy link
Contributor Author

Yep, updated!

@forrestfwilliams forrestfwilliams merged commit 112ac9c into develop Jan 5, 2024
8 checks passed
@forrestfwilliams forrestfwilliams deleted the burn_it_down branch January 5, 2024 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants