Workflow between SNAP and StaMPS

Hi @muhannad, thank you for sharing your results!
I’m a student and I’m working for my master thesis on Sentinel-1 data using SNAP and StaMPS.
I’m trying to work in Windows with cygwin but I’m facing some problems.

I have some questions:

  1. What parameters did you choose in the function mt_prep_snap? In particular how many patches?
  2. Have you ever had some empty patches?

Currently, I’m having troubles with Matlab, so any advice will be very helpful.

Thank you,

Francesca

Can someone please help with this error in the first step of StAMPS. I am close to giving up hope.
I ran snap2stamps in linux. Copied the data over to my PC with Matlab and Cywin + Stamps.
Then I ran mt_prep_snap with defaults.
Then Stamps(1,1,1) gives me the following error that I can’t work around, I have a feeling mt_prep_snap isn’t working as it should and not creating all the files so readparm can’t read it:

stamps(1,1,1)

STAMPS: ########################################
STAMPS: ####### StaMPS/MTI Version 4.0b6 #######
STAMPS: ####### Beta version, Jun 2018 #######
STAMPS: ########################################

STAMPS: Will process current directory only

STAMPS: ########################################
STAMPS: ################ Step 1 ################
STAMPS: ########################################
STAMPS: Directory is D:\cygwin\home\ATheron1\INSAR_20170730\PATCH_1

PS_LOAD_INITIAL_GAMMA: Starting
PS_LOAD_INITIAL_GAMMA: Loading data into matlab…

master_master_flag =

'0'

Error using textscan
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in readparm (line 19)
parms=textscan(fid,’%s’);

Error in ps_load_initial_gamma (line 77)
heading=readparm(rslcpar,‘heading:’);

Error in stamps (line 264)
ps_load_initial_gamma;

I also experienced this error several times, but mostly under cygwin and never in Linux. I can’t promise that Windows is the reason but I observed a pattern here.

That actually helps, thank you. Because right now I am not sure if it’s a Data, Cygwin, Matlab, mt_prep_snap, stamps.m, ps_load_initial_gamma.m, readparm.m or ps_load_initial.m issue. It means I will direct my focus to set up our linux server properly with Matlab instead of struggling on my Windows PC with cygwin.

If you have the chance to test your data on Linux, it’s worth a try

Hi Francesca!

To work under Windows you should:
1- manually change all the paths in all ( .txt) ( .in) (*.out) generated files of “mt_prep_gamma” from ‘/cygdrive/directory/’ to ‘ directory:’
for example: from ‘/cygdrive/G/’ to ‘ G:’
2- In cygwin: type csh before call Matlab.

For the parameters, they are as @ alvegavaleri mentioned:
mt_prep_gamma [masterdate in format yyyymmdd] [data directory] [amp_threshold] [rg_patches] [az_patches] [az_overlap] [rg_overlap]

For me I used: 0.4 1 1 50 200

Good luck!

1 Like

when running mt_prep_snap I get error “Segmentation fault (core dumped)”…

mt_prep_snap Andy Hooper, August 2017

Amplitude Dispersion Threshold: 0.35
Processing 3 patch(es) in range and 3 in azimuth

opening /mnt/DiscoD/Sentinel1Process/3stampsExport-subset/rslc/20171011.rslc…
Segmentation fault (core dumped)
3946
2075
mt_extract_cands Andy Hooper, Jan 2007

Patch: PATCH_1
selpsc_patch /mnt/DiscoD/Sentinel1Process/3stampsExport-subset/selpsc.in patch.in pscands.1.ij pscands.1.da mean_amp.flt f 1
file name for zero amplitude PS: pscands.1.ij0
dispersion threshold = 0.35
width = 11840
number of amplitude files = 0
Segmentation fault (core dumped)

psclonlat /mnt/DiscoD/Sentinel1Process/3stampsExport-subset/psclonlat.in pscands.1.ij pscands.1.ll
opening pscands.1.ij…
Error opening file pscands.1.ij

pscdem /mnt/DiscoD/Sentinel1Process/3stampsExport-subset/pscdem.in pscands.1.ij pscands.1.hgt
opening pscands.1.ij…
pscdem: Error opening file pscands.1.ij

