PyOSP
An Python Library for Object-Oriented Swath Profile Analysis
Install / Use
/learn @PyOSP-devs/PyOSPREADME
<p><img alt="intro" src="https://i.imgur.com/7jkyyog.gif" height="300"/></p>
Intelligent and comprehensive swath analysis
Features
- :gem: Intelligent: objectively identify irregular boundries using elevation, slope, TPI, or other raster analyses.
- :milky_way: Comprehensive: cuvilinear and circular swath analyses, reclassification of swath data, cross-swath, slice and histogram, etc.
- :two_women_holding_hands: Compatible: work seamlessly with GIS software.
- :anchor: 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):
- Topographic analysis of Teton Range, Wyoming
- Terrace correlation along the Licking River, Kentucky
- 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.
<p><img alt="homo_case" src="https://i.imgur.com/nSFSqxo.png" height="200"/></p>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.
<p><img alt="homo_polygon" src="https://i.imgur.com/nLgQEsJ.jpg" height="200"/></p>Plot, for example, elevation based swath profile.
elev.profile_plot()
<img alt="elev_sp" src="https://i.imgur.com/0taXAhF.jpg.jpg" height="200"/></p>
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.
- Fork the project
- Create your feature branch (
git checkout -b feature/amazingfeature) - Commit your changes (
git commit -m 'add some amazingfeature') - Push to the branch (
git push origin feature/amazingfeature) - 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
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
