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


Does anyone know how to set a master to a new stack?

Using @Katherine’s method, it is mentioned that I will require 2 stacks if I have data for 24 interferograms. How do I set the same master for the first stack to be used in my second stack of data? Or is it not a functionality available in SNAP yet? I have not been able to change it in stack overview.



Hi @hchong005
The first image of the list is counted as the Master so simply put your selected Master image in the top and all Slaves after that will work perfectly in SNAP.


Sir, I met the same problem as you. How do you solve the problem : ‘Error using => Load’ ?


Hi @1951878748

Please, do you can show screenshot of your error?


Thanks for your reply. After using Mt_prep_snap step again, I’ve solved this problem.:smile:
I am working under Linux Ubuntu and I run the stamps in MATLAB 2015b version.
Now I meet a new problem: when I run the stamps(4,4) to patch 3, the matlab run a long time (about 1 day). I’m trying to change the number of patches, but it hasn’t changed and each time matlab was killed by Linux finally :weary:.My computer memory is 12G. Have you meet this problem?


Dear @1951878748,
have you made a spatial subset of your debursted stack and building ifgs from it afterwards, this could reduce computing time and needed RAM significantly? What dimensions in km or pixel does your study site have, maybe it is very large? I have not processed ifgs larger than two bursts maybe that could be a problem when using a machine with 12G RAM.
Can you provide your parameters of the step where Matlab is killed, the info printed directly under the step number when you have run the step, maybe we can find some hints there.


And I do have a general question to all maybe @FeiLiu, @ABraun or @mengdahl can help me.

To give an example for a SNAP-StaMPS tutorial I am currently working with the Maoxian landslide case study, my goal is to produce a similar result as Intrieri et al. 2017 even if they used SBAS(SqueeSAR) I think some PS with StaMPS will show similar trends etc. (but maybe we can upgrade to SBAS sooner or later to and expand the tutorial:) ). The PS distribution and general velocity of my attempt look promising (left the paper of Intrieri et al. right the PS distribution found with StaMPS, both using the same S1 data. The Points 1,2,3 in the paper are in an area where StamPS finds the highest velocity too):

However I do have some trouble with the timeseries plot; at the moment it looks something like that (the data of the paper for reference on the left. The chosen PS to produce the right TS is the dark red one in the picture above velocity < -30mm/yr):

I know that I have to play with some parameters to get a better unwrapping result and subtracting atmosphere etc. The reason the trend starts at a much higher positive value is because 1. it is relative to a master ifg in April 2016 and 2. I use an other stable ref coordinate as the paper does.

But now my question:
The ifgs produced in SNAP are very noisy, I do not think this is major problem, StamPS was built to handle this, right? But if I operate the workflow on very noisy data/ifgs and when building the stack with BackgeocodingOP using a resampling method other than NN I think you must get wrong results because the kernels aggregate noise to pass it to the coregistered matrix. I am not quite sure about that idea, maybe you can help me to discuss that.
And maybe you do have an idea what I can try to get a better trend/unwrapping result, I think the project is nearly finished, when this problem is solved :slight_smile:


Dear @thho, after I use matlab2016b , everything is all right :joy: .
So… please don’t use MATLAB2015, everyone. :wink:


Dear thho,
Thank you for your work to give an example for SNAP-StaMPS tutorial.

Just like you said, the noisy ifgs is not the major problem, however, when building the stack with BackgeocodingOP, the default resample method is BI(Bilinear_Interpolation), not NN(Nearest_Neighbour),and I do not meet any problem with the default method.
In theory, these two resample methods are not the best choise, according to the manual of doris_v4.02, Raised Cosin is best(theroy 0.9999), here are the screenshots of RESAMPLE step in Doris.
Doris manual:

Doris input file:

As for better trend/unwrapping result, in my experience, I think these parameters should be more careful in StaMPS processing:
density_rand in step 3
weed_standard_dev and weed_time_win in step 4
unwrap_grid_size and unwrap_time_win in step 6

