From 8edf5556ccbb36133e768ddfc5b0c099345498e3 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Thu, 26 Feb 2026 17:18:57 -0500 Subject: [PATCH 1/3] fix: Support single-tile images --- src/async_geotiff/_geotiff.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/async_geotiff/_geotiff.py b/src/async_geotiff/_geotiff.py index 9e24ccb..d28adce 100644 --- a/src/async_geotiff/_geotiff.py +++ b/src/async_geotiff/_geotiff.py @@ -91,7 +91,7 @@ def __init__(self, tiff: TIFF) -> None: object.__setattr__(self, "_gkd", gkd) for ifd in tiff.ifds: - if ifd.tile_height is None or ifd.tile_width is None: + if ifd.strip_byte_counts is not None or ifd.strip_offsets is not None: raise ValueError("Only tiled GeoTIFFs are supported.") # Separate data IFDs and mask IFDs (skip the primary IFD at index 0) @@ -334,16 +334,14 @@ def shape(self) -> tuple[int, int]: @property def tile_height(self) -> int: """The height in pixels per tile of the image.""" - tile_height = self._ifd.tile_height - assert tile_height is not None, "Constructor validated that images are tiled" # noqa: S101 - return tile_height + # A TIFF with a single tile can omit tile_height + return self._ifd.tile_height or self._ifd.image_height @property def tile_width(self) -> int: """The width in pixels per tile of the image.""" - tile_width = self._ifd.tile_width - assert tile_width is not None, "Constructor validated that images are tiled" # noqa: S101 - return tile_width + # A TIFF with a single tile can omit tile_width + return self._ifd.tile_width or self._ifd.image_width @property def transform(self) -> Affine: From 677454457c73f8d59d23b5fbc20ffc8f791b4ab9 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Thu, 26 Feb 2026 17:19:25 -0500 Subject: [PATCH 2/3] update error --- src/async_geotiff/_geotiff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/async_geotiff/_geotiff.py b/src/async_geotiff/_geotiff.py index d28adce..a7ecd2e 100644 --- a/src/async_geotiff/_geotiff.py +++ b/src/async_geotiff/_geotiff.py @@ -92,7 +92,7 @@ def __init__(self, tiff: TIFF) -> None: for ifd in tiff.ifds: if ifd.strip_byte_counts is not None or ifd.strip_offsets is not None: - raise ValueError("Only tiled GeoTIFFs are supported.") + raise ValueError("Striped GeoTIFFs are not supported.") # Separate data IFDs and mask IFDs (skip the primary IFD at index 0) # Data IFDs are indexed by (width, height) for matching with masks From 2a1baa74969dedf5324368ea2aafeb98bf59cc1a Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Thu, 26 Feb 2026 17:19:52 -0500 Subject: [PATCH 3/3] update tile_count docstring --- src/async_geotiff/_tile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/async_geotiff/_tile.py b/src/async_geotiff/_tile.py index 2a20be2..f8780fe 100644 --- a/src/async_geotiff/_tile.py +++ b/src/async_geotiff/_tile.py @@ -49,7 +49,7 @@ def width(self) -> int: class TiledMixin: @property def tile_count(self: IsTiled) -> tuple[int, int]: - """The number of tiles in the x and y directions, if the image is tiled.""" + """The number of tiles in the x and y directions.""" return ( math.ceil(self.width / self.tile_width), math.ceil(self.height / self.tile_height),