StaMPS processing error

I am trying to produce the PSI using the S-1 images, using snap2stamps to do the preprocessing. The preprocessing went fine, but when trying to use StaMPS, I encounter the following error:

Array indices must be positive integers or logical values.

Error in ps_est_gamma_quick (line 176)
while Nr(i)==0

Error in stamps (line 327)

When trying to figure out the error, I saw that the error occurs because the array produced by the following code are full of zeros:


Does anyone know why this is happening? Note that I am only using 2 images just to test the procedures and 3 patches produced by the snap2stamps scripts. I already saw a similar solution here, but I do not know how to check if SNAP is exporting NaN values or empty files in the stack.

are you using the latest version of StaMPS as provided here
and select “snap” as the processor with setparm?

1 Like

Yes, I am using version 4.1 and if I look at the getparm, ‘snap’ is selected as a preprocessor.

Please try to use more than 2 images. That means that you are doing your trial with 1 single interferogram? or 2? Well… my first suggestion is that you use more images for the trial.

Please let us know

Thanks for the suggestion. When using 4 images (1 master + 3 slaves) and a larger BBOX while running mt_prep_snap, this error did not occur anymore.

However, when running step 5 of StaMPS, I encountered the following error while trying to merge the patches. Does anyone have an idea why?

Merging patches…
GETPARM: merge_resample_size=0
GETPARM: merge_standard_dev=Inf
Processing PATCH_1
Processing PATCH_2
Index exceeds the number of array elements (0).

Error in llh2local (line 42)

Error in ps_merge_patches (line 486)

Error in stamps (line 474)

Did you solve your problem?


Not yet, I am currently blocked on some other project, but I will let you know if it works.

I have the same problem

how can we fix this ?

Any solution to this? I’m also getting this error.

You all guys are not reporting all the needed information to give any valuable advice.
I suggest to start checking what the interferograms produced, as well as slave amplitude files.
Later we can try to figure out about the mt_prep_snap… one step at a time.

1 Like

I had this problem too, turns out all my PS points where removed in the earlier steps, properly due to being to uncertain. Matlab wrote “No ps points left. updating the stamps log for this”. I tried changing parameters such as density_rand. This solved the problem.

Hi Mathias
I think you need to check your interferogram, I think you have a water zone or on some interferogram you don’t have any data and so you need to eliminate them

Hi MathiasBusk,

could you elaborate in detail that how to change the parameter of “density_rand” to what value. How this can solve the issue …!

as stated in the manual, this parameter defines how much random pixels are left per area

You can increase this value in case you are left with too few PS, for example to 50.

setparm('density_rand', 50)


I tried with “PERCENT method of value 20” and obtained the following result.

completed all stamps processing steps up to stamps(8,8).


How to interpret PSInSAR results at this stage ?

Is above results are fine to move forward or Do I need to process with “DENSITY method of value 50” ?

If I want reprocess with DENSITY method, Do I need to start a fresh execution from beginning or Can I change the parameter and execute from step 3.

What is range values of DENSITY method (like min - max : 0 - 100), How the value will vary according to the requirement ?

Is it mandate that data has to be processed for scenes of consecutive acquisitions (12 days temporal) or any combinations will work for PSInSAR / SBAS?

At this stage you can only check if the patterns make sense or not, they are not unwrapped and converted to LOS displacement yet.
However one master and four slaves is not sufficient for PS InSAR, because you need large time series to separate the persistent scatterers from random phase pixels. This is probably the reason why your processing failed in the beginning.
Technically you can move forward, but the principle of PS InSAR is not quite fulfilled here.

Once you change a parameter you can run from the last step which included this parameter, for example stamps(3,3).

The manual states that density is given in percent [0-100].

The time difference between the images can vary, especially because different image pairs automatically have different baselines. But the less images you use for PS InSAR, the shorter should be the investigated period to keep the maximum temporal baseline as short as possible.


I tried with “DENSITY method of value 50” and obtained the following output.

In this Density approach, result is negligible while with same data set using “PERCENT method with value of 20” is given result as shown earlier.

I couldn’t understand the logic between these two approaches.

some random points are observed in this density approach result. what are the next steps to analyse PS and export, geo-code …etc ?

well, density is an absolute measure while percent takes a relative share of random pixels. Depending on the total number of persistent scaterers identified in your image, this can make a large difference.

To me it looks like that there are nearly no PS in your study area. How much candidates were selected after step 2?

42 PS kept after dropping noisy pixels