Commit 595ece8
authored
* Fix write_vrt and write_geotiff_gpu signature/docstring drift vs to_geotiff (#1631)
Three API-consistency drifts surfaced by the sweep on 2026-05-11:
1. write_vrt used **kwargs even though the docstring listed three
accepted kwargs (relative, crs_wkt, nodata). inspect.signature, IDE
autocomplete, and mypy --strict could not see them. Replaced with an
explicit signature that mirrors _vrt.write_vrt and forwards each
kwarg by name. A typo'd kwarg now raises TypeError from the public
wrapper rather than from deep inside the internal helper.
2. write_geotiff_gpu's overview_resampling docstring omitted 'cubic'.
to_geotiff lists it; the underlying make_overview_gpu accepts it
(falls back to CPU for parity with the CPU writer). Updated the
docstring to match.
3. write_geotiff_gpu(data) was untyped while to_geotiff(data) was
annotated xr.DataArray | np.ndarray. Added xr.DataArray |
cupy.ndarray for parity. Annotation is a forward reference under
the module's `from __future__ import annotations`, so cupy stays
lazily imported at function-body level.
Regression test: xrspatial/geotiff/tests/test_signature_parity_1631.py
pins each guarantee. inspect.signature parity, unknown-kwarg rejection
at the public wrapper, cubic-resampling round-trip on the GPU writer.
* Update sweep-api-consistency-state for geotiff (#1631)
* Address Copilot review on #1633
- test_signature_parity_1631.py: replace dead `skipif(... if False else False)`
decorator with the suite's standard cupy+CUDA skip pattern
(`_gpu_available()` helper + `_gpu_only` marker with reason
`"cupy + CUDA required"`), matching `test_dask_cupy_combined.py`,
`test_gpu_window_band_1605.py`, etc.
- __init__.py: widen write_geotiff_gpu `data` annotation to include
np.ndarray (matches `cupy.asarray(np.asarray(data))` runtime behavior
and `to_geotiff(data: xr.DataArray | np.ndarray, ...)` parity);
sync the `data:` docstring line and note the upload step.
- Strengthen the type-hint test to also assert `ndarray` is present
in the annotation so the numpy parity widen is pinned against
future drift.
* Fix Windows tempfile cleanup PermissionError in test_signature_parity
Replace tempfile.TemporaryDirectory with pytest's tmp_path fixture.
write_vrt holds an mmap handle on its source GeoTIFF, which Windows
refuses to delete during TemporaryDirectory.__exit__. pytest's
tmp_path cleanup uses ignore_errors=True, so the same handle quirk
no longer breaks the test.
Removes unused tempfile import.
1 parent 69a75da commit 595ece8
3 files changed
Lines changed: 192 additions & 12 deletions
File tree
- .claude
- xrspatial/geotiff
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2672 | 2672 | | |
2673 | 2673 | | |
2674 | 2674 | | |
2675 | | - | |
| 2675 | + | |
| 2676 | + | |
2676 | 2677 | | |
2677 | 2678 | | |
2678 | 2679 | | |
| |||
2701 | 2702 | | |
2702 | 2703 | | |
2703 | 2704 | | |
2704 | | - | |
2705 | | - | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
2706 | 2709 | | |
2707 | 2710 | | |
2708 | 2711 | | |
| |||
2735 | 2738 | | |
2736 | 2739 | | |
2737 | 2740 | | |
2738 | | - | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
2739 | 2745 | | |
2740 | 2746 | | |
2741 | 2747 | | |
| |||
3196 | 3202 | | |
3197 | 3203 | | |
3198 | 3204 | | |
3199 | | - | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
3200 | 3209 | | |
3201 | 3210 | | |
3202 | 3211 | | |
| |||
3217 | 3226 | | |
3218 | 3227 | | |
3219 | 3228 | | |
3220 | | - | |
3221 | | - | |
3222 | | - | |
3223 | | - | |
3224 | | - | |
3225 | 3229 | | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
3226 | 3234 | | |
3227 | | - | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
3228 | 3241 | | |
3229 | 3242 | | |
3230 | 3243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
0 commit comments