Skip to content

Commit

Permalink
Merge pull request #62 from mirzaees/pip-install
Browse files Browse the repository at this point in the history
Pip install
  • Loading branch information
mirzaees authored Aug 22, 2023
2 parents 65a4b29 + b305718 commit 25d896f
Show file tree
Hide file tree
Showing 12 changed files with 788 additions and 388 deletions.
6 changes: 4 additions & 2 deletions conda_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ channels:
- defaults
dependencies:
- c-compiler
- python>=3.6,<3.9
- python>=3.9
- cartopy
- cvxopt
- rasterio
- dask>=1.0
- dask-jobqueue>=0.3
- defusedxml
- h5py<3
- h5py
- lxml
- matplotlib
- numpy
Expand All @@ -24,6 +25,7 @@ dependencies:
- scikit-image
- scipy
- gdal
- mintpy
- isce2
- cython
- setuptools
Expand Down
11 changes: 0 additions & 11 deletions docs/install

This file was deleted.

67 changes: 14 additions & 53 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,39 @@
## Install MiaplPy

#### 1. Set the following environment variables in your source file. It could be ~/.bash_profile file for bash user or ~/.cshrc file for csh/tcsh user.

```
if [ -z ${PYTHONPATH+x} ]; then export PYTHONPATH=""; fi
##--------- MintPy ------------------##
export MINTPY_HOME=~/tools/MintPy
export PYTHONPATH=${PYTHONPATH}:${MINTPY_HOME}
export PATH=${PATH}:${MINTPY_HOME}/mintpy/cli
#---------- MiaplPy ------------------##
export MIAPLPY_HOME=~/tools/MiaplPy
export PYTHONPATH=${PYTHONPATH}:${MIAPLPY_HOME}
export PATH=${PATH}:${MIAPLPY_HOME}/miaplpy
export PATH=${PATH}:${MIAPLPY_HOME}/snaphu/bin
```
#### 2. Download

#### 1. Download source code
```
cd ~/tools
git clone https://github.com/insarlab/MiaplPy.git
git clone https://github.com/insarlab/MintPy.git
cd ~/tools/MiaplPy
```

#### 3. install dependencies

Install miniconda if you have not already done so. You may need to close and restart the shell for changes to take effect.
#### 2. Install dependencies
```
# download and install miniconda
# use wget or curl to download in command line or click from the web brower
# MacOS users: curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o Miniconda3-latest-MacOSX-x86_64.sh
# Linux users: curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3-latest-Linux-x86_64.sh
# Mac users:
miniconda_version=Miniconda3-latest-MacOSX-x86_64.sh
# Linux users:
miniconda_version=Miniconda3-latest-Linux-x86_64.sh
wget http://repo.continuum.io/miniconda/$miniconda_version --no-check-certificate -O $miniconda_version
chmod +x $miniconda_version
./$miniconda_version -b -p ~/tools/miniconda3
~/tools/miniconda3/bin/conda init bash
mamba env create --file conda-env.yml
```

Run the following in your terminal to install the dependencies to a new environment miaplpy (recommended):
or if you have an existing environment:

```
conda env create -f $MIAPLPY_HOME/docs/conda_env.yml
conda activate miaplpy
mamba env update --name my-existing-env --file conda-env.yml
```
Or run the following in your terminal to install the dependencies to your custom environment, the default is base:

#### 3. Install MiaplPy via pip
```
conda install --yes -c conda-forge --file ~/tools/MiaplPy/docs/requirements.txt
conda activate dolphin-env
python -m pip install .
```

#### 4. Setup MiaplPy

I. Compile
```
cd $MIAPLPY_HOME/miaplpy/lib;
python setup.py
```
II. Install [SNAPHU](https://web.stanford.edu/group/radar/softwareandlinks/sw/snaphu/)
#### 4. Install [SNAPHU](https://web.stanford.edu/group/radar/softwareandlinks/sw/snaphu/)
```
cd $MIAPLPY_HOME;
export TOOLS_DIR=~/tools
cd ~/tools;
wget --no-check-certificate https://web.stanford.edu/group/radar/softwareandlinks/sw/snaphu/snaphu-v2.0.5.tar.gz
tar -xvf snaphu-v2.0.5.tar.gz
mv snaphu-v2.0.5 snaphu;
rm snaphu-v2.0.5.tar.gz;
sed -i 's/\/usr\/local/$(MIAPLPY_HOME)\/snaphu/g' snaphu/src/Makefile
sed -i 's/\/usr\/local/$(TOOLS_DIR)\/snaphu/g' snaphu/src/Makefile
cd snaphu/src; make
export PATH=${TOOLS_DIR}/snaphu/bin:${PATH}
```

### Notes
Expand Down
28 changes: 26 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,39 @@ license = { file = "LICENSE" }

dynamic = ["version"] # , "dependencies"]

# Entry points for the command line interface
[project.scripts]
miaplpyApp = "miaplpy.miaplpyApp:main"
'check_ifgs.py' = "miaplpy.check_ifgs:main"
'correct_geolocation.py' = "miaplpy.correct_geolocation:main"
'cpxview.py' = "miaplpy.cpxview:main"
'find_short_baselines.py' = "miaplpy.find_short_baselines:find_baselines"
'generate_temporal_coherence.py' = "miaplpy.generate_temporal_coherence:main"
'generate_unwrap_mask.py' = "miaplpy.generate_unwrap_mask:main"
'load_ifgram.py' = "miaplpy.load_ifgram:main"
'load_slc_geometry.py' = "miaplpy.load_slc_geometry:main"
'network_inversion.py' = "miaplpy.network_inversion:main"
'phase_linking.py' = "miaplpy.phase_linking:main"
'prep_slc_isce.py' = "miaplpy.prep_slc_isce:main"
'scatterview.py' = "miaplpy.scatterview:main"
'simulation.py' = "miaplpy.simulation:simulate_and_calculate_different_method_rms"
'tcoh_view.py' = "miaplpy.tcoh_view:main"
'generate_ifgram.py' = "miaplpy.generate_ifgram:main"
'unwrap_ifgram.py' = "miaplpy.unwrap_ifgram:main"


[tool.setuptools.packages.find]
where = ["src"]
#include = ["defaults/*.cfg", "defaults/*.full"]

[tool.setuptools.package-data]
myModule = ["defaults/*.cfg", "defaults/*.full"]

[tool.setuptools.dynamic]
# dependencies = { file = ["requirements.txt"] }
#dependencies = { file = ["requirements.txt"] }
version = {attr = "miaplpy.__version__"}


[project.urls]
Homepage = "https://github.com/insarlab/MiaplPy/"
"Bug Tracker" = "https://github.com/insarlab/MiaplPy/issues"
"Bug Tracker" = "https://github.com/insarlab/MiaplPy/issues"
8 changes: 8 additions & 0 deletions src/miaplpy/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Main module to provide command line interface to the workflows."""
import sys

from .miaplpyApp import main

# https://docs.python.org/3/library/__main__.html#packaging-considerations
# allows `python -m miaplpyApp` to work
sys.exit(main())
Loading

0 comments on commit 25d896f

Please sign in to comment.