geotiff: fix stripped-GPU windowed coords on non-georef TIFFs (#1753)#1759
Open
brendancol wants to merge 1 commit into
Open
geotiff: fix stripped-GPU windowed coords on non-georef TIFFs (#1753)#1759brendancol wants to merge 1 commit into
brendancol wants to merge 1 commit into
Conversation
…h integer coords (xarray-contrib#1753) The eager numpy / dask / tiled-GPU paths already gate the windowed coord computation on geo_info.has_georef so a TIFF with no GeoTIFF tags returns int64 file-relative pixel coords (e.g. [2,3,4,5] for window=(2,3,6,7)). read_geotiff_gpu's stripped-fallback branch only checked t is None, which is never true for non-georef files (extract_transform returns a default unit GeoTransform with has_georef=False). The branch then synthesised float64 coords like [-0.5, -1.5, ...] from that placeholder, breaking backend parity on every stripped, non-georef windowed GPU read. Mirror the eager-numpy guard: when geo_info.has_georef is False, emit the same int64 file-relative coords every other backend produces. Use offset-based np.arange(r0, r1) instead of the previous length-based np.arange(r1 - r0) so the file-relative semantics match the eager and dask paths. Sweep-state row keyed to issue xarray-contrib#1753, severity HIGH, category 2. Co-authored-by: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes backend parity for windowed GPU reads of stripped, non-georeferenced TIFFs by ensuring the stripped-GPU fallback computes integer, file-relative pixel coordinates (matching eager NumPy, Dask, and tiled-GPU paths) instead of synthesizing float coords from the default placeholder GeoTransform.
Changes:
- Update
read_geotiff_gpustripped fallback to routehas_georef=False(andt is None) through the integer pixel-coordinate path using offset-basednp.arange(r0, r1)/np.arange(c0, c1). - Add regression tests covering non-zero-origin windowed GPU reads for non-georeferenced TIFFs, including ensuring no fabricated
attrs['transform']is emitted. - Refresh internal sweep metadata state entry for the tracked GeoTIFF issue.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
xrspatial/geotiff/__init__.py |
Fixes stripped-GPU windowed coordinate computation for non-georef TIFFs to return integer file-relative coords. |
xrspatial/geotiff/tests/test_no_georef_windowed_coords_1710.py |
Adds GPU regression tests for offset windows and verifies transform attr is not fabricated for non-georef reads. |
.claude/sweep-metadata-state.csv |
Updates internal audit/state tracking entry for issue #1753. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The eager numpy, dask, and tiled-GPU read paths all gate the windowed
coord computation on
geo_info.has_georefso a TIFF with no GeoTIFFtags returns
int64file-relative pixel coords.read_geotiff_gpu's stripped-fallback branch only checkedt is None,which is never true for non-georef files (
_extract_transformreturnsa default unit
GeoTransformwithhas_georef=False). The branchsynthesised
float64coords like[-0.5, -1.5, ...]from thatplaceholder, breaking backend parity on every stripped, non-georef
windowed GPU read.
The tiled-GPU helper
_gpu_apply_window_bandalready handles thiscorrectly; this PR brings the stripped branch in line.
Reproducer
Fix
read_geotiff_gpuline ~2727: routenot has_georef(and thepre-existing
t is Nonefailure mode) through the integer pixel-coordbranch, using offset-based
np.arange(r0, r1)so file-relativesemantics match the eager and dask paths.
Test plan
test_no_georef_windowed_coords_1710.pycover the GPU offset-window case and the no-transform-attr case
test_no_georef_windowed_coords_1710.pypasstest_attrs_parity_1548,test_metadata_round_trip_1484,test_dask_int_nodata_chunks_1597,test_coords_to_transform_3d_1643,test_gpu_nodata_1542,test_gpu_writer_attrs_1563,test_overview_nodata_inheritance_1739)numpy,cupy,dask+numpy,dask+cupy) on the stripped-non-georef-windowed caseResolves #1753.