And I am also very interested about your TS result, as I know, StaMPS can only get time linear deferomation, how did you get TS result like you plot? And did you use other data or software to subtract atmosphere?

Hope this helps,


Good time!

Thanck wery mach you and all for help with STAMPS. I constantly read the forum for advice.

Now I get error with script ps_load_initial_gamma(v2.0).m

Matrix index is out of range for deletion/
Error in ps_load_initial_gamma (line 191)

One stack I made without some errors, but this is crash.
Could you help me with this error?


Hi AndreyVahtanov,
Thank you for your report, however, I can’t see where the problem is just by your screenshots, can you show me more information about xy, bperp_mat or other matrix?


Excuse me, I am not familiar enough with Matlab. How can I print xy or bperp_mat?


Hi,sir. I meet a new problem, when I used overview, the result looked puzzling.:cold_sweat: please look at the place I marked.

Then I made Sep17 as the master image, the congestion result have same error

I use snap6.0 under unbutu. Does anyone have this problem? :confused:


Good time!
I tried to save xy, bperp_mat, index_NaN as binary files. But I am not sure it is wery usefull.

size of files
xy - 66 693 969
bperp_mat 133 387 938
index_NaN - 61 186

StaMPS-Visualizer, SNAP-StaMPS Workflow

Hello everyone.
dear all user,
after all processing complete, now im facing new problem. the problem happened with stamps and vistamps
in stamps :

Writing output files…
GETPARM: small_baseline_flag=‘n’
55886 ref PS selected
Error using load
Unable to read file ‘mean_v’: no such file or directory.

Error in ps_output (line 92)

PS_PARMS_DEFAULT: max_topo_err = 5
PS_PARMS_DEFAULT: quick_est_gamma_flag = y
PS_PARMS_DEFAULT: filter_grid_size = 50
PS_PARMS_DEFAULT: filter_weighting = P-square
PS_PARMS_DEFAULT: gamma_change_convergence = 0.005
PS_PARMS_DEFAULT: slc_osf = 1
PS_PARMS_DEFAULT: clap_win = 32
PS_PARMS_DEFAULT: clap_low_pass_wavelength = 800
PS_PARMS_DEFAULT: clap_alpha = 1
PS_PARMS_DEFAULT: clap_beta = 0.3
PS_PARMS_DEFAULT: density_rand = 20
PS_PARMS_DEFAULT: percent_rand = 20
PS_PARMS_DEFAULT: gamma_stdev_reject = 0
PS_PARMS_DEFAULT: weed_time_win = 730
PS_PARMS_DEFAULT: weed_max_noise = Inf
PS_PARMS_DEFAULT: weed_standard_dev = 1
PS_PARMS_DEFAULT: weed_zero_elevation = n
PS_PARMS_DEFAULT: weed_neighbours = y
PS_PARMS_DEFAULT: unwrap_method = 3D
PS_PARMS_DEFAULT: unwrap_patch_phase = n
PS_PARMS_DEFAULT: drop_ifg_index = []
PS_PARMS_DEFAULT: unwrap_la_error_flag = y
PS_PARMS_DEFAULT: unwrap_spatial_cost_func_flag = n
PS_PARMS_DEFAULT: unwrap_prefilter_flag = y
PS_PARMS_DEFAULT: unwrap_grid_size = 200
PS_PARMS_DEFAULT: unwrap_gold_n_win = 32
PS_PARMS_DEFAULT: unwrap_alpha = 8
PS_PARMS_DEFAULT: unwrap_time_win = 730
PS_PARMS_DEFAULT: unwrap_gold_alpha = 0.8
PS_PARMS_DEFAULT: scla_drop_index = []
PS_PARMS_DEFAULT: scn_wavelength = 100
PS_PARMS_DEFAULT: scn_time_win = 365
PS_PARMS_DEFAULT: scn_deramp_ifg = []
PS_PARMS_DEFAULT: ref_lon = -Inf Inf
PS_PARMS_DEFAULT: ref_lat = -Inf Inf
PS_PARMS_DEFAULT: ref_centre_lonlat = 0 0
PS_PARMS_DEFAULT: ref_radius = Inf
PS_PARMS_DEFAULT: plot_dem_posting = 90
PS_PARMS_DEFAULT: plot_scatterer_size = 120
PS_PARMS_DEFAULT: plot_pixels_scatterer = 3
PS_PARMS_DEFAULT: plot_color_scheme = inflation
PS_PARMS_DEFAULT: shade_rel_angle = 90 45
PS_PARMS_DEFAULT: lonlat_offset = 0 0
PS_PARMS_DEFAULT: merge_resample_size = 0
PS_PARMS_DEFAULT: merge_standard_dev = Inf
PS_PARMS_DEFAULT: scla_method = L2
PS_PARMS_DEFAULT: scla_deramp = n
PS_PARMS_DEFAULT: insar_processor = doris
PS_PARMS_DEFAULT: subtr_tropo = n
PS_PARMS_DEFAULT: tropo_method = a_l
115278 ref PS selected
Error using sum
Trailing string input must be ‘double’,‘native’, or ‘default’.

