Skip to content
David Sandwell edited this page Mar 2, 2024 · 27 revisions

Installation of GMT and GMTSAR with Homebrew

  1. Download and install orbit files in /usr/local/orbits:
http://topex.ucsd.edu/gmtsar/tar/ORBITS.tar
sudo -i
cd /usr/local
mkdir orbits
cd orbits
tar -xvf ~/Downloads/ORBITS.tar # (need full path to ORBITS.tar)
  1. Install stable version 6.4 with Homebrew (now working with M1 Mac)
xcode-select --install
brew tap dsandwell/homebrew-insar
brew install wget
brew install gmtsar  

Installation of GMT and GMTSAR with package managers and GITHUB

  1. Install extra libraries. Note that depending on your OS version the actual version numbers in some of the packages below may differ). The libraries below may require other libraries; use sudo apt[-get] install -y to automatically select yes.
  • Ubuntu 14.04 LTS:
sudo apt-get install csh subversion autoconf libtiff5-dev libhdf5-dev wget
sudo apt-get install liblapack-dev
sudo apt-get install gfortran
sudo apt-get install g++
Install GMT from source since no GMT version >= 5 in 14.04.
  • Ubuntu 16.06 LTS:
sudo apt-get install csh subversion autoconf libtiff5-dev libhdf5-dev wget
sudo apt-get install liblapack-dev
sudo apt-get install gfortran
sudo apt-get install g++
sudo apt-get install libgmt-dev
sudo apt-get install gmt-dcw gmt-gshhg (16.0 LTS)
sudo apt-get install gmt
  • Ubuntu 20.04 LTS or later:
sudo apt-get install csh subversion autoconf libtiff5-dev libhdf5-dev wget
sudo apt-get install liblapack-dev
sudo apt-get install gfortran
sudo apt-get install g++
sudo apt-get install libgmt-dev
sudo apt-get install gmt-dcw gmt-gshhg
sudo apt-get install gmt
  • CentOS 7:
sudo yum install svn autoconf gcc-c++ libtiff-devel hdf5-devel wget
sudo yum install gmt
  • Fedora 23:
sudo yum install csh subversion autoconf  gcc-c++ libtiff-devel hdf5-devel wget
(need fftw-developer for faster execution.)
sudo yum install gmt
  1. If you need to process ERS or ENVISAT data (1992-2011), download and install orbit files and place in suitable directory (e.g., /usr/local/orbits, and specify this path in step 4 with configure):
http://topex.ucsd.edu/gmtsar/tar/ORBITS.tar
sudo -i
cd /usr/local
mkdir orbits
cd orbits
tar -xvf ~/Downloads/ORBITS.tar # (need full path to ORBITS.tar)
  1. Download GMTSAR GITHUB suitable directory:
sudo -i
cd /usr/local
git clone --branch 6.4 https://github.com/gmtsar/gmtsar GMTSAR
#   or
#   checkout the master version for more new but not stable features. 
git clone https://github.com/gmtsar/gmtsar GMTSAR
#   or for UBUNTU 14, 16 where only gmt5 is available, use V5.8
git clone --branch 5.8 https://github.com/gmtsar/gmtsar GMTSAR
exit

#  make youself the owner of this directory
cd /usr/local
sudo chown -R $USER GMTSAR
  1. Make and install GMTSAR (change the orbits directory if different):
cd GMTSAR
autoconf
autoupdate
./configure --with-orbits-dir=/usr/local/orbits

For Ubuntu 21.04 or later, edit config.mk and add -z muldefs to your CFLAGS and LDFLAGS. Then run

make
make install
  1. Add the executables to your path (for csh or tcsh):
cd ~
#
#   edit your .tcshrc file and add the following lines
#
        setenv GMTSAR /usr/local/GMTSAR
        setenv PATH $GMTSAR/bin:"$PATH"

or

cd ~
#  edit your .bashrc file and add the following lines
        export GMTSAR=/usr/local/GMTSAR
        export PATH=$GMTSAR/bin:"$PATH"
  1. Test your installation. Open a new terminal window and run the following commands. Expected outputs are
% esarp
esarp [GMTSAR] - Produce SAR processed image

Usage: esarp filein.PRM fileout.SLC [R4]

% phasediff
phasediff [GMTSAR] - Compute phase difference of two images

Usage: phasediff ref.PRM rep.PRM [-topo topo_ra.grd] [-model modelphase.grd]
 (topo_ra and model in GMT grd format

% p2p_processing.csh

Usage: p2p_processing.csh SAT master_image aligned_image [configuration_file] 

Example: p2p_processing.csh ALOS IMG-HH-ALPSRP055750660-H1.0__A IMG-HH-ALPSRP049040660-H1.0__A [config.alos.txt]

    Put the data and orbit files in the raw folder, put DEM in the topo folder
    The SAT needs to be specified, choices with in ERS, ENVI, ALOS, ALOS_SLC, ALOS2, ALOS2_SCAN
    S1_STRIP, S1_TOPS, ENVI_SLC, CSK_RAW, CSK_SLC, TSX, RS2, GF3

    Make sure the files from the same date have the same stem, e.g. aaaa.tif aaaa.xml aaaa.cos aaaa.EOF, etc

    If the configuration file is left blank, the program will generate one 
    with default parameters 

Installing Ubuntu virtual machine with GMTSAR pre-installed

  1. Download VirtualBox or VMware, or any virtual machine that could load the .ova format (1.0).
  2. Download the Ubuntu VM that has GMTSAR and all dependencies (including GMT) installed. http://topex.ucsd.edu/gmtsar/tar/Ubuntu20.0_GMTSAR6.1.ova
  3. Load the VM into your VirtualBox or VMware, and start the system. The password is gmtsar
  4. Open a terminal and type esarp, you should see the following message popping out.
esarp [GMTSAR] - Produce SAR processed image
Usage: esarp filein.PRM fileout.SLC [R4]
  1. The current system has 8GB RAM and 50GB disk space allocated. To acquire more, use your VirtualBox/VMware settings to allocate more or extend disks with shared folders or external disks.