I am trying to install StaMPS on Linux , however I have yet to see any foolproof steps to after exporting SNAP data for StaMPS. I have the matlab files installed already.
Despite my efforts in going through the forum through the StaMPS manual and user Katherine’s recommended steps and files, I am still stuck as there are no specific guidelines. I am not sure if it is also because I have messed up the directories for the files installed and to add on.
The installation and the export are looking fine to me, though I recommend to separate the export directories diff0, dem, geo and rslc from your stamps installation directory and store them in a directory named INSAR_master_date as the stamps handbook suggests.
Anyway the errors after you have tried to call the mt_prep_gamma_snap or the mt_prep_gamma scripts seem to occur, because of two reasons.
First: The execution flag is not set for the mt_prep_gamma_snap script, hence you copy pasted it after the stamps installation into the bin folder, right? In order to set the flag open your terminal and try:
set executing flag for this inserted bash script
chmod u+x /home/fyp/Documents/StaMPS_v3.3b1/bin/mt_prep_gamma_snap
yyyymmdd must be the date of the master
the / in the end of the path information is crucial!
mt_prep_gamma_snap yyyymmdd /home/fyp/Documents/INSAR_master_date/ 0.4
But I think that would not do the job as you were not able to run the original script mt_prep_gamma, because you are missing the right interpreter for the bash scripts. Install csh:
This part of the processing is becoming a little less related to SNAP.
However, I have taken your advice and managed to move on a few more steps. Now I am encountering one major problem with directories in StaMPS software because I tried to change WORKDIR in mt_prep_gamma_snap file. I have since downloaded gawk in my Linux computer but realising the rest has to do with directories with the bin file, I am stuck many times after trying.
The mt_prep… scripts you are talking about, are they located in the bin folder of your StaMPS installation? I can see them in the main folder of the installation on your screenshot? Are these copies?
I would not recommend changing the WORKDIR in mt_prep_gamma_snap but to be very precise in editing the StaMPS_CONFIG.bash. WORKDIR is set by $cwd and should not be overwritten, to pass the …/StaMPS_v3.3b1/bin path to it does not make sense to me, because the script is looking for a file system containing data, which is INSAR_20170405 in your case and not a folder containing itself which is …/bin.
But it is true that setting WORKDIR with $cwd (which looks like a change) instead of $pwd (which would just print the path) is somehow confusing…but in this case both do the same. WORKDIR is set to the path where your 4 exported folders should be. To do so you open the terminal in INSAR_20170405 and call mt_prep_gamma_snap with its parameters and it will work, because of the configuration before, the bin folder, containing the script is on your PATH variable and therefore mt_prep_gamma_snap will be found even if you are not in the bin folder…that is the trick ;). You should not call the script in a terminal, which was opened in the …/bin folder, because it does not know what to do next… I think that is what you are trying to do.
Maybe you will find some useful information here, I uploaded a summary which includes a detailed description of the step you are doing right now.
check your StaMPS_CONFIG.bash
delete your edited mt_prep_gamma_snap
download the unchanged version again, copy paste it to the bin folder by following the steps in the mentioned description.
Really appreciate your website! It was very useful! I have done all that I can to follow your “Walkthrough” provided.
However, it seems like the new files that fel/fei has provided is not working.I have put the mt_prep_gamma_snap file in the bin folder and the ps_intial… file in the StaMPS>matlab folder. My terminal has the following results after replacing the changed files and renaming them.
your CONFIG which changed the PATH variable looks good. But you have to call your terminal from the folder which contains your StaMPS export from SNAP. You can open a terminal there or you have to go there and than, call mt_prep_gamma_snap. It seems to me you try to call mt_prep_gamma_snap from your /home/user/…
Please open a terminal (if you follow the steps below, it does not matter where you open it), execute the following steps precisely, line by line and post a screenshot of your results:
whereis matlab snaphu triangle csh
mt_prep_gamma_snap 20170405 /home/fyp/Documents/INSAR_201170405/ 0.4
If your installations of StaMPS, Matlab and csh are ok and the mt_prep_gamma_snap script was pasted to …/bin and flag (chmod) was set correctly, this has to work on your machine.
What I have noticed: You do not need to chmod (set flag for mt_prep_gamma_snap) each time you want to use it. After you have copy-pasted it to …/bin you have to set the flag once and that is it.
Concerning matlab, you need it…in line 131 of mt_prep_gamma_snap Matlab will be called.
Ok, I think that will help you to figure out how to run the script.
Oh now there is something that comes to my mind. Please try all steps without changing the matlab script ps_load_initial_gamma.m use the “old” one! Good Luck
Hi hchong005, I did not notice the ^M: message you have already got one post before, sorry. I think your workflow to prepare and call the mt_prep_gamma_snap script is just fine…but:
^M occurs whenever you have some “bad” line endings in your script, mostly an extra space or something…well, that is really nasty to recognize on screenshots ;). I recommend to double-check the scripts you edited (mt_prep_gamma_snap and so on) and delete all needless spaces in each line in the end. When I encountered this problem the first time, I found this thread helpful
The fact, that you got the ^M message and the Andy Hooper, December 2012 is a hint, that the mt_prep_gamma_snap script was called successfully, but in the script exists a line you might have changed and somehow got a bad ending, maybe added a comment etc. I remember you said you have tried to change WORKDIR in mt_prep_gamma_snap, my best guess is, you have not restored the script exactly…In your place, I would delete the script mt_prep_gamma_snap, download the changed one by FeiLiu, rename it and paste it to the …/bin folder once again. Do not forget the execution flag!
After that try again to run this script.
Good Luck, and I hope, I am right with my assumption
Hi @hchong005, good to see that you arrived Matlab!
I think you just missed one thing. After you have ran mt_prep_gamma_snap do not close the terminal, and if, open a terminal source the CONFIG.bash and go to your directory INSAR_20170405. In both cases you can now type in matlab to launch Matlab from the folder containing your data, which you have prepared with mt_prep_gamma_snap (that is absolutely necessary). When doing so, the Matlab window will appear, and now you can run stamp(1,1).
On my screenshot you will notice that Matlab is processing in folder …/INSAR_master_date/Patch1 containing information to read my data into matlab and which was found by matlab in /home/user/…INSAR_master_date, the location you launched Matlab from!
Reading your screenshot, I came to the assumption that you launched Matlab in another way…Am I right about that? If not please tell me, so that we figure out what is going on.
Basically, when I installed matlab, I did not make the symbolic links to open matlab from anywhere, so I keyed in:
sudo ln -s /usr/local/2017b/bin/matlab
and did as you said to source the config.bash file,
then: cd /home/fyp/Documents/INSAR20170405/
and the matlab ran upon stamps(1,1), and it has completed it will say PS_LOAD_INTIAL: Finished.
I have entered stamps(1,8), I shall see how long it takes to complete till step 8 and if there are any hiccups.
because I am using a test data set, and this test data set does not necessarily comply with the same exact steps as the “stack averaging” method posted in the forums, I am going to swap out to my real data set which is more memory demanding soon ( so that I can see if it really works).
Once my real data set is done, (hopefully by 19 Feb or 20Feb) I will update you on the progress.
Thanks for the great help!
latest update: receiving error past step 6, problems with plotting etc. Have been changing parameters but not successful.
Is the error about a BREAK command in the ps_plot.m script? If this is the case, search the script in StamPS…/matlab folder open it in scite/kate or some text editor, search for break and comment the line with the command. Save and try plotting again, I had to do this in my case for some plot scripts in matlab.
check for the following:
did you install ‘gawk’?
did you install ‘bash/cash’ reader?
delete the existing patch 1 file if you still have it, and replace the mt_prep_gamma_snap and ps_load_initial file directly from user thho’s website.
i think ur config.bash or config.csh directory was not written correctly.
Then run everything again based on the above. note you will have to open another terminal to run matlab.