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

Error in cog_info with rasterio 1.4.3 #299

Open
glostis opened this issue Dec 5, 2024 · 0 comments · May be fixed by #300
Open

Error in cog_info with rasterio 1.4.3 #299

glostis opened this issue Dec 5, 2024 · 0 comments · May be fixed by #300

Comments

@glostis
Copy link

glostis commented Dec 5, 2024

Hi,

I’ve noticed that some errors occur when installing rio-cogeo with rasterio 1.4.3 (released 3 days ago). The errors do not happen with rasterio 1.4.2.

Tests fail with the following errors:

FAILED tests/test_cogeo.py::test_cog_translate_valid - AttributeError: 'str' object has no attribute 'value'
...
    def _validate_translated_rgb_jpeg(src):
        assert src.height == 512
        assert src.width == 512
        assert src.meta["dtype"] == "uint8"
        assert all([(64, 64) == (h, w) for (h, w) in src.block_shapes])
        assert src.profile["blockxsize"] == 64
        assert src.profile["blockysize"] == 64
>       assert src.compression.value == "JPEG"
E       AttributeError: 'str' object has no attribute 'value'

The same error also occurs when calling cog_info() on a JPEG YCbCr GeoTIFF.

As far as I can tell, this is (at least) due to rasterio/rasterio#3259 in which a change is made where the compression attribute of a dataset is not necessarily an enum anymore, it can also be a string.
I’ve also noticed that, with rasterio 1.4.2, the compression value of a YCbCr JPEG compressed GeoTIFF is jpeg, whereas in rasterio 1.4.3 it is YCbCr JPEG.

I haven’t had time yet to implement a proper fix in rio-cogeo that is compatible both with rasterio 1.4.3 and with the previous versions, so I’m posting the issue here in case someone else wants to pick it up.

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

Successfully merging a pull request may close this issue.

1 participant