Error in mean (line 82)
y = sum(x,dim,flag)/size(x,dim);

Error in ps_plot (line 1078)

Please help me to solved this problem.
Im using ubuntu 16.04 and matlab 2014b ubuntu.


Hi @thho

How did you manage to plot colored dots on a map? In other words, what is the command you used in StaMPS to get these dots to show up? Mine are just square pixels with displacement values.


StaMPS-Visualizer, SNAP-StaMPS Workflow

Hi @hchong005,

in order to visualize the data in a manner where you can see and click single PS and have the deformation time series plotted, I exported data from matlab with this commands

load parms.mat;
ps_plot('v-dos', -1)
load ps_plot_v-dos.mat
lon2_str = cellstr(num2str(lon2));
lat2_str = cellstr(num2str(lat2));
lonlat2_str = strcat(lon2_str, lat2_str);

lonlat_str = strcat(cellstr(num2str(lonlat(:,1))), cellstr(num2str(lonlat(:,2))));
ind = ismember(lonlat_str, lonlat2_str);

disp = ph_disp(ind);
export_res = [lon2 lat2 disp ts];
metarow = [ref_centre_lonlat NaN transpose(day)-1];
k = 0;
export_res = [export_res(1:k,:); metarow; export_res(k+1:end,:)];
export_res = table(export_res);

The exported .csv was than imported to a R Shiny application I am currently developing, that is what you see on my screenshots. The application allows you to click single dots to look up the ts for the dot and compare up to 5 ts in one graph…the status of this app is somewhat beta and I am changing and adding features all the way, give me a few days and I can share a beta version. To prepare yourself, you need R, Rstudio, and the packages shiny, colorRamps, lubridate and leaflet

some impressions


Hi @FeiLiu,

I changed some parameters mainly in step 6 in stamps and the PS data looks now like that (my “best” result) even that the trend becomes more clear and the selected points look good, in the end, the last point is unwrapped wrong or disturbed.
Until now I do not use any other software to subtract atmosphere, I know about TRAIN but I have not implemented it yet…maybe this would help. As you know I am trying hard on SBAS approach for this case study and hope I get a more satisfying result for the last and most interesting points in the TS plot. I think this could work because in PS the btemp is the largest for the last point, which is clear and a problem of the approach and in SBAS this problem may be solved…so lets see what happens next week :wink:


Hi @hchong005 ,

in this thread you will find the beta version of the application I use to visualize my data


My name is Daniel
So I’ve been working based on workflow described by amazing people such as @katherine , @thho, @FeiLi
And I get this result using ps_plot(‘w’) command

so using 7 SLC data to create 6 interferograms
my question is since I’m very new at this and still struggling and learning on inSAR maybe you can take a look at my result and give some interpretation.
And I have question for @thho in order to export the point to CSV using script in your post How to prepare Sentinel-1 images stack for PSI/SBAS in SNAP 5
is it run on Matlab command window or write an m file and then run it on matlab?
or is there a default command in StamPS to export PS to CSV?