Reason or Problem
Epic #2341 names "windowed reads return unshifted transforms" as a priority risk: a window that returns the file's full-extent transform but a small array is a footgun that downstream spatial functions silently trust. No release-gate test currently pins, for a representative set of files, that a windowed read returns (a) the correct shape, (b) coords that are a slice of the full-file coords, and (c) a transform whose origin matches the window's upper-left, not the file's upper-left.
Proposal
Add xrspatial/geotiff/tests/test_release_gate_windowed_reads_2341.py.
For each file in the representative corpus, for both eager (open_geotiff(..., window=...)) and dask (read_geotiff_dask(..., window=...)) read paths:
- Open the file with no window; record the full transform
T_full and full coords.
- Open the file with a window strictly interior to the raster (e.g.
Window(col_off=64, row_off=32, width=128, height=64)).
- Assert the returned shape equals the window's
(height, width).
- Assert
result.coords['x'] equals full.coords['x'][64:64+128] (and similar for y).
- Assert
result.attrs['transform'] equals T_full * Affine.translation(window.col_off, window.row_off) exactly — no float drift.
- Assert the seven release-attr keys other than
transform are unchanged.
Assertions inlined per-file (see PR 1 of 5 of epic #2341 for the pattern). Add a row to docs/source/reference/release_gate_geotiff.rst under "Local GeoTIFF read and write" citing the new file.
Stakeholders and Impacts
Touches one new test file. No production code change unless the test surfaces a real bug, in which case the bug fix is in scope for this PR.
Out of scope: overview/sidecar (PR 3), codec round-trip (PR 4), negative tests (PR 5).
Drawbacks
Some overlap with existing window tests under xrspatial/geotiff/tests/ (e.g. test_gpu_window_band_1605.py, test_http_stripped_window_max_pixels_issue_A_1842.py), but those focus on specific subsystems. This file is the single citation for the release-gate row.
Alternatives
- Use rasterio's window-math as the oracle. Rejected for the transform assertion: we want to lock the contract that the xrspatial transform exactly equals
T_full * translation(col_off, row_off), which is the spec, not whatever rasterio happens to do.
Additional Notes or Context
Parent epic: #2341. PR 2 of 5.
Reason or Problem
Epic #2341 names "windowed reads return unshifted transforms" as a priority risk: a window that returns the file's full-extent transform but a small array is a footgun that downstream spatial functions silently trust. No release-gate test currently pins, for a representative set of files, that a windowed read returns (a) the correct shape, (b) coords that are a slice of the full-file coords, and (c) a transform whose origin matches the window's upper-left, not the file's upper-left.
Proposal
Add
xrspatial/geotiff/tests/test_release_gate_windowed_reads_2341.py.For each file in the representative corpus, for both eager (
open_geotiff(..., window=...)) and dask (read_geotiff_dask(..., window=...)) read paths:T_fulland full coords.Window(col_off=64, row_off=32, width=128, height=64)).(height, width).result.coords['x']equalsfull.coords['x'][64:64+128](and similar fory).result.attrs['transform']equalsT_full * Affine.translation(window.col_off, window.row_off)exactly — no float drift.transformare unchanged.Assertions inlined per-file (see PR 1 of 5 of epic #2341 for the pattern). Add a row to
docs/source/reference/release_gate_geotiff.rstunder "Local GeoTIFF read and write" citing the new file.Stakeholders and Impacts
Touches one new test file. No production code change unless the test surfaces a real bug, in which case the bug fix is in scope for this PR.
Out of scope: overview/sidecar (PR 3), codec round-trip (PR 4), negative tests (PR 5).
Drawbacks
Some overlap with existing window tests under
xrspatial/geotiff/tests/(e.g.test_gpu_window_band_1605.py,test_http_stripped_window_max_pixels_issue_A_1842.py), but those focus on specific subsystems. This file is the single citation for the release-gate row.Alternatives
T_full * translation(col_off, row_off), which is the spec, not whatever rasterio happens to do.Additional Notes or Context
Parent epic: #2341. PR 2 of 5.