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

GDAL 3.7 changes behavior for signed bytes #329

Closed
phargogh opened this issue Jul 20, 2023 · 2 comments · Fixed by #353
Closed

GDAL 3.7 changes behavior for signed bytes #329

phargogh opened this issue Jul 20, 2023 · 2 comments · Fixed by #353
Labels
bug Something isn't working

Comments

@phargogh
Copy link
Member

Per the GDAL docs:

PIXELTYPE: This may appear on a GDT_Byte band (or the corresponding dataset) and have the value SIGNEDBYTE to indicate the unsigned byte values between 128 and 255 should be interpreted as being values between -128 and -1 for applications that recognise the SIGNEDBYTE type. Starting with GDAL 3.7, this metadata item is no longer used, as the Int8 data type is used for signed bytes.

It is not immediately clear to me if that means that the SIGNEDBYTE flag will be ignored entirely or if we should expect pygeoprocessing to handle both cases. We should investigate this behavior and make a decision on how to handle this. Until we do, signed integer raster operations in GDAL 3.7+ may have unexpected behavior.

@phargogh phargogh added the bug Something isn't working label Jul 20, 2023
@phargogh phargogh added this to the 2.4.1 milestone Aug 1, 2023
@phargogh phargogh removed this from the 2.4.1 milestone Aug 29, 2023
@dcdenu4
Copy link
Member

dcdenu4 commented Sep 6, 2023

Can confirm that GDAL 3.7+ has changed behavior and causes tests to fail. GDT_Int8, added in 3.7, has a constant representation of 14. This is attempting to be mapped to _GDAL_TYPE_TO_NUMPY_LOOKUP, which does not include it.

@dcdenu4
Copy link
Member

dcdenu4 commented Sep 6, 2023

Also seeing an assertion error which looks like a nodata change

FAILED tests/test_geoprocessing.py::TestGeoprocessing::test_new_raster_from_base_nodata_not_set - KeyError: 14
FAILED tests/test_geoprocessing.py::TestGeoprocessing::test_new_raster_from_base_unsigned_byte - AssertionError: 255 != -1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants