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

reconsider GetStatistics effects #1153

Open
banesullivan opened this issue May 8, 2023 · 0 comments
Open

reconsider GetStatistics effects #1153

banesullivan opened this issue May 8, 2023 · 0 comments

Comments

@banesullivan
Copy link
Contributor

GetStatistics() with GDAL currently uses bApproxOK=True and bForce=True. We should evaluate if these are the best choices (see https://gdal.org/doxygen/classGDALRasterBand.html#a6aa58b6f0a0c17722b9bf763a96ff069)

stats = band.GetStatistics(True, True)

This is yielding different results than rasterio's default statistics() methods and gives the wrong max value for rgb_geotiff.tiff specifically which is set in the unit tests:

assert tileMetadata['bands'][2]['max'] == 212.0

The true max value for this file is 240, not 212. Setting bApproxOK=False gives the correct value of 240.

I think we probably want to dynamically choose bApproxOK based on the overall size of the image. If its smaller than some threshold, use bApproxOK=False to get the true value and if it's over some threshold, use bApproxOK=True for efficiency.

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

No branches or pull requests

1 participant