Analyzing forest structure using aerial LiDAR data
Project description
PyForestScan: Airborne Point Cloud Analysis for Forest Structure
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.
- Airborne Data Compatibility: Supports LiDAR and Structure from Motion (SfM) data from drones and UAVs.
- Visualization: Create 2D and 3D visualizations of forest structures.
- Extensibility: Easily add custom filters and visualization techniques to suit your needs.
Installation
Install PyForestScan using pip:
pip install pyforestscan
Dependencies
[!IMPORTANT] You MUST have installed PDAL to use PyForestScan. If you use conda to install PDAL, make sure you install pyforestscan in the conda environment with PDAL. See https://pdal.io/en/latest/ for more information.
- PDAL >= 2.7
- Python >= 3.10
Quick Start
Derive Forest Metrics from Airborne Data
The following snipped shows how you can load a las file, create 25m by 25m by 5m voxels with points assigned to them, and generate plant area density at 5m layers and plant area index for each 25m grid cell before writing the resulting PAI layer to a geotiff.
from pyforestscan.handlers import read_lidar, create_geotiff
from pyforestscan.calculate import assign_voxels, calculate_pad, calculate_pai
arrays = read_lidar("path/to/lidar/file.las", "EPSG:32605", hag=True)
voxels, extent = assign_voxels(arrays[0], (25, 25, 5))
pad = calculate_pad(voxels, 5)
pai = calculate_pai(pad)
create_geotiff(pai, "output_pai.tiff", "EPSG:32605", extent)
Documentation
For detailed instructions and examples, visit our documentation.
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
-
Install the development dependencies:
pip install -r requirements-dev.txt
-
Run the tests using
pytest
: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:
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyforestscan-0.1.7.tar.gz
.
File metadata
- Download URL: pyforestscan-0.1.7.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a69dd1a34837821327f27fe18a71b33ff46a175b1cd7c45ec781c4d8419cd37d |
|
MD5 | e5f78d37dee174493301c8e4d2836550 |
|
BLAKE2b-256 | fc6633b5f701ab11c371c35cf45030a37ef91c601721a61edb8dedd26e52b0ba |
File details
Details for the file pyforestscan-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: pyforestscan-0.1.7-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdbc47e6a809e4decce5d847209ea0be8ff6f0104c94703dd4fb8b55b92312f9 |
|
MD5 | b5f2bdddd2af7f4cd1d2c4682586ab45 |
|
BLAKE2b-256 | e37e721ae0370c2409f2add37b24c701a0304ca726272fba20e9156fd939da61 |