pscphase /mnt/DiscoD/Sentinel1Process/3stampsExport-subset/pscphase.in pscands.1.ij pscands.1.ph
opening pscands.1.ij…
Error opening file pscands.1.ij

according to the manual, reasonable values for the amplitude dispersion are between 0.4 and 0.42. I don’t know if this is the cause for your error and you probably know what you are doing there.

Hi,

Values of amplitude threshold mentioned by @ABraun are ok, but you can use a lower threshold when the time series is shorter in time.

The segmentation fault message could be due to many things, but here two of them that come to my mind:

  1. anything went wrong while running the make command at the moment of installing StaMPS on your system
  2. you had not enough RAM on your system (less probable)

I hope this helps

Hi @ABraun and @mdelgado, thank you…
I was able to solve the problem by reinstalling OS, going from opensuse Tumbleweed to Leap 15, and now I do not have core dumped in mt_prep_snap … just reinstalling StaMPS did not work.
I have another problem, SNAP download the srtm file “http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_V41/SRTM_Data_GeoTiff/srtm_23_17.zip” … but the page is not found …

is manually downloading an option? You can place the file in the directory under auxdata\dems\

Regarding the DEM download, in fact this is a page not found so it should be any developer taking the action to fix it.
Can any of you (@marpet or @lveci) please solve this? Maybe getting a local repository instead of third party’s dependencies??

Regarding the StaMPS installation… it is weird that did not work. Can you share with us how did happen? You only need to compile the src folder with make and later make install and add the paths to your environment.

Thanks!

It seems that the service was revised and the URL changed.
For example this one works:
http://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/srtm_21_06.zip
Regarding the tile srtm_23_7.zip, I think it is a water tile and therefore not present.
As referenz have a look here:


I’ve marked the 23_7 tile with a red dot.

I think the solution would be to update the URLs in the DEM Downloader and to consider that tiles might not be present because they contain only water. What do you think @lveci?

Regarding hosting the data, I don’t think this should be the duty of SNAP. We need to rely on external services and can’t host everything on our own. Otherwise we would end up being another DIAS. :slight_smile:

As a temporary workaround, it might work if you change the URL in the snap.auxdata.properties file. It is located in the etc folder of the SNAP installation directory.
DEM.srtm3GeoTiffDEM_HTTP = http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_V41/SRTM_Data_GeoTiff/
to
DEM.srtm3GeoTiffDEM_HTTP = http://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/

But still the problem persists that the tile srtm_23_7 does not exist.

2 Likes

hi @ABraun @mdelgado @marpet
ok… i can use a external dem in coregistration and interferogram process, but i can’t use it in StaMPSexport (SNAP), i don’t have the option …
/mnt/DiscoD/Sentinel1Process/graphsRun/3_StampsExport_20180220_20171011.xml

i change the snap.auxdata.properties file to: “DEM.srtm3GeoTiffDEM_HTTP = srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/” … but SNAP is trying to download the wrong page too.

INFO: org.esa.snap.core.dataop.dem.ElevationFile: http retrieving srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/srtm_22_17.zip

INFO: org.esa.snap.core.dataop.dem.ElevationFile: http retrieving http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_V41/SRTM_Data_GeoTiff/srtm_22_17.zip
WARNING: org.esa.snap.core.dataop.dem.ElevationFile: http error:http://srtm.csi.cgiar.org/srt-zip/srtm_v41/srtm_data_geotiff/srtm_22_17.zip on http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_V41/SRTM_Data_GeoTiff/srtm_22_17.zip

thanks !!

1 Like

So this means that both URLs are used. The old one and the new one you have specified.
Actualy either only the newly specified one should be used.
But in the end it worked for you? I don’t get it from your post.

no…it does’t work … because snap is trying to download the old site too … i erased and replaced the old line, maybe i need to change other file too…

Ah okay.
Maybe @lveci can help futher?

I don’t get it. The StaMPS export itself doesn’t download any SRTM data. Do you mean the topographic phase removal?

… yes, this is weird, because if I run it from a console with GPT, the xml graph asks for SRTM; however, if I run it from SNAP, the same graph works correctly … i don’t now !!!

1 Like