Commit f0a09c0
authored
* Block write_geotiff_gpu(file_like, cog=True) for parity with to_geotiff (#1652)
to_geotiff has long rejected cog=True + file-like destinations, but the
explicit write_geotiff_gpu entry point silently accepted the combo and
emitted a COG into the buffer. The two writers should agree on which
inputs they refuse: to_geotiff(gpu=True, cog=True, path=BytesIO) raises,
so write_geotiff_gpu(da, BytesIO, cog=True) should too.
Mirror the existing to_geotiff guard on the GPU entry point. Non-cog
file-like writes remain supported on this path (the gate is targeted at
cog=True only). Add regression coverage in test_bytesio_source.py.
Also clarify the path/compression docstring on write_geotiff_gpu:
- path: document that file-like destinations are accepted (cog=True
requires a string path).
- compression: list the full codec set the function actually accepts
and note the deliberate JPEG asymmetry with to_geotiff (#1651
downgraded to docs-only after PR #1647 confirmed advanced-API
intent).
Update .claude/sweep-api-consistency-state.csv with the 2026-05-11
re-audit row.
* Address Copilot review feedback on #1653
- Mirror to_geotiff's cog=True + file-like rejection verbatim (same
error string), so callers see identical messages from either entry
point. Previously write_geotiff_gpu raised a different message that
added "...on the GPU writer..." and dropped the BytesIO hint.
- Add a TypeError gate for non-str, non-file-like path arguments, so
passing e.g. an int falls through to a clear TypeError instead of an
os.path / unicode error deep in the writer. Mirrors to_geotiff's
existing TypeError verbatim.
- Harden the BytesIO + write_geotiff_gpu tests with the repo's standard
_gpu_available() helper (cupy.cuda.is_available() + ImportError
guard) instead of pytest.importorskip('cupy'), so CI hosts where
CuPy imports but CUDA is unavailable skip cleanly rather than
hard-failing in cupy.asarray().
- Add two new regression tests: one pinning byte-for-byte parity of the
cog/file-like error message between the two writers, and one pinning
the new TypeError on invalid path types.
Skip: the low-confidence type annotation suggestion (path:
str|os.PathLike|SupportsWrite[bytes]). The other path-accepting
functions in this module (to_geotiff, write_vrt, etc.) deliberately
leave path untyped; adding a precise union here would diverge from the
local convention for marginal benefit.
All 17 tests in test_bytesio_source.py pass.
1 parent 181056e commit f0a09c0
3 files changed
Lines changed: 142 additions & 3 deletions
File tree
- .claude
- xrspatial/geotiff
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2714 | 2714 | | |
2715 | 2715 | | |
2716 | 2716 | | |
2717 | | - | |
| 2717 | + | |
2718 | 2718 | | |
2719 | 2719 | | |
2720 | 2720 | | |
| |||
2747 | 2747 | | |
2748 | 2748 | | |
2749 | 2749 | | |
2750 | | - | |
2751 | | - | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
2752 | 2756 | | |
2753 | 2757 | | |
2754 | 2758 | | |
| |||
2837 | 2841 | | |
2838 | 2842 | | |
2839 | 2843 | | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
2840 | 2861 | | |
2841 | 2862 | | |
2842 | 2863 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
20 | 41 | | |
21 | 42 | | |
22 | 43 | | |
| |||
268 | 289 | | |
269 | 290 | | |
270 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
0 commit comments