0% found this document useful (0 votes)
1K views

PSI Using SNAP - STAMPS Tutorial 1 - Installation and Preperation

1. This document provides instructions for installing and configuring the PSI analysis software StaMPS and using it with SNAP in the Windows Subsystem for Linux (WSL) environment. 2. Key steps include installing WSL, the Linux desktop environment, MATLAB, additional software dependencies for StaMPS like gawk and tcsh, and StaMPS itself by compiling the source code. 3. The StaMPS configuration file must be edited in the Linux environment to correctly set paths before use. Troubleshooting tips for possible errors are also provided.

Uploaded by

Angel M Vásquez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

PSI Using SNAP - STAMPS Tutorial 1 - Installation and Preperation

1. This document provides instructions for installing and configuring the PSI analysis software StaMPS and using it with SNAP in the Windows Subsystem for Linux (WSL) environment. 2. Key steps include installing WSL, the Linux desktop environment, MATLAB, additional software dependencies for StaMPS like gawk and tcsh, and StaMPS itself by compiling the source code. 3. The StaMPS configuration file must be edited in the Linux environment to correctly set paths before use. Troubleshooting tips for possible errors are also provided.

Uploaded by

Angel M Vásquez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

This instruction is for PSI analysis using stamps and SNAP in Windows Subsystem for Linux (WSL).

The Windows Subsystem for Linux (WSL) is a great feature introduced in Windows 10.
Is a compatibility layer for running Linux binary executables natively on Windows 10, and allows the
use of a rather real Linux installation, without using a virtual machine (Andrea Fortuna web site)

I tried my best to keep everything short and easy to grasp. However, it is not guaranteed to be
empty of any error. Before starting, I strongly recommend that the user take a look at the following
links and provided documentation. I wrote this tutorial based on my own experiences and with the
help of the documents and information which are provided by the SNAP forum, especially by the
super users like Thorsten Hoeser, Andreas Braun, Ekaterina Smolianinova, Jose Manuel, Marco
Peters, Falah Fakhri, and others.
Tuturial videos for this document (VIDEO 1, VIDEO 2)
To begin, I added some links that I have found more helpful so far. Although I tried to cover the main
steps for the user, this tutorial is still not that much in detail as I wanted it a brief instruction. For
more details, the following links along with SNAP Forum, should be studied by the user.

A-Step by step instruction of snap-stamps workflow by Thorsten Hoeser ( some details has to be
updated for the latest version of snap and StaMPS)

Forum link>> https://forum.step.esa.int/t/how-to-prepare-sentinel-1-images-stack-for-psi-sbas-in-


snap/4981/512

B-STaMPS manual >>


https://homepages.see.leeds.ac.uk/~earahoo/stamps/StaMPS_Manual_v4.1b1.pdf

C- StaMPS-Visualizer, SNAP-StaMPS Workflow


https://forum.step.esa.int/t/stamps-visualizer-snap-stamps-workflow/9613

D-Latest code for STaMPS-Visualizer


https://github.com/thho/StaMPS_Visualizer

*** Very helpful documents and links recommended by Andreas Braun in SNAP forum:
https://forum.step.esa.int/t/stamps-detailled-instructions/8140
1- Installing WSL from Microsoft store

2- Installing the desktop (GUI) in WSL

It put us much more on ease for the following steps.

After typing the Ubuntu in the windows search bar and finding and running it, we are going to see the
ubuntu terminal

A useful link in this regard: https: //docs.microsoft.com/en-us/windows/wsl/install-win10

Then we should use the following commands in opened ubuntu terminal

sudo apt update


sudo apt upgrade
then by the following command, we can install the light ubuntu desktop
sudo apt install lxde
In the next step, the VcXsrv Windows X Server utility should be installed in
windows.

Link https://sourceforge.net/projects/vcxsrv/files/latest/download
After installation, we should open VCxsrv software and set the
Initial setting in the software as the picture

Then we should run the following commands in ubuntu terminal

export DISPLAY=:0
export LIBGL_ALWAYS_INDIRECT=1
startlxde ( main command to run the desktop)

then we see the lxde desktop, each time that we want to use it we should
rerun the last three commands

The more detailed instruction can be found in the following link

https://www.makeuseof.com/tag/linux-desktop-windows-subsystem/
3- Matlab installation in WSL
The MATLAB 2018a version is suggested for the latest WSL(2019-2020), for the
older version you have to update some ubuntu packages
** it is important that the user name that you chose when you install the
Ubuntu and the username that you want to use the MATLAB should be the same.
Otherwise, you would face the user name problem
The Matlab 2018a version should be downloaded for Linux and be installed like
other software in the Linux platform.

The following link might be helpful

https://www.mathworks.com/matlabcentral/answers/308911-can-i-install-matlab-in-bash-on-ubuntu-
on-windows
you might face other problems depending on which Pc you are working with. In
that case, just google the errors. You would find plenty of helpful stuff on
the internet. In my case, with the visual desktop, I have not experienced any
errors other than user name mismatching.
In case you couldn’t figure it out how to install it, it is also possible to
just move the prepared package by STaMPS to windows and also copy and paste
all the files in stamps>MATLAB folder to the same folder and continue the
rest of the steps in windows.
4-Then the following software should also be installed in MATLAB
I recommend to install them using ubuntu repository by sudo apt-get install…
command in the ubuntu terminal
First, it is recommended to use >>> sudo apt-get update
Then,
4-1 gawk >>>>>>>>>>>>> sudo apt-get install gawk
4-2-tcsh >>>>>>>>>>>>>sudo apt-get install tcsh
4-3-matlab-support>>> sudo apt-get install
4-4-Make>>> sudo apt-get make
4-5-build essential >> sudo apt-get install build-essential
4-6-tringle>> sudo apt-get install triangle-bin
4-7-snaphu>> I personally recommend the latest version 2.0.3

