You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to_geotiff(..., cog=True, tiled=False) returns successfully and writes a strip-layout TIFF. The COG spec requires a tiled internal layout, so the output is not a valid Cloud Optimized GeoTIFF even though the caller asked for one with cog=True.
The writer currently warns that tile_size is ignored under tiled=False, then writes strips via xrspatial/geotiff/_writer.py:477. The cog=True kwarg is silently dropped for the layout decision while the rest of the COG path (overviews, IFD ordering, etc.) still runs, so the file is a malformed hybrid.
This violates the stable COG contract that #2300 (commit 5e8bf9a) promoted.
To Reproduce
importnumpyasnpimportxarrayasxrfromxrspatial.geotiffimportto_geotiffda=xr.DataArray(np.zeros((256, 256), dtype=np.float32), dims=('y', 'x'))
to_geotiff(da, '/tmp/bad.tif', cog=True, tiled=False)
# Succeeds; produces a non-COG strip TIFF labelled as COG by intent.
Expected behavior
cog=True combined with tiled=False should raise ValueError at the public boundary with a message that names the violated constraint and tells the caller to either pass tiled=True or drop cog=True.
Defense in depth: raise from xrspatial/geotiff/_writer.py near line 477 if cog and not tiled ever reaches that path. This guards against future callers that bypass the public boundary.
Remove the now-dead "warn that tile_size is ignored when tiled=False under cog=True" branch. Under the new gate, cog=True implies tiled=True, so the warning would never fire on a cog=True call.
Add regression tests: one for the rejection (with message-substring matching, like the rows in test_cog_invalid_input_errors_2286.py), and one smoke test confirming the tiled COG path still works.
Describe the bug
to_geotiff(..., cog=True, tiled=False)returns successfully and writes a strip-layout TIFF. The COG spec requires a tiled internal layout, so the output is not a valid Cloud Optimized GeoTIFF even though the caller asked for one withcog=True.The writer currently warns that
tile_sizeis ignored undertiled=False, then writes strips viaxrspatial/geotiff/_writer.py:477. Thecog=Truekwarg is silently dropped for the layout decision while the rest of the COG path (overviews, IFD ordering, etc.) still runs, so the file is a malformed hybrid.This violates the stable COG contract that #2300 (commit 5e8bf9a) promoted.
To Reproduce
Expected behavior
cog=Truecombined withtiled=Falseshould raiseValueErrorat the public boundary with a message that names the violated constraint and tells the caller to either passtiled=Trueor dropcog=True.Fix shape
xrspatial/geotiff/_writers/eager.pynext to the existing validation block. Match the error-message style from PR Pin actionable failure modes for unsupported COG writer inputs (#2286 prod-ready wave B) #2301 / commit f5fbad5.xrspatial/geotiff/_writer.pynear line 477 ifcog and not tiledever reaches that path. This guards against future callers that bypass the public boundary.cog=Trueimpliestiled=True, so the warning would never fire on acog=Truecall.test_cog_invalid_input_errors_2286.py), and one smoke test confirming the tiled COG path still works.Additional context
Related PRs: