How to prepare Sentinel-1 images stack for PSI/SBAS in SNAP

I advice you to read the previous posts.
In cygwin you should source your StaMPS_CONFIG.bash to the correct directories for your set-up .
This must be done whenever a new terminal is opened.
Then run mt_prep_gamma from the INSAR_masterdata directory.

for example:
source /cygdrive/c/…/StaMPS_v3.3b1/StaMPS_CONFIG.bash
cd /cygdrive/…/INSAR_MasterData
mt_prep_gamma MasterData /cygdrive/…/INSAR_MasterData 0.4

It should be work.

1 Like

If you are going to continue in windows and not using Linux, you should follow @alvegavaleri to avoid problems when Matlab tries to access folders :

Or you should manually change all the paths in all (.txt) (.in) (*.out) generated files from ‘/cygdrive/c/’ to ‘C:’ before you call Matlab.

@FeiLiu could u pls take a look at my issue, do u have any idea to resolve this?

Hi all,
Few months ago, I have found a way to create ifgs between two slave images and create a topic to invite someone interested to help me test:
Now we have made some progress, so I wiss more people to join us, anyone interested and want to join can post in that topic.

@Will Actually I don’t understand what’s your problem, can you describle it more specifically?

Hi @FeiLiu,

I have processed Sentinel-1A by following the steps provided by this thread (SNAP 6) and import result to StaMPS. After stamps(1,8), the results for any type of plot look like this figure. I have tried to figure out the reason but no luck. Could u kindly take a look and appricate any suggestion.

hello guys i prepared the stack as recommended over here but when i am running the test it is getting stuck in the 1st part as you can see in the pictures plz advice if you observe any problems

hi all, I use the latest version of the snap 6.0 ,i followed latest step provided by @FeiLiu . everything goes well,but when to stamps step 6 , i meet an error.finally , i find There are many empty values in my ps points,As shown in the attachment.Does anyone know how to solve it?THANK YOU!

Hi @thho

I have my .ij files empty, I when checked my processing I see several images with mean=0

Hi @gabrielaquintana77, you have got a message but in short, I think during preprocessing (I suspect the Apply Orbit File OP but I was not able to reproduce the error and therefore I can not prove it) went something wrong which leads to 0 mean amplitude, which means that all pixels in the scene do have 0 as amplitude value, which is not possible at all (its about amplitude and not phase, because in this step StaMPS uses an amplitude dispersion index to preselect PS candidates. The Index is D_A=sigma_A/mu_A where D_A is the amplitude dispersion index, sigma_A the standard deviation and mu_A the mean of series of amplitude values see here equation (9) for more details .)

You have to start at the beginning, loading scenes as zip (check them too maybe this data is corrupt?), split, apply orbit file … StaMPS export I really recommend my summary, the steps seems to be stable until now and helped me to prepare several data sets.

Good luck

1 Like

Hi Will,
The problem you met is very strange, it seems that you have not selected enough PSs points, please check the processing steps in SNAP.

Hi mengruizu,
This problem is caused by the NaN value in export lat/lon file, in SNAP6.0, the oethorectified lat/lon file are generated by a specific method, and will create some NaN value as the screenshots show below:

Zoom in:

@mengdahl This problem is seems caused by merging all tiles together whereas these tiles are not perfect rectangles.

The problem you met can be sloved by two ways, the first is waiting for this bug to be fixed, the second is modifying the ps_load_initial_gamma.m file to remove the PSs candidates which lat/lon value are NaN.
I have met this problem when my first time use SNAP6.0 oethorectified lat/lon option, but it is strange that this problem only occurs sometimes, I am not sure whether it is a bug, so I didn’t point out at that time.
I have modified ps_load_initial_gamma.m at the second time so that this new problem can be solved, and also modified the way of calculating PSs points x,y coordinate, it makes the x,y coordinate calculated by lat/lon file instead of simply assuming that the pixels’ space is default 5m*20m, so that some parameters from step1-4 can be used correctly in StaMPS processing (step 5 re-calculate the x,y coordinate).
ps_load_initial_gamma(v2.0).m (6.3 KB)

This new file should also be used even if you don’t have the NaN problem, since it update the x,y coordinate calculation. But use it cautious, if you meet any problem, please don’t hesitate to contact me.

Hope this helps,


Dear fei, thank you very much. According to your guidance,I got the final result.

1 Like

how to resolve this?

Dear Abraun Sir
Thank you very much for your kind suggestion.
Now i have linux ubuntu operating system, which is new for me. I follow the comments and suggestion in this forum and try to run StaMPS.
I dont know where it do mistake, but i get this message and it is running from last 5 hours.

I am new in linux too, so may be some stupid mistake. I hope will suggest me a new way. I become quite late to response this time.

Thank you very much.


matlab needs to be available on the computer as well to run the scripts.

Dear Abraun Sir
I install the matlab in Ubuntu also.
I will try to reinstall it again. And repeat the works.

Thank you very much for very very fast response.

Dhungana Prakash

Hi @thho thanks for your reply

Currently I am processing again the chain of steps…

dear @katherine @thho @bayzidul @FeiLiu @Fikretjfm i’ve never used linux before. when i try to command mt_prep_gamma_snap the result is like this

and this is the list of my file

hchong500’s comments are actually very good: Linux Installation using StaMPS and S-1 data

Get yourself some help if you are new to linux:

Sometimes, users’ systems can be slightly different, and it is good to know a bit on how to react instead of simply copy and paste code.

1 Like

you need to install gawk use this command
sudo apt-get install gawk