Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@DennyChee
Copy link
Contributor

@DennyChee DennyChee commented Apr 1, 2025

Description of proposed changes

changed 'lzf' to iDict['compression']

loading of geometry radar.h5 was choosing 'lzf' as the compression method despite specifying something else in the config file.

Reminders

  • Pass Pre-commit check (green)
  • Pass Codacy code review (green)
  • Pass Circle CI test (green)
  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • If modifying functionality, describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

Summary by Sourcery

Bug Fixes:

  • Fixed hardcoded compression method when saving geometry radar data to .h5 files, now using the compression method specified in the configuration dictionary

changed 'lzf' to iDict['compression']
removed hardcoding for compression
@welcome
Copy link

welcome bot commented Apr 1, 2025

πŸ’– Thanks for opening this pull request! Please check out our contributing guidelines. πŸ’–
Keep in mind that all new features should be documented. It helps to write the comments next to the code or below your functions describing all arguments, and return types before writing the code. This will help you think about your code design and usually results in better code.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Apr 1, 2025

Reviewer's Guide by Sourcery

This pull request fixes an issue where the compression method for saving geometry radar data was hardcoded to 'lzf', ignoring the compression method specified in the configuration file. The changes modify the load_data function to use the compression method specified in iDict['compression'] when writing the geometry radar data to an HDF5 file.

Sequence diagram for saving geometry radar data with specified compression

sequenceDiagram
  participant User
  participant load_data Function
  participant geom_radar_obj

  User->>load_data Function: Calls load_data with configuration (iDict)
  load_data Function->>geom_radar_obj: write2hdf5(..., compression=iDict['compression'])
  geom_radar_obj-->>load_data Function: Writes data to HDF5 file with specified compression
  load_data Function-->>User: Returns
Loading

File-Level Changes

Change Details Files
Modified the compression method for saving geometry radar data to use the value specified in the configuration file instead of hardcoding 'lzf'.
  • Replaced the hardcoded compression value 'lzf' with iDict['compression'] when writing the geometry radar data to an HDF5 file.
  • Ensured that the compression method used for writing the geometry radar data matches the configuration settings.
src/mintpy/load_data.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Merdele - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Good job addressing the hardcoded compression; this change makes the code more flexible and configuration-driven.
Here's what I looked at during the review
  • 🟒 General issues: all looks good
  • 🟒 Security: all looks good
  • 🟒 Testing: all looks good
  • 🟒 Complexity: all looks good
  • 🟒 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click πŸ‘ or πŸ‘Ž on each comment and I'll use the feedback to improve your reviews.

@yunjunz
Copy link
Member

yunjunz commented Apr 1, 2025

This lzf compression is hardwired for geometry files on purpose, for a significantly smaller file size, without much impact on the performance. Did this cause a problem?

@DennyChee
Copy link
Contributor Author

Did not cause a problem, needed to the h5 file to not be compressed for other purposes and specifying None in the CLI didn't change it so i thought it was a bug!

@yunjunz
Copy link
Member

yunjunz commented May 30, 2025

Sorry for the late feedback, I got busy at work. I think we can clear the confusion in the code behavior as follows:

  1. add a new option default, which will use None for the stack and lzf for the geometry;
  2. for other existing options gzip, lzf, None, the code will faithfully compress the file as told.

I will commit the change.

+ `defaults/smallbaselineApp(_auto).cfg`: add `mintpy.load.compression = default`option for the default behavior (None/lzf for the stack/geometry files)

+ `cli/load_data.py`: remove the `--compression` option from the command line, to allow input from the template file ONLY, for simplicity.

+ `load_data.py`: translate `default` compression in the `main()`, so that the code will do other compressions as told.

+ `(cli/)prep_aria.py`: follow the same compression behavior as `load_data.py` above.
@yunjunz yunjunz changed the title fixed compression hardcoding for geometry radar when saving as .h5 file add mintpy.load.compression = default option & allow custom compression for geometry HDF5 file May 30, 2025
@yunjunz yunjunz merged commit 5e6ecfb into insarlab:main May 30, 2025
8 checks passed
@welcome
Copy link

welcome bot commented May 30, 2025

πŸŽ‰ πŸŽ‰ πŸŽ‰ Congrats on merging your first pull request! We here at behaviorbot are proud of you! πŸŽ‰ πŸŽ‰ πŸŽ‰

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.

2 participants