PyForestScan can build rasters from arbitrary point dimensions by combining:
calculate_voxel_statto aggregate values per XY cell.create_geotiffto write the result as a GeoTIFF.
This is useful for products like mean intensity, return count, median height-above-ground, and more.
from pyforestscan.handlers import read_lidar, create_geotiff
from pyforestscan.calculate import calculate_voxel_stat
file_path = "../example_data/20191210_5QKB020880.laz"
arrays = read_lidar(file_path, "EPSG:32605", hag=True)
# 1 m XY cells, 1 m vertical bins
voxel_resolution = (1.0, 1.0, 1.0)
mean_intensity, extent = calculate_voxel_stat(
arrays[0],
voxel_resolution=voxel_resolution,
dimension="Intensity",
stat="mean"
)
create_geotiff(
mean_intensity,
"../example_data/mean_intensity_1m.tif",
"EPSG:32605",
extent
)calculate_voxel_stat supports:
meansumcountminmaxmedianstd
Use z_index_range=(start, stop) to include only specific vertical bins (inclusive-exclusive index range).
subset_mean_intensity, extent = calculate_voxel_stat(
arrays[0],
voxel_resolution=(1.0, 1.0, 1.0),
dimension="Intensity",
stat="mean",
z_index_range=(2, 10) # use bins 2..9
)