-
Notifications
You must be signed in to change notification settings - Fork 44
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
Replace usage of is_tiled with tests of block shapes #278
Conversation
Replacement code matches GDAL usage.
Check block shapes instead of is_tiled
rio_cogeo/cogeo.py
Outdated
@@ -660,7 +660,7 @@ def cog_info( | |||
Bands=src_dst.count, | |||
Width=src_dst.width, | |||
Height=src_dst.height, | |||
Tiled=src_dst.is_tiled, | |||
Tiled=(src_dst.block_shapes[0][1] != src.width), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rasterio's is_tiled
is kind of a mess: https://github.com/rasterio/rasterio/blob/main/rasterio/_base.pyx#L1011-L1018. The new code here is all rio-cogeo needs and nothing more.
@@ -60,7 +60,7 @@ def _validate_translated_rgb_jpeg(src): | |||
assert src.height == 512 | |||
assert src.width == 512 | |||
assert src.meta["dtype"] == "uint8" | |||
assert src.is_tiled | |||
assert all([(64, 64) == (h, w) for (h, w) in src.block_shapes]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the profile use 64x64 blocksize
thanks @sgillies 🙏 really appreciate you putting time on this. Merci |
This future proofs rio-cogeo and makes it more strictly conforming to what the official GDAL COG checker does.
Background: rasterio/rasterio#3014.