Skip to content

Conversation

@iosefa
Copy link
Owner

@iosefa iosefa commented May 22, 2025

Changing the horizontal grid from 5 m to 25–30 m used to inflate mean PAD / PAI by > 200 %.

Root causes fixed here:

  • XY edges now anchor at xmin / ymax.
  • Correct cumulative-sum instead of simply reversing the Z stack.
  • 0–1 m PAD is set to NaN and excluded from PAI.

Main code changes

File Function Change
calculate.py assign_voxels • new XY bin anchor
• Y bins generated in descending order → final array still north-up
calculate_pad • new sky-first cumsum algorithm
• option drop_ground=True (default)
• removed old “reverse stack” logic
calculate_pai • now takes voxel_height (dz) and integrates using physical heights rather than raw indices
docstrings converted to Google-style; clarified arguments / returns

Behavioural impact

  • PAD / PAI are now almost invariant (< ± 5 %) across 5 m … 30 m grids (see tests).
  • Old results will change – see associated release notes.

@iosefa iosefa self-assigned this May 22, 2025
@iosefa iosefa requested a review from benleamon May 22, 2025 21:41
benleamon
benleamon previously approved these changes Jun 10, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jul 2, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 95.38462% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pyforestscan/process.py 25.00% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ
pyforestscan/calculate.py 87.39% <100.00%> (-0.51%) ⬇️
pyforestscan/filters.py 34.14% <ø> (ø)
pyforestscan/handlers.py 80.13% <ø> (ø)
pyforestscan/utils.py 83.33% <ø> (ø)
tests/test_calculate.py 100.00% <100.00%> (ø)
pyforestscan/process.py 46.34% <25.00%> (-0.77%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

iosefa added 6 commits July 2, 2025 19:41
Simplified voxel grid logic and improved robustness for handling spatial data points. Refactored PAD computation to eliminate redundant calculations and ensure better error handling. Enhanced PAI calculation to support height-based slicing with clearer parameterization.
Updated the docstring to use "Args" and "Returns" for better readability and consistency with standard Python practices. The changes streamline parameter and return value descriptions without altering functionality.
Added validation for voxel height and height ranges to ensure inputs are consistent. Updated `calculate_pad` and `calculate_pai` functions to improve error checks and fix nan handling. Refactored tests for increased coverage, addressing edge cases for PAD/PAI computations.
…clarity

Revised and standardized docstrings across key functions using the "Args" and "Returns" format for improved readability and consistency. Adjustments include clearer parameter definitions, better exception descriptions, and streamlined documentation for various modules (`filters.py`, `handlers.py`, `process.py`, etc.). Updated README to include documentation editing and publishing instructions, providing contributors with detailed steps for maintaining project docs.
Added a new GitHub Actions workflow to build and deploy project documentation using MkDocs. This includes installing MkDocs and necessary plugins, building the site, and deploying it to GitHub Pages.
Deleted the outdated `working-with-large-point-clouds.ipynb` tutorial from the documentation examples. The notebook content was no longer relevant and duplicated information available in other updated resources.
@iosefa iosefa force-pushed the bug/pad-calculation branch from 8c87585 to 80b10b8 Compare July 3, 2025 06:55
@iosefa iosefa requested review from benleamon and cankanoa July 3, 2025 06:56
@iosefa iosefa merged commit 3cac099 into main Jul 3, 2025
3 checks passed
@iosefa iosefa deleted the bug/pad-calculation branch July 3, 2025 07:04
@iosefa iosefa mentioned this pull request Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants