Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #774: Use coverage array for calculation of valid_percent #775

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

MarcelCode
Copy link
Contributor

Summary
This PR updates the calculation of valid_percent in get_array_statistics. Previously, valid_percent was calculated by dividing the number of valid pixels by the total size of the array. Now, it uses the sum of nonzero values in the coverage array for more accurate results.

Why this change?
The previous method incorrectly calculated valid_percent when the coverage array was created using a geometry that wasn’t a simple rectangle. This change ensures the calculation properly reflects the valid area within the intended geometry.

Related Issue
See issue #774 for a detailed explanation of the problem and the motivation for this change.

@vincentsarago
Copy link
Member

@MarcelCode thanks for the PR 🙏

Because it's based on the master branch which has some breaking change (dropping python 3.8 support), If I wanted to release this change as is, I would need to publish a 7.3.0 version (minor version update), would this be fine for you?

I can backport this fix in a 7.2.3 if needed

@MarcelCode
Copy link
Contributor Author

I think a new minor version is fine. No need to backport.
I will pull the new version for our current projects, when it is done.

@vincentsarago vincentsarago merged commit ac4492d into cogeotiff:main Jan 6, 2025
8 checks passed
@vincentsarago
Copy link
Member

Thanks @MarcelCode
I'll wait a few days to see if we can get #764 merged before doing a new release

hope that's fine

@MarcelCode MarcelCode deleted the bugfix/issue-774 branch January 6, 2025 22:00
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.

2 participants