lidar
lidar: A Python package for delineating nested surface depressions from digital elevation data - Published in JOSS (2021)
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 33 DOI reference(s) in README -
✓Academic publication links
Links to: joss.theoj.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.2%) to scientific vocabulary
Keywords
Keywords from Contributors
Scientific Fields
Repository
A Python package for delineating nested surface depressions from digital elevation data.
Basic Info
- Host: GitHub
- Owner: opengeos
- License: mit
- Language: Python
- Default Branch: master
- Homepage: https://lidar.gishub.org
- Size: 14.3 MB
Statistics
- Stars: 289
- Watchers: 9
- Forks: 54
- Open Issues: 9
- Releases: 16
Topics
Metadata Files
README.md
Welcome to the lidar package
lidar is Python package for delineating the nested hierarchy of surface depressions in digital elevation models (DEMs). It is particularly useful for analyzing high-resolution topographic data, such as DEMs derived from Light Detection and Ranging (LiDAR) data.
- GitHub repo: https://github.com/opengeos/lidar
- Documentation: https://lidar.gishub.org
- PyPI: https://pypi.org/project/lidar
- Conda-forge: https://anaconda.org/conda-forge/lidar
- Open in Colab: https://gishub.org/lidar-colab
- Free software: MIT license
Citations
- Wu, Q., (2021). lidar: A Python package for delineating nested surface depressions from digital elevation data. Journal of Open Source Software, 6(59), 2965, https://doi.org/10.21105/joss.02965
- Wu, Q., Lane, C.R., Wang, L., Vanderhoof, M.K., Christensen, J.R., & Liu, H. (2019). Efficient Delineation of Nested Depression Hierarchy in Digital Elevation Models for Hydrological Analysis Using Level-Set Method. Journal of the American Water Resources Association. https://doi.org/10.1111/1752-1688.12689 (PDF)
Contents
- Introduction
- Statement of Need
- State of the Field
- Key Features
- Installation
- Usage
- References
- Contributing
- Credits
Introduction
lidar is a Python package for delineating the nested hierarchy of surface depressions in digital elevation models (DEMs). In traditional hydrological modeling, surface depressions in a DEM are commonly treated as artifacts and thus filled and removed to create a depressionless DEM, which can then be used to generate continuous stream networks. In reality, however, surface depressions in DEMs are commonly a combination of spurious and actual terrain features. Fine-resolution DEMs derived from Light Detection and Ranging (LiDAR) data can capture and represent actual surface depressions, especially in glaciated and karst landscapes. During the past decades, various algorithms have been developed to identify and delineate surface depressions, such as depression filling, depression breaching, hybrid breaching-filling, and contour tree method. More recently, a level-set method based on graph theory was proposed to delineate the nested hierarchy of surface depressions. The lidar Python package implements the level-set method and makes it possible for delineating the nested hierarchy of surface depressions as well as elevated terrain features. It also provides an interactive Graphical User Interface (GUI) that allows users to run the program with minimal coding.
Statement of Need
The lidar package is intended for scientists and researchers who would like to integrate surface depressions into hydrological modeling. It can also facilitate the identification and delineation of depressional features, such as sinkholes, detention basins, and prairie potholes. The detailed topological and geometric properties of surface depressions can be useful for terrain analysis and hydrological modeling, including the size, volume, mean depth, maximum depth, lowest elevation, spill elevation, perimeter, major axis length, minor axis length, elongatedness.
State of the Field
Currently, there are a few open-source Python packages that can perform depression filling on digital elevation data, such as RichDEM and whitebox, the Python frontend for WhiteboxTools. However, there are no Python packages offering tools for delineating the nested hierarchy of surface depressions and catchments as well as simulating inundation dynamics. The lidar Python package is intended for filling this gap.
Key Features
- Smoothing DEMs using mean, median, and Gaussian filters.
- Extracting depressions from DEMs.
- Filtering out small artifact depressions based on user-specified minimum depression size.
- Generating refined DEMs with small depressions filled but larger depressions kept intact.
- Delineating depression nested hierarchy using the level-set method.
- Delineating mount nested hierarchy using the level-set method.
- Computing topological and geometric properties of depressions, including size, volume, mean depth, maximum depth, lowest elevation, spill elevation, perimeter, major axis length, minor axis length, elongatedness, eccentricity, orientation, and area-bbox-ratio.
- Exporting depression properties as a csv file.
Installation
lidar supports a variety of platforms, including Microsoft Windows, macOS, and Linux operating systems. Note that you will need to have Python 3.x (< 3.9) installed. Python 2.x is not supported. lidar is available on both PyPI and conda-forge. lidar has a GDAL dependency, which can be challenging to install using pip on Windows. Therefore, it is highly recommended to install lidar from the conda-forge channel. If you encounter any errors, please check the Dependencies section below.
Install from PyPI
To install lidar from PyPI, run this command in your terminal:
console
pip install lidar
Install from conda-forage
If you have Anaconda or Miniconda installed on your computer, you can create a fresh conda environment to install lidar:
console
conda create -n geo python=3.11
conda activate geo
conda install -c conda-forge mamba
mamba install -c conda-forge lidar
Upgrade lidar
If you have installed lidar before and want to upgrade to the latest version, you can run the following command in your terminal:
console
pip install -U lidar
If you use conda, you can update lidar to the latest version by running the following command in your terminal:
console
mamba update -c conda-forge lidar
To install the development version from GitHub directly using Git, run the following code:
console
pip install git+https://github.com/opengeos/lidar
Dependencies
lidar's Python dependencies are listed in its requirements.txt file. In addition, lidar has a C library dependency: GDAL >=1.11.2. How to install GDAL in different operating systems will be explained below. More information about GDAL can be found here.
Linux
Debian-based Linux
The following commands can be used to install GDAL for Debian-based Linux distributions (e.g., Ubuntu, Linux Mint).
console
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev
If you encounter any compiling errors, try the following commands.
console
sudo apt-get install --reinstall build-essential
sudo apt-get install python3-dev
pip install wheel
Pacman-based Linux
The following commands can be used to install GDAL for Pacman-based Linux distributions (e.g., Arch Linux, Manjaro). You might need to use sudo if you encounter permission errors.
console
sudo pacman -S yaourt --noconfirm
yaourt -S gdal --noconfirm
yaourt -S python-gdal --noconfirm
macOS
For a Homebrew based Python environment, do the following.
console
brew update
brew install gdal
Alternatively, you can install GDAL binaries from kyngchaos. You will
then need to add the installed location
/Library/Frameworks/GDAL.framework/Programs to your system path.
Windows
The instruction below assumes that you have installed Anaconda. Open Anaconda Prompt and enter the following commands to create a conda environment and install required packages
console
conda create -n geo python=3.11
conda activate geo
conda install -c conda-forge mamba
mamba install -c conda-forge lidar
When installing the lidar package, if you encounter an error
saying Microsoft Visual C++ 14.0 is required, please follow the steps
below to fix the error and reinstall lidar. More information can
be found at this link Fix Python 3 on Windows error - Microsoft Visual C++ 14.0 is required.
- Download Microsoft Build Tools for Visual Studio 2017
- Double click to install the downloaded installer - Microsoft Build Tools for Visual Studio 2017.
- Open Microsoft Build Tools for Visual Studio 2017
- Select Workloads --> Visual C++ build tools and click the install button
Usage
Launch the interactive notebook tutorial for the lidar Python package with Google Colab now:
A quick example
```python import os import pkg_resources from lidar import *
identify the sample data directory of the package
packagename = 'lidar' datadir = pkgresources.resourcefilename(package_name, 'data/')
use the sample dem. Change it to your own dem if needed
indem = os.path.join(datadir, 'dem.tif')
set the output directory
out_dir = os.getcwd()
parameters for identifying sinks and delineating nested depressions
minsize = 1000 # minimum number of pixels as a depression mindepth = 0.5 # minimum depth as a depression interval = 0.3 # slicing interval for the level-set method bool_shp = True # output shapefiles for each individual level
extracting sinks based on user-defined minimum depression size
outdem = os.path.join(outdir, "median.tif") indem = MedianFilter(indem, kernelsize=3, outfile=outdem) sinkpath = ExtractSinks(indem, minsize, outdir) depidpath, deplevelpath = DelineateDepressions(sinkpath, minsize, mindepth, interval, outdir, boolshp) print('Results are saved in: {}'.format(out_dir)) ```
lidar GUI
lidar also provides a Graphical User Interface (GUI), which can be invoked using the following Python script:
python
import lidar
lidar.gui()

