-
Notifications
You must be signed in to change notification settings - Fork 72
Bugfix phase_data unit conversion in correct step #347
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
Conversation
…of comparison test (non-passing due to changes to radians/millimetres conversion)
… conversion issue
684a322
to
99443e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a good idea to ensure consistency - this definitely needed to be changed for orbital fit to work. I have a few questions:
- Does calling
nan_and_mm_convert
always do nothing if the ifg is already in the correct units? (i.e. is metadata on conversion status stored to the geotiff and used by this function) - Are there specific examples besides the orbit fit where the inconsistent conversion will result in incorrect output?
- It seems that the sequence of calls is now almost always
ifg.open()
followed bynan_and_mm_convert(ifg, params)
. Would it make more sense to just include the conversion in theopen
method, or do the conversion and save it inprepifg
and just refer to the converted ifg from then on?
I also caught a specific issue with "backing up" uncorrected ifgs below, and a change to testing tolerances which needs to be explained. Besides these questions and minor issues, I will run this branch on the mosaic as an "integration test" to confirm the results make sense and finalise the review based on that.
shared.nan_and_mm_convert(ifg, params) | ||
fullres_ifg = ifg # keep a backup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the idea is to keep a copy of the numpy phase data before the orbital correction, this line won't achieve that - x = y
for numpy arrays just creates a new pointer to the same data, so any changes to y
will also show up in x
. I think this still applies to attributes of the Ifg
class, but it should be easy to test this in a python prompt by importing the pyrate shared
module, creating an Ifg and checking its behaviour. I'm not sure what this "backup" is used for, but it seems this problem has been here since before the PR so it's worth checking it isn't breaking anything else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe the intent is to have two separate yet identical versions of the data at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a comment describing what I have experienced so far with this PR. Not yet ready to approve until we figure out the masking issue in the phase closure algorithm. Nontheless, here are some comments relating mostly to DEM error correction.
I have run this PR branch on both the ARD produced Mexico data and also the Hunter Valley frame T147D_F32S_S1A
.
The Mexico data processed okay, but I found I had to turn off the phase closure because I couldn't figure out appropriate parameter values. Below image shows Mexico frame with default phase closure parameters from branch config file:
Regarding Hunter Valley frame, the main aim was to check and see if the DEM error is showing more realistic values than previously seen. The below image shows the DEM error with the layers panel showing both the PR and Develop branch results. We can see that the PR Branch is showing a range of values that is more realistic for the mine related DEM error. This indicates that the unit conversion fix has had a positive affect on this correction.
I still have uncertainty on whether the actual DEM error correction to the IFGs is operating as expected. But this is outside the scope of this PR and will need dedicated attention separately using synthetic DEM data.
General Comments
- We have uncovered an issue with the way the phase closure masking is operating, possibly related to unit change and parameter values (but not sure yet, still working on investigating this).
- I wonder if we could have a more clear handling of unit conversion. At the moment we have attempted unit conversions happening every time an IFG is opened and a check to see if the conversion is needed or not. I still find this hard to follow throughout the workflow. Would it be possible to do a single unit conversion to millimeters at the beginning and then operate exclusively in millimeters for the rest of the workflow. For algorithms that do benefit from working in radians, such as the phase closure, could we have the unit conversion back and forth happen within the phase closure function? This would make it clear and unambiguous when and where the conversions are happening.
- The above point isn't necessarily a request for this PR, but something to think about for potential workflow changes in the future.
I've also just noticed some inconsistent values for phase closure between the documentation and the default config file in branch: From Lines 144 to 158 in dde59c6
From documentation: |
see the function
The issue that I found was that the
Doing the unit conversion once during |
To supplement @richardt94 's detailed look into the code, I can here summarise how PyRate is performing on the test data set (Mexico) for a broad qualitative assessment. I am happy now to merge this PR once we discuss the results of what @richardt94 finds in regards increased masking when the corrections were not being applied to Numpy files. Summary:
Future work for dedicated PRs:
The next two figures compare PyRate validation between an older develop branch before recent changes and the current PR branch. This is the Crop-A data. TOP: old develop branch from early 2021 Next figure we see the same dataset with the Network method used for orbital fitting instead of the independent method. The Next set of figures are full frame Mexico PyRate processing with changes to the Phase closure settings: Next figure is the GPS-PyRate comparison for the full frame of Mexico data. Next figure shows the linear samples with range on left. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved subject to comments above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just adding formal approval. See my above comments: #347 (comment)
7be6182
to
0a5363e
Compare
This PR addresses the issue of
phase_data
unit conversion during thecorrect
step. It is important that every correction algorithm receives thephase_data
in the correct units (usually millimetres, but radians for the phase closure algorithm). By using the debug level log statements, I found that the conversion was not being consistently applied during the various correction steps and/or saved afterwards.This PR introduces the following changes:
nan_and_mm_convert
is applied whenever anshared.Ifg
object is opened.Ifg.write_modified_phase
) and beforeshared.Ifg
object is closed.phase_data
that is saved to numpy files after each correction step.I have also:
shared.Ifg
class for reading data and mm conversion.