SkillAgentSearch skills...

Lidar

A Python package for delineating nested surface depressions from digital elevation data.

Install / Use

/learn @opengeos/Lidar

README

Welcome to the lidar package

Open In Colab image image image image image image image image DOI

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.

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

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:

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:

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:

pip install -U lidar

If you use conda, you can update lidar to the latest version by running the following command in your terminal:

mamba update -c conda-forge lidar

To install the development version from GitHub directly using Git, run the following code:

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).

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.

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.

sudo pacman -S yaourt --noconfirm
yaourt -S gdal --noconfirm
yaourt -S python-gdal --noconfirm

macOS

For a Homebrew based Python environment, do the following.

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

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.

View on GitHub
GitHub Stars297
CategoryDevelopment
Updated1mo ago
Forks63

Languages

Python

Security Score

100/100

Audited on Feb 22, 2026

No findings