lidar toolbox for ArcGIS Pro
Toolbox interface


Video tutorials
Delineating nested surface depressions and catchments using ArcGIS Pro
Delineating nested surface depressions and catchments using ArcMap
A real-world example
The images below show working examples of the level set method for delineating nested depressions in the Cottonwood Lake Study Area (CLSA), North Dakota. More test datasets (e.g., the Pipestem watershed in the Prairie Pothole Region of North Dakota) can be downloaded from http://gishub.org/2019-JAWRA-Data
The following example was conducted on a 64-bit Linux machine with a quad-core Intel i7-7700 CPU and 16 GB RAM. The average running time of the algorithm for this DEM was 0.75 seconds.



References
The level-set algorithm was proposed by Wu et al. (2019):
- Wu, Q., Lane, C.R., Wang, L., Vanderhoof, M.K., Christensen, J.R., & Liu, H. (2019). Efficient Delineation of Nested Depression Hierarchy in Digital Elevation Models for Hydrological Analysis Using Level-Set Method. Journal of the American Water Resources Association. DOI: 10.1111/1752-1688.12689 (PDF)
Applications of the level-set and contour-tree methods for feature extraction from LiDAR data:
- Wu, Q., & Lane, C.R. (2017). Delineating wetland catchments and modeling hydrologic connectivity using LiDAR data and aerial imagery. Hydrology and Earth System Sciences. 21: 3579-3595. DOI: 10.5194/hess-21-3579-2017
- Wu, Q., Deng, C., & Chen, Z. (2016). Automated delineation of karst sinkholes from LiDAR-derived digital elevation models. Geomorphology. 266: 1-10. DOI: 10.1016/j.geomorph.2016.05.006
- Wu, Q., Su, H., Sherman, D.J., Liu, H., Wozencraft, J.M., Yu, B., & Chen, Z. (2016). A graph-based approach for assessing storm-induced coastal changes. International Journal of Remote Sensing. 37:4854-4873. DOI: 10.1080/01431161.2016.1225180
- Wu, Q., & Lane, C.R. (2016). Delineation and quantification of wetland depressions in the Prairie Pothole Region of North Dakota. Wetlands. 36(2):215–227. DOI: 10.1007/s13157-015-0731-6
- Wu, Q., Liu, H., Wang, S., Yu, B., Beck, R., & Hinkel, K. (2015). A localized contour tree method for deriving geometric and topological properties of complex surface depressions based on high-resolution topographic data. International Journal of Geographical Information Science. 29(12): 2041-2060. DOI: 10.1080/13658816.2015.1038719
- Wu, Q., Lane, C.R., & Liu, H. (2014). An effective method for detecting potential woodland vernal pools using high-resolution LiDAR data and aerial imagery. Remote Sensing. 6(11):11444-11467. DOI: 10.3390/rs61111444
Contributing
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. You can contribute in many ways:
Types of Contributions
Report Bugs
Report bugs at https://github.com/opengeos/lidar/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement it.
Implement Features
Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it.
Write Documentation
lidar could always use more documentation, whether as part of the official lidar docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback
The best way to send feedback is to file an issue at https://github.com/opengeos/lidar/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome.
Get Started
Ready to contribute? Here's how to set up lidar for local development.
Fork the lidar repo on GitHub.
Clone your fork locally:
console
git clone git@github.com:your_name_here/lidar.git
- Install your local copy into a conda env. Assuming you have conda installed, this is how you set up your fork for local development:
console
conda create -n lidar-test python
conda activate lidar-test
cd lidar/
pip install -e .
- Create a branch for local development:
console
git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
- When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
console
flake8 lidar tests
python setup.py test or pytest
To get flake8 and tox, just pip install them into your conda env.
- Commit your changes and push your branch to GitHub:
console
git add .
git commit -m "Your detailed description of your changes."
git push origin name-of-your-bugfix-or-feature
- Submit a pull request through the GitHub website.
Pull Request Guidelines
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.md.
- The pull request should work for Python 3.7 and 3.8. Check https://github.com/opengeos/lidar/actions and make sure that the tests pass for all supported Python versions.
Credits
- The algorithms are built on RichDEM, numpy, scipy, scikit-image, and pygdal.
- This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Owner
- Name: Open Geospatial Solutions
- Login: opengeos
- Kind: organization
- Email: opengeos@outlook.com
- Website: https://opengeos.github.io
- Repositories: 1
- Profile: https://github.com/opengeos
A collection of open-source software packages for the geospatial community
GitHub Events
Total
- Create event: 6
- Issues event: 1
- Release event: 1
- Watch event: 39
- Delete event: 4
- Issue comment event: 8
- Push event: 15
- Pull request event: 8
- Fork event: 1
Last Year
- Create event: 6
- Issues event: 1
- Release event: 1
- Watch event: 39
- Delete event: 4
- Issue comment event: 8
- Push event: 15
- Pull request event: 8
- Fork event: 1
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Qiusheng Wu | g****s@g****m | 194 |
| pre-commit-ci[bot] | 6****] | 7 |
| rafe | r****e@p****m | 1 |
| dependabot[bot] | 4****] | 1 |
| TrellixVulnTeam | c****d@t****m | 1 |
| Stephen Walters | s****s@n****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 23
- Total pull requests: 35
- Average time to close issues: 6 months
- Average time to close pull requests: 2 days
- Total issue authors: 17
- Total pull request authors: 6
- Average comments per issue: 2.91
- Average comments per pull request: 0.09
- Merged pull requests: 34
- Bot issues: 0
- Bot pull requests: 11
Past Year
- Issues: 1
- Pull requests: 10
- Average time to close issues: N/A
- Average time to close pull requests: 5 days
- Issue authors: 1
- Pull request authors: 2
- Average comments per issue: 5.0
- Average comments per pull request: 0.0
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 4
Top Authors
Issue Authors
- geotom (4)
- maryloooh (3)
- giswqs (2)
- pre-commit-ci[bot] (1)
- tlohde (1)
- hafez-ahmad (1)
- DManowitz (1)
- MIsmlAhmed (1)
- stephenwaltersNV5 (1)
- jeremyg19 (1)
- MikeTheWatchGuy (1)
- shubham9436 (1)
- yalabbad (1)
- FernandaDavi (1)
- thompsongis (1)
Pull Request Authors
- giswqs (28)
- pre-commit-ci[bot] (14)
- dependabot[bot] (2)
- rafelafrance (1)
- TrellixVulnTeam (1)
- stephenwaltersNV5 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 1,338 last-month
- Total dependent packages: 0
- Total dependent repositories: 5
- Total versions: 35
- Total maintainers: 1
pypi.org: lidar
A Python package for delineating nested surface depressions in digital elevation data
- Homepage: https://github.com/opengeos/lidar
- Documentation: https://lidar.readthedocs.io/
- License: MIT license
-
Latest release: 0.8.4
published about 1 year ago
Rankings
Maintainers (1)
Dependencies
- Click >=6.0
- PySimpleGUI ==2.30.0
- matplotlib *
- numpy *
- pyshp *
- richdem *
- scikit-image *
- scipy *
- whitebox *
- Sphinx * development
- bumpversion * development
- coverage * development
- flake8 * development
- pip * development
- tox * development
- twine * development
- watchdog * development
- wheel * development
- x.strip *
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v2 composite
- conda-incubator/setup-miniconda v2 composite
- actions/cache v4 composite
- actions/checkout v4 composite
- conda-incubator/setup-miniconda v3 composite
- actions/cache v4 composite
- actions/checkout v4 composite
- conda-incubator/setup-miniconda v3 composite
- gdal
- imageio
- matplotlib
- numpy
- python 3.6.*
- scikit-image
- scipy

