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

load_data: add mintpy.multilook.method for mean/median #797

Merged
merged 13 commits into from
Jun 22, 2022

Conversation

yuankailiu
Copy link
Contributor

@yuankailiu yuankailiu commented Jun 17, 2022

Description of proposed changes

Allow different options of multilook interpolation while loading data by parsing a method variable

  • 'nearest' method (default)
  • 'mean' method
  • 'median' method

This applies to multilook the unwrapPhase, coherence, wrapPhase. But not the connectedComponent.

Propagate the method variable from the template file named as mintpy.load.stepMethod

##---------multilook (optional):
## multilook while loading data with nearest interpolation, to reduce dataset size
mintpy.load.ystep          = 10    #[int >= 1], auto for 1 - no multilooking
mintpy.load.xstep          = 10    #[int >= 1], auto for 1 - no multilooking
mintpy.load.stepMethod     = mean    #[nearest, mean, median], auto for nearest - lines/rows skipping approach

By setting the multilook while loading data to mean or median, the noise in the loaded datasets is reduced. So this can be used for a smoother visualization of interferograms and the resulting time series, and the velocity.

Use with care. Because using mean or median multilook on the unwrapped phase can smoothen the integer of $2\pi$ phase jumps (due to unwrapping errors). This may result in issues in unwrapping errors identification and correction. Average multilooking will also introduce a lack of phase closure over an interferometric circuit. So we better still use 'nearest' as the default setting.

Reminders

  • 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.

@yuankailiu yuankailiu requested a review from yunjunz June 17, 2022 21:24
@yuankailiu
Copy link
Contributor Author

Looks like there are lots of conflicts with #796. I will try to fix them.

yuankailiu added a commit to yuankailiu/MintPy that referenced this pull request Jun 20, 2022
+ mintpy.multilook.
suggested from insarlab#797 (comment)

+ bugfix of size in creating ionosphere dataset in stackDict.py
@yuankailiu
Copy link
Contributor Author

Hi @yunjunz, this PR is updated regarding the template names and the dataset size bug we discussed offline. Take a look when you have some time. Thanks!

The Ci/Circleci test failed just because
ValueError: PYAPS: No account info found for ERA5 in CDS section in file: /root/tools/miniconda3/lib/python3.9/site-packages/pyaps3/model.cfg

@yunjunz
Copy link
Member

yunjunz commented Jun 20, 2022

The Ci/Circleci test failed just because ValueError: PYAPS: No account info found for ERA5 in CDS section in file: /root/tools/miniconda3/lib/python3.9/site-packages/pyaps3/model.cfg

Comparing the two circle CI runs (from the latest main branch and this PR) shows that the loaded ifgramStack.h5 is incorrectly resized from 390 x 390 to 780 x 781, thus, causing the pre-staged ERA5.h5 not usable.

I will take a deeper look later today.

@yuankailiu yuankailiu closed this Jun 20, 2022
@yuankailiu yuankailiu reopened this Jun 20, 2022
@yunjunz yunjunz changed the title load_data: multilook x/ystep load_data: add mintpy.multilook.method for mean/median Jun 21, 2022
yunjunz pushed a commit to yuankailiu/MintPy that referenced this pull request Jun 21, 2022
+ mintpy.multilook.
suggested from insarlab#797 (comment)

+ bugfix of size in creating ionosphere dataset in stackDict.py
yuankailiu and others added 13 commits June 21, 2022 18:38
Allow different options of multilook interpolation while loading data by parsing a method variable
+ 'nearest' method (default)
+ 'mean'    method
+ 'median'  method

Propagate the method variable from the template file named as mintpy.load.stepMethod

Merge and resolve conflicts with insarlab#796
+ mintpy.multilook.
suggested from insarlab#797 (comment)

+ bugfix of size in creating ionosphere dataset in stackDict.py
to be more consistent with the order of execution in the code
+ utils.attribute.py: add update_attribute4resize()

+ prep_isce.prepare_stack(): call update_attribute4resize() to simplify the code

+ objects.stackDict.ifgramStackDict.write2hdf5(): update metadata if resizing is applied (to ionStack.h5).
Copy link
Member

@yunjunz yunjunz left a comment

Choose a reason for hiding this comment

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

This PR looks all good to me now. @yuankailiu please let me know if your geocoding issue from our offline discussion is resolved or not with the latest commits. Then we could go ahead and merge this PR.

@yuankailiu
Copy link
Contributor Author

yuankailiu commented Jun 22, 2022

This PR looks all good to me now. @yuankailiu please let me know if your geocoding issue from our offline discussion is resolved or not with the latest commits. Then we could go ahead and merge this PR.

Great, thank you! Now the metadata is correct and the geocoding of the ionStack.h5 is working fine. I agree that we can merge the PR.

@yunjunz yunjunz merged commit 340062d into insarlab:main Jun 22, 2022
@yuankailiu yuankailiu deleted the dev.xystep branch June 22, 2022 06:38
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