Alaska Satellite Facility - Distributed Active Archive Center

How to Create and Unwrap an Interferogram with GMT5SAR Script

A sample color phase product for the F1 swath, Copernicus Sentinel data 2015. Contains modified Copernicus Sentinel data 2016, processed by ESA. 

Source: ASF Staff

More Advanced (GMT5SAR Installation and configuration)
Intermediate (Set config and run script)

Background

In order to perform differential interferometry on Sentinel-1 data using the GMT5SAR software package, ASF provides the python script procS1GMTSAR.py. This script takes two Sentinel-1 IW SLC files and creates a differential interferogram of the data in both GeoTIFF and KMZ format. The user may specify an input DEM file (which must be in GMT GRD format) or a DEM file will automatically be downloaded for the user via the opentopo service. The script creates an interferogram for the main polarization, VV, only.

The Sentinel-1 granules must be in the directory where the script is run, i.e. the .zip files must be in the directory where you run the script. In addition, the ASF provided GMT5SAR configuration file, config.s1a.txt, must be in the same location as your executable file procS1GMT5SAR.py.

ASF’s python script and configuration file are available through the Data Recipe zip button at the top of the page.

Prerequisites

Materials List:

  • Ubuntu Server 16.04
  • At least 200 GB of free space
  • Python 2.7 (2.7.12-1ubuntu0~16.04.1)
  • Python-requests (2.9.1-3)
  • GDAL (gdal-bin (2.1.3+dfsg-1~xenial2)
  • GMT (5.2.1+dfsg-4ubuntu2~xenial2)
  • GMT5SAR v.3
  • ASF config file: config.s1a.txt
  • ASF script: procS1GMT5SAR.py
  • Orbit directories (state vectors)
  • Sample Granules (Two Sentinel-1 SLCs, IW, VV only)
    • S1A_IW_SLC__1SSV_20150526T014935_20150526T015002_006086_007E23_679A.zip
    • S1A_IW_SLC__1SDV_20150607T014936_20150607T015003_006261_00832E_3626.zip

Steps

Preparing the GMT5SAR system

Starting with a clean installation of Ubuntu Server 16.04 that has at least 200 GB of free space for data files and the finished product.

Install Software

    1. Install python, lxml, and requests:

sudo apt-get update
sudo apt-get install python2.7
sudo apt-get install python-lxml
sudo apt-get install python-requests

    1. Install GDAL:

sudo add-apt-repository -y ppa:ubuntugis/ppa

Note: If this first command does not work, you may be using a new version of Ubuntu and the stable GDAL version may not be compatible. To install the latest experimental version of GDAL, follow these commands:

sudo add-apt-repository -r ppa:ubuntugis/ppa
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update

Experimental versions of GDAL may not behave as expected and may potentially cause other issues with this recipe!

sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev python-gdal

    1. Install GMT:

sudo apt-get install csh subversion autoconf libtiff5-dev libhdf5-dev
sudo apt-get install ghostscript
sudo apt-get install libfftw3-dev
sudo apt-get install libgmt-dev
sudo apt-get install gmt

    1. Download and install the orbit directories:

cd ~
wget https://topex.ucsd.edu/gmtsar/tar/ORBITS.tar
cd /usr/local
sudo mkdir orbits
cd orbits
sudo tar -xf ~/ORBITS.tar 

    1. Download, compile and install GMT5SAR:

cd /usr/local
sudo svn checkout svn://gmtserver.soest.hawaii.edu/GMT5SAR/branches/5.4GMT5SAR
cd GMT5SAR
sudo apt-get install gfortran
sudo autoconf
sudo ./configure -–with-orbits-dir=/usr/local/orbits
sudo make
sudo make install

Once you have completed the installation steps given above, you are ready to configure.

Version numbers of the packages installed in the creation of this data recipe:

python2.7 (2.7.12-1ubuntu0~16.04.1)
python-lxml (3.5.0-1build1)
python-requests (2.9.1-3)
gdal-bin (2.1.3+dfsg-1~xenial2)
libgdal-dev (2.1.3+dfsg-1~xenial2)
python-gdal (2.1.3+dfsg-1~xenial2)
csh (20110502-2.1ubuntu1)
subversion (1.9.3-2ubuntu1.1)
autoconf (2.69-9)
ghostscript (9.18~dfsg~0-0ubuntu2.7)
libfftw3-dev:amd64 (3.3.4-2ubuntu1)
libgmt-dev (5.2.1+dfsg-4ubuntu2~xenial2)
gmt (5.2.1+dfsg-4ubuntu2~xenial2)

Configure

Prior to running the ASF script, each user will need to perform these configuration steps:

    1. Make GMT5SAR executables locatable:

export PATH=$PATH:/usr/local/GMT5SAR/bin/

Note: You must export the new path every time you log in (or set it in your profile).

Download script and config file:

    1. Download config.s1a.txt from ASF’s Data Recipe zip button and place it in your home directory.
      • The config file is set up to process interferometry only (threshold_snaphu=0.0)
      • For unwrapping, edit the config file in a text editor, set threshold_snaphu=0.2
    2. Download procS1GMT5SAR.py from ASF’s Data Recipe zip button and place it in your home directory.
    3. Create a .netrc file:

In order to get the precision state vectors from ASF, you must create a .netrc file in your home directory. This file must contain the following information. (Use the username and password from your URS/Earthdata account. Same as used to log in to Vertex):

Use a text editor such as “vi” to create or edit the .netrc file:

cd ~
vi .netrc

Add these lines:

machine urs.earthdata.nasa.gov
login <username>
password <password>

You are finally ready to create an interferogram!

Run the Script — Create an Interferogram

    1. Issue the following command to run the GMT5SAR process:

python procS1GMT5SAR.py <master granulename> <paired granulename>

Notes:

  • Use two Sentinel-1 SLCs, VV polarization only
  • The master granule must be first
  • Use .zip or .SAFE files
  • Script options:
    • -h, – -help     shows help message and exits

    • -d DEM, – -dem <yourDEMfilename> User-specified DEM file (in GMT format). If not used, the script will pull a DEM for you.

Example:

python procS1GMT5SAR.py
S1A_IW_SLC__1SSV_20150526T014935_20150526T015002_006086_007E23_679A.zip S1A_IW_SLC__1SDV_20150607T014936_20150607T015003_006261_00832E_3626.zip

The script will take some time to complete. The three commands prefaced with “Running Interferogram: “takes the bulk of processing time. Expect to wait a significant amount of time for each of the calls to p2p_S1A_TOPS.csh to finish (as much as an hour per call).

Sample Images

Script output images: color phase products for each swath F1, F2, F3. Contains modified Copernicus Sentinel data (2015) processed by ESA.

Appendix 1: Steps the Script Completes

How it Works:

    1. Unzip the input Sentinel-1 input granules.
    2. Download appropriate restituted state vectors.
    3. Download a DEM covering the area of the master image (OpenTopo or user-specified).
    4. Align the two images using the GMT5SAR script align_tops.csh.
    5. Create the interferograms, optionally unwrap, using the GMT5SAR script p2p_S1A_TOPS.csh.
    6. Create and populate the PRODUCT directory.

Appendix 2: Script Output Files — Unwrapping on

The outputs of the run will be placed in a directory called PRODUCT, e.g., the output from the above run will produce a PRODUCT directory with the following files:

20150526_20150607_F1_amp.tif 20150526_20150607_F1_color_phase.kmz 20150526_20150607_F1_color_phase.png 20150526_20150607_F1_corr.tif 20150526_20150607_F1_unw_phase.kmz 20150526_20150607_F1_unw_phase.png 20150526_20150607_F1_unw_phase.tif 20150526_20150607_F2_amp.tif 20150526_20150607_F2_color_phase.kmz 20150526_20150607_F2_color_phase.png 20150526_20150607_F2_corr.tif 20150526_20150607_F2_unw_phase.kmz 20150526_20150607_F2_unw_phase.png 20150526_20150607_F2_unw_phase.tif 20150526_20150607_F3_amp.tif 20150526_20150607_F3_color_phase.kmz 20150526_20150607_F3_color_phase.png 20150526_20150607_F3_corr.tif 20150526_20150607_F3_unw_phase.kmz 20150526_20150607_F3_unw_phase.png 20150526_20150607_F3_unw_phase.tif
The files are as follows:
F? swath designator, F1, F2, or F3
amp amplitude image
corr coherence map
color_phase wrapped phase file
unw_phase unwrapped phase file*

With extensions:

.kmz Google Earth KMZ format
.tif GeoTIFF format
.png Portable Network Graphic (browse image)

Appendix 3: Sample Script Run

The output from an example run, using the same LA data used in the GMT5SAR example, is as follows:

python procS1GMT5SAR.py
S1A_IW_SLC__1SSV_20150526T014935_20150526T015002_006086_007E23_679A.zip S1A_IW_SLC__1SDV_20150607T014936_20150607T015003_006261_00832E_3626.zip