Setup InSAR data processing codes on Linux / macOS using conda
environments.
mkdir -p ~/tools; cd ~/tools
# download, install and setup (mini/ana)conda
# for Linux, use Miniconda3-latest-Linux-x86_64.sh
# for macOS, opt 2: curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o Miniconda3-latest-MacOSX-x86_64.sh
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh -b -p ~/tools/miniconda3
~/tools/miniconda3/bin/conda init bash
Close and restart the shell for changes to take effect.
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install wget git tree mamba --yes
Both ISCE-2 and MintPy are now available on the conda-forge
channel, thus, one could install them by running:
mamba install isce2 mintpy
The note below installs ISCE-2 from conda or source, ARIA-tools and MintPy from source in development mode.
cd ~/tools
mkdir isce2; cd isce2
mkdir build install src; cd src
git clone https://github.com/isce-framework/isce2.git
cd ~/tools
git clone https://github.com/aria-tools/ARIA-tools.git
git clone https://github.com/insarlab/MintPy.git
git clone https://github.com/insarlab/PyAPS.git
git clone https://github.com/insarlab/PySolid.git
git clone https://github.com/yunjunz/conda_envs.git
git clone https://www.unavco.org/gitlab/unavco_public/ssara_client.git utils/SSARA
# create new environment
conda create --name insar --yes
conda activate insar
# opt 1: install isce-2 with conda (for macOS and Linux)
mamba install -y --file conda_envs/insar/requirements.txt --file MintPy/requirements.txt --file ARIA-tools/requirements.txt isce2
# opt 2: install isce-2 from source (for Linux on kamb only)
mamba install -y --file conda_envs/insar/requirements.txt --file MintPy/requirements.txt --file ARIA-tools/requirements.txt --file conda_envs/isce2/requirements.txt
# install MintPy in development mode
# overwrite PyAPS and PySolid installation from conda to the local development mode
python -m pip install -e MintPy
python -m pip install -e PyAPS
python -m pip install -e PySolid
# install dependencies not available from conda
ln -s ${CONDA_PREFIX}/bin/cython ${CONDA_PREFIX}/bin/cython3
python -m pip install scalene # CPU, GPU and memory profiler
python -m pip install ipynb # import functions from *.ipynb files
For opt 2 (building and installing the development version of ISCE-2 from source) ONLY.
# load CUDA module on kamb
module load cuda/11.2
# generate build system
# before re-run, delete existing contents in build folder
# more notes on https://github.com/lijun99/isce2-install
cd ~/tools/isce2/build
cmake ~/tools/isce2/src/isce2 -DCMAKE_INSTALL_PREFIX=~/tools/isce2/install -DCMAKE_CUDA_FLAGS="-arch=sm_60" -DCMAKE_PREFIX_PATH=${CONDA_PREFIX} -DCMAKE_BUILD_TYPE=Release
# compile and install
# then under the $ISCE_ROOT/install, there should be `bin` and `packages` folder
make -j 16 # use multiple threads to accelerate
make install
Set ISCE_INSTALL_METHOD="source"
in ~/.bash_profile
file.
Create an alias load_insar
in ~/.bash_profile
file for easy activation, e.g.:
alias load_insar='conda activate insar; source ~/tools/conda_envs/insar/config.rc'
Run the following to test the installation:
load_insar # warm up conda environment
topsApp.py -h # test ISCE-2
cuDenseOffsets.py -h # test ISCE-2/PyCuAmpcor (for opt 2 only)
ariaDownload.py -h # test ARIA-tools
smallbaselineApp.py -h # test MintPy
Run the following for CPU and memory profiler via scalene
of python script, e.g. ifgram_inversion.py
:
scalene --reduced-profile ~/tools/MintPy/mintpy/ifgram_inversion.py ~/data/test/FernandinaSenDT128/mintpy/inputs/ifgramStack.h5 -w no