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

Replace usage of is_tiled with tests of block shapes #278

Merged
merged 7 commits into from
Jan 25, 2024

Conversation

sgillies
Copy link
Contributor

This future proofs rio-cogeo and makes it more strictly conforming to what the official GDAL COG checker does.

Background: rasterio/rasterio#3014.

@@ -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),
Copy link
Contributor Author

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.

rio_cogeo/cogeo.py Outdated Show resolved Hide resolved
@@ -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])
Copy link
Member

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

@vincentsarago
Copy link
Member

thanks @sgillies 🙏

really appreciate you putting time on this. Merci

@vincentsarago vincentsarago merged commit c321ab4 into cogeotiff:main Jan 25, 2024
5 checks passed
@sgillies sgillies deleted the patch-1 branch January 25, 2024 14:34
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 this pull request may close these issues.

2 participants