PyForestScan

PyForestScan: A Python library for calculating forest structural metrics from lidar point cloud data - Published in JOSS (2025)

https://github.com/iosefa/pyforestscan

Science Score: 95.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 1 DOI reference(s) in JOSS metadata
  • Academic publication links
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

ecology forest-structure lidar point-cloud

Scientific Fields

Political Science Social Sciences - 90% confidence
Last synced: 4 months ago · JSON representation

Repository

A python package for calculating forest structural metrics from airborne point clouds.

Basic Info
Statistics
  • Stars: 62
  • Watchers: 3
  • Forks: 6
  • Open Issues: 3
  • Releases: 10
Topics
ecology forest-structure lidar point-cloud
Created over 2 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Code of conduct

README.md

PyForestScan: Airborne Point Cloud Analysis for Forest Structure

Binder PyPI Docker Pulls Contributors Tests Coverage PyPI Downloads

Calculate Forest Structural Metrics from lidar point clouds in Python

Height Above Ground

Overview

PyForestScan is a Python library designed for analyzing and visualizing forest structure using airborne 3D point cloud data. The library helps derive important forest metrics such as Canopy Height, Plant Area Index (PAI), Canopy Cover, Plant Area Density (PAD), and Foliage Height Diversity (FHD).

Features

  • Forest Metrics: Calculate and visualize key metrics like Canopy Height, PAI, PAD, and FHD.
  • Large Point Cloud Support: Utilizes efficient data formats such as EPT for large point cloud processing.
  • Visualization: Create 2D and 3D visualizations of forest structure and structural metrics
  • Extensibility: Easily add custom filters and visualization techniques to suit your needs.

Installation

Install PyForestScan using pip:

bash pip install pyforestscan

Dependencies

[!IMPORTANT] You MUST have installed both PDAL and GDAL to use PyForestScan. If you use conda to install PDAL, make sure you install pyforestscan in the conda environment with PDAL (and GDAL if using conda). See https://pdal.io/en/latest/ for more information on PDAL and https://gdal.org/en/stable/.

  • PDAL >= 2.7
  • GDAL >= 3.5
  • Python >= 3.11

Quick Start

Calculate, Export, and Plot Plant Area Index

The following snippet shows how you can load a las file, create 5m by 5m by 1m voxels with points assigned to them, and generate plant area density at 1m layers and plant area index for each 5m grid cell before writing the resulting PAI layer to a geotiff and plotting.

```python from pyforestscan.handlers import readlidar, creategeotiff from pyforestscan.calculate import assignvoxels, calculatepad, calculatepai from pyforestscan.visualize import plotmetric

arrays = readlidar("exampledata/201912105QKB020880.laz", "EPSG:32605", hag=True) voxelresolution = (5, 5, 1) voxels, extent = assignvoxels(arrays[0], voxelresolution) pad = calculatepad(voxels, voxelresolution[-1]) pai = calculatepai(pad) creategeotiff(pai, "outputpai.tiff", "EPSG:32605", extent) plotmetric('Plant Area Index', pai, extent, metricname='PAI', cmap='viridis', figsize=None) ```

Plant Area Index

Documentation

For detailed instructions and examples, visit our documentation.

Editing and Publishing Documentation

If you want to add new documentation or update existing docs for PyForestScan, follow these steps:

1. Editing Documentation

  • Documentation sources are typically found in the docs/ directory.
  • You can add new Markdown (.md) files or update existing ones as needed.
  • To add a new doc page, simply create a new file in the docs/ folder and link to it from the relevant index or summary page if needed.

2. Building and Viewing Docs Locally

PyForestScan uses a static site generator like MkDocs (or similar) for documentation.

  • Make sure you have the required dependencies listed in requirements-doc.txt.
  • Install dependencies if needed: bash pip install -r requirements-doc.txt
  • Build and serve the documentation locally: bash mkdocs serve
  • Visit http://127.0.0.1:8000 in your browser to preview your changes.

3. Publishing/Updating the Documentation

  • Once you are satisfied with your changes, commit and push them to your fork or branch: bash git add docs/ git commit -m "Update documentation" git push
  • Open a Pull Request (PR) if contributing to the main repository.

  • On merge to the main branch, documentation deployment is usually handled automatically (for example, via GitHub Actions or Read the Docs). Check the repositorys specific instructions or workflows if manual steps are required.