You can also install snaphu trough the ubuntu repository. But in that case,
you install the older version.
For the 2.03 or newer version you can check the following video that I
uploaded on YouTube before
https://www.youtube.com/watch?v=FVv2SF8jK3Q&t=455s

5-installation of StaMPS
I strongly recommend the latest version 4.1.B
However, you need to do some of the following steps in different ways. You
have to change some files with adjusted versions, and you should use another
command for preparing the data depending on the version of the edited files
that you are going to use.
More information >>
https://forum.step.esa.int/uploads/default/original/2X/9/94a7012eb9807cb8ec03
fd68a31807de007acf6f.zip

For stamps installation

5-1, we should first extract the package in Ubuntu


5-2 we go to src folder
Then
sudo make
sudo make install

5-3 then we should return back to STaMPS main folder and edit the
StaMPS_CONFIG.bash file

It is really important that this file should be edited in Ubuntu. If you do


this using windows editor or WordPad, it would not work for you.
So in Ubuntu we can use the Nano editor ( I personally recocomend) or any
other on like vimeditor(lxdesktop original one) and we should adjust the
file then save it after.

The only part that should be edited is the first paragraph. I put my file as
a sample
export STAMPS="/softwares/stamps" Where we installed STaMPS
#export SAR="/home/ahooper/software/ROI_PAC_3_0"
#export GETORB_BIN="/home/ahooper/software/getorb/bin"
#export SAR_ODR_DIR="/home/ahooper/software/SAR_FILES/ODR"
If you installed any of these softwares
#export SAR_PRC_DIR "/home/ahooper/software/SAR_FILES/PRC"
#export VOR_DIR="/home/ahooper/software/SAR_FILES/VOR" you should do the same as above here
#export INS_DIR="/home/ahooper/software/SAR_FILES/INS"
# make As it installed with repository, there is no
#export DORIS_BIN="/home/ahooper/software/doris_v4.02/bin"
inactive the #export TRIANGLE_BIN="/home/ahooper/software/triangle/bin" need to export the path
command export SNAP2STAMPS="/softwares/snap2stamps"
export SNAPHU_BIN="/softwares/snaphu/bin" You don’t need it, you should put #
before it
#export ROI_PAC="$SAR/ROI_PAC"
#####################################
# ROI_PAC VERSION 3 In case you installed the SNAPHU
#####################################
#export INT_BIN="$ROI_PAC/INT_BIN"
without repository, you need to export
#export INT_SCR="$ROI_PAC/INT_SCR" the path of the installation folder like this
#####################################

After finishing the edit. Each time we should source this bash file before
using StaMPS. By sourcing this file, the edited paths would be added to main
ubuntu bash root.
After editing we should source the file:
6-Possible errors and useful commands in Ubuntu

6-1-If you face this error that Ubuntu has not the permission to access a
folder
You can use the following command to fix it:
sudo chmod -R a+rwx /………… path of that folder

6-2 if you install the STaMPs and edit and source the bashe file but still
the mt_prep_snap doesnot work, you can check the same command when you are in
the stamps bin folder path. In that case, the path to stamps bin folder
should be added to the main .bashrc file in WSL root folder in order to make
it available from every path.

Wsl root folder:


I put my own WSL path as a sample here
C:\Users\tech\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79
rhkp1fndgsc\LocalState\rootfs\root
Yours should also be in a similar place
6-3 so similar to what we have done before for stamps bash file, here, we
also have to edit the .bashrc file with nano or vim editor

Then the following command should be added to end of the file


export PATH=$PATH:~/softwares/stamps/bin
Then we save the file, since then you might not face this error again and
STaMPS command can be run from everywhere in Ubuntu
6-4 If you want to work with an older version of STaMPs, you have to add an
adjusted file such as mt_prep_gamma_snap to StaMPS bin folder. In that case,
you have to give permission to bash to have access to that file. Otherwise,
you get a bash error.
To overcome this problem, you should use the following command

>>>> chmod u+x /softwares/stamps/bin/mt_prep_gamma_snap

Complete path to that file

Useful commands in Ubuntu:


Mounting the Windows drive>> cd /mnt (in WSL with desktop, you already have
the mounted windows drive in you explorer)
Cd <folder name> to open a folder
Cd ../ to return back to folder path that contains the subfolder

Dir show all files and folder in the current path


<Command> ./ to use the command in current folder
echo $SHELL to find your active shell (tcsh or bash)
chsh -s /usr/bin/tcsh to switch to tcsh shell

chsh -s /bin/bash to swith to bash shell


other basic commands >>>

https://techlog360.com/basic-ubuntu-commands-terminal-shortcuts-linux-beginner/

7-STaMPS visualization with R & R-studio (Working with the R-based STaMPs
visualization code can be done entirely in windows)
7-1 we should first install the R package for windows
7-2 we should install the r studio (free version )
7-3 Downloading the visualization package written by Thorsten Höser
7-4 Extracting a package somewhere in windows (This package can be further
used by adding an exported file result from StaMPS-Matlab to the extracted
folder- tutorial 2)

You might also like