Skip to content

PyOSP-devs/PyOSP

Repository files navigation

pyosp logo

github release (latest by date) TravisCI Coverage Status Conda Downloads publication


intro

Intelligent and comprehensive swath analysis

Features

  • 💎 Intelligent: objectively identify irregular boundries using elevation, slope, TPI, or other raster analyses.
  • 🌌 Comprehensive: cuvilinear and circular swath analyses, reclassification of swath data, cross-swath, slice and histogram, etc.
  • 👭 Compatible: work seamlessly with GIS software.
  • Dependencies: numpy, matplotlib, gdal, scipy and shapely.

Documentation

Read the documentation at: https://pyosp.readthedocs.io/en/latest/index.html

Introduction, methodology, and case studies: https://doi.org/10.1016/j.geomorph.2021.107778

Applications (starting from scratch):

  1. Topographic analysis of Teton Range, Wyoming
  2. Terrace correlation along the Licking River, Kentucky
  3. Circular swath analysis of Olympus Mons, Mars

Installation

We recommend to use the conda package manager to install pyosp. It will provide pre-built binaries for all dependencies of pyosp. If you have the miniconda (recommend; only containing python and the conda package manager), or anaconda distribution (a python distribution with many installed libraries for data science) installed, then simply execute the following command:

conda install -c conda-forge pyosp 

Installing in a new environment (recommended)

Although it is not required, installing the library in a clean environment represents good practice and helps avoid potential dependency conflicts. We also recommends install all dependencies with pyosp through conda-forge channel

conda create -n env_pyosp 
conda activate env_pyosp
conda config --env --add channels conda-forge
conda config --env --set channel_priority strict
conda install python=3 pyosp

You can also install from current branch:

git clone https://github.com/pyosp-devs/pyosp.git
cd pyosp
conda install --file requirements.txt
python setup.py install

You can verify installation by entering a python shell and typing:

import pyosp
print(pyosp.__version__)

Example

Here is a simple example of using pyosp to perform swath analysis on a synthetic mountain case. The cross-width of mountain is around 90m, and flat ground has elevation of zero.

homo_case

Original, elevation, slope and tpi based swath calculation.

import pyosp

baseline = pyosp.datasets.get_path("homo_baseline.shp") # the path to baseline shapefile
raster = pyosp.datasets.get_path("homo_mount.tif")  # the path to raster file

orig = pyosp.Orig_curv(baseline, raster, width=100,
                       line_stepsize=3, cross_stepsize=None)

elev = pyosp.Elev_curv(baseline, raster, width=100,
                       min_elev=0.01,
                       line_stepsize=3, cross_stepsize=None)

slope = pyosp.Slope_curv(baseline, raster, width=100,
                         min_slope=1,
                         line_stepsize=3, cross_stepsize=None)

tpi = pyosp.Tpi_curv(baseline, raster, width=100,
                     tpi_radius=50, min_tpi=0,
                     line_stepsize=3, cross_stepsize=None)

We can plot with matplotlib, or open in GIS software.

homo_polygon

Plot, for example, elevation based swath profile.

elev.profile_plot()

elev_sp

For more example and usage, please refer to our documentation.

Citing pyosp

If you use PyOSP for your work, please cite as:

Y. Zhu, J.M. Dortch, M.A. Massey, et al., An Intelligent Swath Tool to Characterize complex Topographic Features: Theory and Application in the Teton Range, Licking River, and Olympus Mons, Geomorphology (2021), https://doi.org/10.1016/j.geomorph.2021.107778

Contributing

Any contributions you make are greatly appreciated.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/amazingfeature)
  3. Commit your changes (git commit -m 'add some amazingfeature')
  4. Push to the branch (git push origin feature/amazingfeature)
  5. Open a pull request

Feedback

  • If you think pyosp is useful, consider giving it a star.
  • If something is not working, create an issue
  • If you need to get in touch for other reasons, send us an email

Credits

This work is supported by Kentucky Geological Survey.

License

Apache license, version 2.0