-
Notifications
You must be signed in to change notification settings - Fork 154
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
Numpy 2.0 breaks opening of certain malformed tiffiles #260
Comments
Please provide a file to reproduce this issue. |
Oof, I guess I'll have to make one myself? Don't really know how to do that, but I guess I can try. I did link one but yeah, it is annoying to get access to |
Ok, I got it. https://drive.google.com/file/d/1gMDrYWQ4SgA9YUxiRcNmDMuY2F79_51k/view?usp=sharing With this file (when having numpy 2.0.0 installed, and not when having numpy 1.#.# installed), if I run this:
I get this exception:
|
Thanks. The next version of tifffile verifies that the value of the |
Fixed in v2024.6.18. |
Thank you so much!! :) |
I am using the geotiff library (which uses this library for reading the tif files) with this tif:
https://land.copernicus.eu/en/products/high-resolution-layer-tree-cover-density/tree-cover-density-2018
This file reports a type of "byte" (uint8) and has a nodata value of -999999999.
![image](https://private-user-images.githubusercontent.com/57900059/340730067-104b7ada-3703-4cf1-a4b2-61d8d9689784.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExMzc2MzYsIm5iZiI6MTcyMTEzNzMzNiwicGF0aCI6Ii81NzkwMDA1OS8zNDA3MzAwNjctMTA0YjdhZGEtMzcwMy00Y2YxLWE0YjItNjFkOGQ5Njg5Nzg0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE2VDEzNDIxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE0NWJkZmQ2NTk0MjU4MTI1ZWY1OTFhOWFiYmEwMDNmZTk4NmM0ODYwZmRlNDA3MGI0YTE2OWUxMDE5NTc1NmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.gSN4YuIiPvHQDG5ii7Eqqxt4Vwb3hDi0H0ifMuykSas)
Which is obviously impossible, so this .tif is malformed.
Thing is, it still opened just fine previously and I was able to work with it just fine.
However, with yesterday's release of Numpy 2.0, this tiffile now no longer opens, because it crashes inside the
zarr
library on this line:https://github.com/zarr-developers/zarr-python/blob/v3/src/zarr/v2/meta.py#L250
Numpy now makes sure that the dtype and the value are actually compatible. (which is probably a good thing)
I am not sure whether this is your problem, or theirs, or just a problem with the .tif file.
Either way, it is quite annoying, and it would be nice if there was maybe a way to override the nodata value, or some sort of special handling that makes sure the dtype and the nodata value are compatible, and if not, allows some way around that.
I have opened an equivalent issue on the zarr repository: zarr-developers/zarr-python#1981
Thanks for your time!
The text was updated successfully, but these errors were encountered: