GeoscienceAustralia / PyRate

A Python tool for estimating velocity and time-series from Interferometric Synthetic Aperture Radar (InSAR) data.
https://geoscienceaustralia.github.io/PyRate/
Apache License 2.0
203 stars 71 forks source link

Change which file is saved to aps_error_dir #346

Closed adeane-ga closed 3 years ago

adeane-ga commented 3 years ago

After using the correction plotting script on the APS error correction directory (aps_error_dir), it was apparent that the file saved out as a "correction", is actually the corrected IFG file.

At line 97 in the spatio_temporal_filter() function below we see that tsincr is the time series epoch corrected for APS, and the ts_aps is the combined temporal and spatial filter which is subtracted from the data to perform the correction. At line 173 and 174 inside _ts_to_ifgs(), we can see that it is the corrected phase that is saved both to the tmp_dir and also the aps_error_dir. Here we should be saving ts_aps into the aps_error_dir. This PR is for making this change.

https://github.com/GeoscienceAustralia/PyRate/blob/508fb4b2a0b5fb2f53ad2b3cf508c7b6db37956a/pyrate/core/aps.py#L79-L100

https://github.com/GeoscienceAustralia/PyRate/blob/508fb4b2a0b5fb2f53ad2b3cf508c7b6db37956a/pyrate/core/aps.py#L153-L174

To summarise, below are some plots output from a PyRate process with only the APS error correction applied. The only difference between plots is which file is being saved out to the aps_error_dir.

Plot structure Left: Uncorrected Interferogram Middle: Correction File Right: Corrected Interferogram

What we are currently saving out to aps_error_dir:

image

This PR will result in the appropriate correction file being saved in aps_error_dir, as seen by this plot:

image

To confirm, I made a 4th panel which is MIDDLE + RIGHT to see if we get back to the original interferogram:

image

An interesting note Out of interest, its also worth noting line 172 (below), where (I think) the corrected time series is being reconstructed into the original IFGs by datepair by summing the cumulative time series between two associated epochs of the corrected phase. A potential issue with this, is that whatever is not captured by the APS spatiotemporal filter will propagate through into the listed IFGs upon reconstruction. This may explain why we are getting "ghost" tropospheric features appear in unrelated IFGs. I think this is what Richard was saying when we first noted them. I may be wrong, but thought I'd note it for discussion.

https://github.com/GeoscienceAustralia/PyRate/blob/508fb4b2a0b5fb2f53ad2b3cf508c7b6db37956a/pyrate/core/aps.py#L172