You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I calculate the coverage based on a geometry and hand it over to the get_array_statistics method, I would expect that the valid_percent is calculated based on the coverage array instead of the bounding box of the geometry.
In this example valid_pixels is correctly calculated, but valid_percent is wrong:
2 valid pixels, because one pixel is nodata.
As the geometry includes three pixels, I would expect that valid_percent needs to be 66.67 %, instead it is 50 %.
From what I see in the code this line seems to be wrong, as it always calculates the valid_percent based on the full array size:
utils.py/get_array_statistics line 136
If I calculate the coverage based on a geometry and hand it over to the get_array_statistics method, I would expect that the valid_percent is calculated based on the coverage array instead of the bounding box of the geometry.
In this example valid_pixels is correctly calculated, but valid_percent is wrong:
Here is a full code running example:
From what I see in the code this line seems to be wrong, as it always calculates the valid_percent based on the full array size:
utils.py/get_array_statistics line 136
My suggestion to change it to:
Even if no coverage is handed over by the user the calculation is correct, because then it is created inside the method.
I would be happy to create a PR if you agree.
The text was updated successfully, but these errors were encountered: