Skip to content

Conversation

@maawoo
Copy link
Contributor

@maawoo maawoo commented Jun 12, 2025

This adds two additional parameters to calculate_chm:

  • interp_valid_region: If True, calculates a valid region mask before interpolating.
  • interp_clean_edges: If True, performs additional edge cleaning after interpolation.

Example of how it currently looks without / with interpolation:

calculate_chm(arrays[0], (1,1,1), interpolation=None)

image

calculate_chm(arrays[0], (1,1,1), interpolation='linear')

image

Improvements to interpolation logic introduced in this PR:

calculate_chm(arrays[0], (1,1,1), interpolation='linear', interp_valid_region=True)

image

calculate_chm(arrays[0], (1,1,1), interpolation='linear', interp_valid_region=True, interp_clean_edges=True)

image

I currently don't have much time to test this with other data and also to add tests. But I thought it's a good idea to already leave it here as a PR 🙂

Copy link
Owner

@iosefa iosefa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maawoo thank you very much for the PR! I apologize it took so long for me to get to it. This looks great 🙏🏽 🚀 I will merge now. Thanks

@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2025

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

Codecov Report

Attention: Patch coverage is 51.61290% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pyforestscan/calculate.py 51.61% 15 Missing ⚠️

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

Files with missing lines Coverage Δ
pyforestscan/calculate.py 87.90% <51.61%> (-12.10%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@iosefa iosefa merged commit daa0142 into iosefa:main Jul 3, 2025
6 of 8 checks passed
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.

3 participants