pygmtsar icon indicating copy to clipboard operation
pygmtsar copied to clipboard

[Help]: PS processing

Open SteffanDavies opened this issue 1 year ago • 51 comments

I am having issues with sbas.ps_parallel, some indications on workflow would be helpful.

Is ps_parallel supposed to be run after intf_parallel and merge_parallel? Doing so causes {final date}_F{merged subswaths}.PRM missing file error.

FileNotFoundError: [Errno 2] No such file or directory: 'raw_asc/S1_20230530_ALL_F23.PRM'

Removing this file from dates and passing custom dates causes another error:

sbas.ps_parallel(dates=sbas.df.index[:-1])
Exception: "ValueError('mmap length is greater than file size')"

SteffanDavies avatar Jun 28 '23 18:06 SteffanDavies

It is not ready for public usage. I share the examples on Patreon for early access for sponsors only. For now, PS-SBAS works but we need ability to export the original resolution (~15x4 meter) grids for PS validation and so on. Also, there are two PS-SBAS approaches already available in PyGMTSAR and a lot of testing required to provide the recommendations how and when use them.

AlexeyPechnikov avatar Jun 29 '23 04:06 AlexeyPechnikov

@SteffanDavies See the example of PS+SBAS processing: https://www.linkedin.com/feed/update/urn:li:activity:7089507310389121024/

AlexeyPechnikov avatar Jul 26 '23 08:07 AlexeyPechnikov

@SteffanDavies See the example of PS+SBAS processing: https://www.linkedin.com/feed/update/urn:li:activity:7089507310389121024/

I am currently testing this and in your example sbas.ps_parallel() is called before merging, however doing so will cause:

AssertionError: ERROR: multiple subswaths [2 3] found, merge them first using SBAS.merge_parallel()

So I suppose this only supports 1 subswath at the moment?

SteffanDavies avatar Jul 26 '23 17:07 SteffanDavies

It should work for all the subswaths. Are you sure SBAS.ps_parallel() does not work for multiple subswaths?

AlexeyPechnikov avatar Jul 27 '23 04:07 AlexeyPechnikov

It should work for all the subswaths. Are you sure SBAS.ps_parallel() does not work for multiple subswaths?

If I change to only 1 subswath it works fine, otherwise it gives the above error.

image

Also ps_parallel() leads to huge unmanaged memory used even after it has finished. My 64 GB RAM and 16GB Swap were full after it finished.

SteffanDavies avatar Jul 27 '23 15:07 SteffanDavies

More issues, topo_ra error and empty interferograms:

Dem is fine:

image

topo_ra error seems dask related?

image

Empty intf and corr (only plot 1 but all the same):

image

SteffanDavies avatar Jul 27 '23 16:07 SteffanDavies

For some reason, you have no active Dask client for the processing and most of PyGMTSAR operations are not available.

AlexeyPechnikov avatar Jul 27 '23 16:07 AlexeyPechnikov

Dask is running, I've never had this error before.

image

image

image

SteffanDavies avatar Jul 27 '23 16:07 SteffanDavies

The Dask issue can be related to disconnected client or maybe Dask version change (when Dask or distributed libraries upgraded and inconsistent to the running cluster).

ps_parallel() leads to huge unmanaged memory used even after it has finished.

Please explain how much scenes do you have to analyse?

AlexeyPechnikov avatar Jul 27 '23 16:07 AlexeyPechnikov

I reverted to PyGMTSAR pygmtsar-2023.5.3 and it is working. Something has broken in latest code.

image

image

SteffanDavies avatar Jul 27 '23 16:07 SteffanDavies

The Dask issue can be related to disconnected client or maybe Dask version change (when Dask or distributed libraries upgraded and inconsistent to the running cluster).

ps_parallel() leads to huge unmanaged memory used even after it has finished.

Please explain how much scenes do you have to analyse?

181 scenes.

SteffanDavies avatar Jul 27 '23 16:07 SteffanDavies

But this is the recent PyPI version for now. GitHub version is in the alpha stage and I change some function calls to allow a single-pixel accuracy for PS geocoding and more. For SBAS analysis, we don’t need ~4m output accuracy, but it’s critical to verify detected PS.

AlexeyPechnikov avatar Jul 27 '23 16:07 AlexeyPechnikov

But this is the recent PyPI version for now. GitHub version is in the alpha stage and I change some function calls to allow a single-pixel accuracy for PS geocoding and more. For SBAS analysis, we don’t need ~4m output accuracy, but it’s critical to verify detected PS.

I think the problem is related to your new dask delayed code. I was testing the new PS-SBAS to compare differences over railway.

SteffanDavies avatar Jul 27 '23 16:07 SteffanDavies

Yes, actually, I've fixed lots of issues in the github version last days. And you are right, ps_parallel does not work for multiple subswaths (it's easy to fix). About the memory consumption I need to test some ways — while it looks simple for sbas.ps_parallel() when the results should be stored on dist, it's not so trivial for sbas.ps_parallel(interactive=True) call when we expect to get the lazy result immediately.

AlexeyPechnikov avatar Jul 27 '23 17:07 AlexeyPechnikov

Yes, actually, I've fixed lots of issues in the github version last days. And you are right, ps_parallel does not work for multiple subswaths (it's easy to fix). About the memory consumption I need to test some ways — while it looks simple for sbas.ps_parallel() when the results should be stored on dist, it's not so trivial for sbas.ps_parallel(interactive=True) call when we expect to get the lazy result immediately.

Glad I could help. Looking forward to new PS processing.

SteffanDavies avatar Jul 28 '23 00:07 SteffanDavies

You'd try functions https://github.com/mobigroup/gmtsar/blob/pygmtsar/pygmtsar/pygmtsar/SBAS_ps.py on top of the same commit as the notebook above (the recent commits have changed SBAS and STL processing). It works well for subswaths while the old intf_parallel "weight" supports only a single subswath grid. 200 scenes ADI calculation requires ~30 minutes for a single subswath on Apple iMac M1 or Apple Air M2.

AlexeyPechnikov avatar Jul 28 '23 08:07 AlexeyPechnikov

Some posts about known corner reflectors detection on Sentinel-1 amplitudes and InSAR coherence: https://www.linkedin.com/feed/update/urn:li:activity:7091290249380691968/ https://www.linkedin.com/feed/update/urn:li:share:7091295824273408001/

The normed dispersion is large for high amplitude pixels. The intensities-based Amplitude Dispersion Index (ADI) looks as

image

when the amplitude-based ADI is not usable:

image

AlexeyPechnikov avatar Jul 30 '23 06:07 AlexeyPechnikov

The weighted interferometry results validation using known corner reflectors: https://www.linkedin.com/feed/update/urn:li:activity:7092021658172981248/

AlexeyPechnikov avatar Aug 01 '23 06:08 AlexeyPechnikov

Checked and it works for the known corner reflector: https://www.linkedin.com/feed/update/urn:li:share:7098256457971732480/ CR_SLC

AlexeyPechnikov avatar Aug 18 '23 11:08 AlexeyPechnikov

A set of screencasts available on the YouTube channel: https://m.youtube.com/channel/UCSEeXKAn9f_bDiTjT6l87Lg See the related example notebooks on Patreon https://www.patreon.com/pechnikov and on LinkedIn in PDF.

AlexeyPechnikov avatar Aug 31 '23 07:08 AlexeyPechnikov

@SteffanDavies GMTSAR subswath merging is not single-pixel accurate, and it introduces inconsistencies in PSI processing. Although we may not detect the shift in output products, the azimuthal accuracy of ±15m makes it impossible to perform single-pixel time-tracing. For the common multi-looking output of 60m or 90m, this is not an issue.

intfEROK

AlexeyPechnikov avatar Sep 20 '23 08:09 AlexeyPechnikov

