Skip to content

conda environment setup in Linux / macOS for InSAR data processing

Notifications You must be signed in to change notification settings

JieLiu3910/conda_envs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

conda_envs

Setup InSAR data processing codes on Linux / macOS using conda environments.

1. Install conda

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

2. Install ISCE-2, ARIA-tools and MintPy to insar environment

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.

a. Download source code

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

b. Install dependencies to insar environment

# 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

c. Build and install ISCE-2 from source

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.

d. Setup

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'

e. Test the installation

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

Useful resources

About

conda environment setup in Linux / macOS for InSAR data processing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%