Tip: If you encounter issues with the docs build or deployment, refer to any Contributing Guidelines, mkdocs.yml configuration, or open an issue for help.

Developer Guides

To build locally and contribute to PyForestScan, you will need the following dependencies:

  • PDAL and Python PDAL bindings
  • GDAL
  • Python
  • Python requirements (requirements.txt and requirements-dev.txt)

Testing

PyForestScan uses pytest for running tests. To run the tests, you can follow the steps below:

Running Tests

  1. Install the development dependencies: bash pip install -r requirements-dev.txt

  2. Run the tests using pytest: bash pytest

This will run all the test cases under the tests/ directory. The tests include functionality checks for filters, forest metrics, and other core components of the PyForestScan library.

You can also run specific tests by passing the test file or function name: bash pytest tests/test_calculate.py

Contributing

We welcome contributions! Please check our Contributing Guidelines to get started.

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Owner

  • Name: Iosefa Percival
  • Login: iosefa
  • Kind: user

JOSS Publication

PyForestScan: A Python library for calculating forest structural metrics from lidar point cloud data
Published
February 07, 2025
Volume 10, Issue 106, Page 7314
Authors
Joseph Emile Honour Percival ORCID
Department of Geography & Environmental Science, University of Hawai‘i at Hilo, Hilo, HI 96720, USA, Spatial Data Analysis & Visualization Laboratory, University of Hawai‘i at Hilo, Hilo, HI 96720, USA
Benjamin Palsa Leamon ORCID
Independent Researcher, Japan
Editor
Mengqi Zhao ORCID
Tags
forest structure ecology lidar point clouds

GitHub Events

Total
  • Create event: 14
  • Release event: 8
  • Issues event: 21
  • Watch event: 45
  • Delete event: 10
  • Member event: 1
  • Issue comment event: 29
  • Push event: 69
  • Pull request review event: 7
  • Pull request event: 19
  • Fork event: 5
Last Year
  • Create event: 14
  • Release event: 8
  • Issues event: 21
  • Watch event: 45
  • Delete event: 10
  • Member event: 1
  • Issue comment event: 29
  • Push event: 69
  • Pull request review event: 7
  • Pull request event: 19
  • Fork event: 5

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 97
  • Total Committers: 3
  • Avg Commits per committer: 32.333
  • Development Distribution Score (DDS): 0.093
Past Year
  • Commits: 91
  • Committers: 3
  • Avg Commits per committer: 30.333
  • Development Distribution Score (DDS): 0.099
Top Committers
Name Email Commits
iosefa i****l@g****m 88
benleamon b****n@g****m 7
maawoo m****a@u****e 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 14
  • Total pull requests: 28
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 5 days
  • Total issue authors: 8
  • Total pull request authors: 2
  • Average comments per issue: 1.36
  • Average comments per pull request: 0.5
  • Merged pull requests: 26
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 14
  • Pull requests: 28
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 5 days
  • Issue authors: 8
  • Pull request authors: 2
  • Average comments per issue: 1.36
  • Average comments per pull request: 0.5
  • Merged pull requests: 26
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • iosefa (5)
  • giswqs (2)
  • npucino (2)
  • mengqi-z (2)
  • Cyclince (1)
  • MarkusZehner (1)
  • Ciaran1981 (1)
  • maawoo (1)
Pull Request Authors
  • iosefa (36)
  • maawoo (4)
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 100 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 15
  • Total maintainers: 1
pypi.org: pyforestscan

Analyzing forest structure using aerial LiDAR data

  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 100 Last month
Rankings
Dependent packages count: 7.4%
Forks count: 30.0%
Average: 36.3%
Stargazers count: 38.9%
Dependent repos count: 68.9%
Maintainers (1)
Last synced: 4 months ago

Dependencies

docs/requirements.txt pypi
  • sphinx *
  • sphinx_rtd_theme *
requirements.txt pypi
  • geopandas *
  • matplotlib *
  • mayavi *
  • numpy *
  • pandas *
  • pdal *
  • pyproj *
  • rasterio *
  • scipy *
  • setuptools *
  • shapely *
setup.py pypi
  • geopandas *
  • matplotlib *
  • mayavi *
  • numpy *
  • pandas *
  • pdal *
  • pyproj *
  • rasterio *
  • setuptools *
  • shapely *