@SteffanDavies GMTSAR subswath merging is not single-pixel accurate, and it introduces inconsistencies in PSI processing. Although we may not detect the shift in output products, the azimuthal accuracy of ±15m makes it impossible to perform single-pixel time-tracing. For the common multi-looking output of 60m or 90m, this is not an issue.

intfEROK

The offset seems semi-consistent, wouldn't it be possible to do some kind of pixel shift in azimuth?

SteffanDavies avatar Sep 20 '23 08:09 SteffanDavies

GMTSAR calculates the offsets independently for every scene, and the accuracy is ±1 pixel for my test case. We cannot predict the shift, but it can be resolved using reference scene vertical shifts for all the scenes. For more details, please refer to my LinkedIn post: https://www.linkedin.com/feed/update/urn:li:activity:7110177621832843264/

AlexeyPechnikov avatar Sep 20 '23 08:09 AlexeyPechnikov

@SteffanDavies You can check the recent commit 030325a1983fad9394d564a88da78e0f78918edc in PyGMTSAR2 for performance evaluation on your hardware using the attached notebook: phasediff.ipynb.zip Please share your processed notebook in PDF (printable) format for reviewing the progress bars.

It should be significantly faster when using a processing chunk size of 2048 and with NetCDF compression disabled. The old configuration was tuned for a chunk size of 512 or 1024, and NetCDF compression was always enabled. Potentially, using Dask chunks that are four times larger allows Dask to work effectively on hosts with 4x4 times more cores compared to my 8-core development host, making it effective on 128+ core hosts.

P.S. The DEM is intentionally incomplete (check the upper left corner on the plot below) to verify that PyGMTSAR2 has no issues in this case, unlike GMTSAR where a single NODATA pixel on DEM crashes the processing completely.

image

AlexeyPechnikov avatar Oct 03 '23 16:10 AlexeyPechnikov

@SteffanDavies You can check the recent commit 030325a in PyGMTSAR2 for performance evaluation on your hardware using the attached notebook: phasediff.ipynb.zip Please share your processed notebook in PDF (printable) format for reviewing the progress bars.

It should be significantly faster when using a processing chunk size of 2048 and with NetCDF compression disabled. The old configuration was tuned for a chunk size of 512 or 1024, and NetCDF compression was always enabled. Potentially, using Dask chunks that are four times larger allows Dask to work effectively on hosts with 4x4 times more cores compared to my 8-core development host, making it effective on 128+ core hosts.

P.S. The DEM is intentionally incomplete (check the upper left corner on the plot below) to verify that PyGMTSAR2 has no issues in this case, unlike GMTSAR where a single NODATA pixel on DEM crashes the processing completely.

image

Is there a specific list of scenes you would like me to test on?

SteffanDavies avatar Oct 04 '23 12:10 SteffanDavies

You can choose from any scenes.

AlexeyPechnikov avatar Oct 05 '23 04:10 AlexeyPechnikov

@SteffanDavies Maybe do you have some results? I’ve shared my timings for GMTSAR example: https://www.linkedin.com/feed/update/urn:li:activity:7117094805393858560/

AlexeyPechnikov avatar Oct 09 '23 10:10 AlexeyPechnikov

New PyGMTSAR provides processing that is 10 times faster than GMTSAR on the same case, S1A_Stack_CPGF_T173. This notebook is already available on Google Colab: https://www.linkedin.com/feed/update/urn:li:activity:7117369530749730816/

pygmtsar2

AlexeyPechnikov avatar Oct 10 '23 05:10 AlexeyPechnikov

I was having some issues setting up but I noticed you no longer import SBAS from pygmtsar

SteffanDavies avatar Oct 10 '23 14:10 SteffanDavies

Help command for S1.scan_slc() function listing "basedir" as argument despite being unrecognized.

image

SteffanDavies avatar Oct 10 '23 14:10 SteffanDavies