https://github.com/pyosp-devs/pyosp
An Python Library for Object-Oriented Swath Profile Analysis
https://github.com/pyosp-devs/pyosp
conda elevation swath-analysis swath-profile tpi
Last synced: 4 months ago
JSON representation
An Python Library for Object-Oriented Swath Profile Analysis
- Host: GitHub
- URL: https://github.com/pyosp-devs/pyosp
- Owner: PyOSP-devs
- License: apache-2.0
- Created: 2020-08-07T01:21:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-05T20:10:04.000Z (over 4 years ago)
- Last Synced: 2025-11-10T05:22:04.226Z (8 months ago)
- Topics: conda, elevation, swath-analysis, swath-profile, tpi
- Language: Python
- Homepage: https://github.com/PyOSP-devs/PyOSP
- Size: 12.1 MB
- Stars: 22
- Watchers: 2
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

---

_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):
1. [Topographic analysis of Teton Range, Wyoming](https://pyosp.readthedocs.io/en/latest/notebooks/pyosp_teton.html)
2. [Terrace correlation along the Licking River, Kentucky](https://pyosp.readthedocs.io/en/latest/notebooks/pyosp_licking.html)
3. [Circular swath analysis of Olympus Mons, Mars](https://pyosp.readthedocs.io/en/latest/notebooks/pyosp_olympus.html)
## Installation
We recommend to use the [conda](https://conda.io/en/latest/) package manager to install pyosp. It will provide pre-built binaries for all dependencies of pyosp. If you have the [miniconda](https://docs.conda.io/en/latest/miniconda.html) (recommend; only containing python and the conda package manager), or [anaconda distribution](https://www.anaconda.com/) (a python distribution with many installed libraries for data science) installed, then simply execute the following command:
```bash
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
```bash
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:
```bash
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:
```python
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.

Original, elevation, slope and tpi based swath calculation.
```python
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.

Plot, for example, elevation based swath profile.
```python
elev.profile_plot()
```

_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](https://github.com/pyosp-devs/pyosp/issues/new)
- If you need to get in touch for other reasons, [send us an email](yichuan211@gmail.com)
## Credits
This work is supported by [Kentucky Geological Survey](https://www.uky.edu/kgs/).
## License
[Apache license, version 2.0](https://github.com/pyosp-devs/pyosp/blob/master/license)