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

Mismatch between actual minimum pixel value and statistics minimum #788

Open
phargogh opened this issue Mar 8, 2025 · 0 comments
Open

Comments

@phargogh
Copy link

phargogh commented Mar 8, 2025

Greetings! I have a TiTiler instance (which of course is using rio-tiler under the hood), and I have a COG (https://storage.googleapis.com/natcap-data-cache/global/landscan-pop/landscan_2023.tif) that I am attempting to render tiles for. The problem is that rio-tiler appears to be incorrectly reporting the minimum pixel value.

When I inspect the raster with gdalinfo, I see the correct minimum value (0), and the raster's nodata value is correctly stated as well (2147483647.0). gdalinfo https://storage.googleapis.com/natcap-data-cache/global/landscan-pop/landscan_2023.tif will demonstrate this.

And when I download the file and read in the raster with GDAL, I can see that the minimum pixel value matches the nodata value:

>>> from osgeo import gdal
>>> gdal.Open('landscan_2023.tif').ReadAsArray().min()
-2147483647

However, when I use rio-tiler to get statistics, the minimum value is incorrectly stated:

>>> from rio_tiler.io import Reader
>>> Reader('https://storage.googleapis.com/natcap-data-cache/global/landscan-pop/landscan_2023.tif').statistics()['b1'].min
-2147483648.0

Because of this mismatch between the nodata value and the rio-tiler-identified pixel minimum, the rest of the percentile breaks are being incorrectly identified.

Any suggestions? Thanks!

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