Cover read_vrt GPU/dask+GPU paths and a few VRT parameter combos (#1619)#1620
Merged
Merged
Conversation
Sweep 3 of the geotiff deep-sweep test-coverage pass (2026-05-11). The prior two same-day passes (#1565, #1586, #1596) closed dask streaming codec coverage and the specific accuracy bugs that surfaced. This file closes the remaining backend-coverage holes: * ``read_vrt(gpu=True)`` returns cupy (no prior test). * ``read_vrt(gpu=True, chunks=N)`` returns dask Array with cupy ``_meta`` and the requested chunk shape (no prior test). * ``open_geotiff('.vrt', gpu=True[, chunks=N])`` routes through ``read_vrt`` and surfaces cupy data unchanged. * ``read_vrt(dtype='float64')`` safe widening; ``dtype='int32'`` rejected for a float source (mirrors the ``open_geotiff`` gate). * ``read_vrt(name='custom')`` override; default-from-stem fallback. * ``open_geotiff(BytesIO, gpu=True)`` and ``open_geotiff(BytesIO, chunks=N)`` raise ``ValueError`` -- the file-like rejection branches were unreached by any prior test. 11 new tests, all passing locally on a CUDA host. GPU tests use the same cupy availability skip predicate as the rest of the geotiff suite, so non-GPU CI cleanly skips them. Test-only change. State CSV updated to record sweep 3 outcome. Refs #1619.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds missing test coverage for the GeoTIFF VRT read path’s backend matrix (CPU/GPU/Dask+Dask+GPU) and a few read_vrt / open_geotiff parameter behaviors, aligning VRT coverage with the rest of the geotiff reader backends.
Changes:
- Adds a new test module covering
read_vrt(gpu=True),read_vrt(gpu=True, chunks=...), andopen_geotiff(...'.vrt'..., gpu/chunks)dispatch behavior. - Adds tests for
read_vrt(dtype=...)(safe widening + float→int rejection) andread_vrt(name=...)(override + default-from-stem). - Updates the deep-sweep state CSV to record the new VRT coverage sweep.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
xrspatial/geotiff/tests/test_vrt_backend_coverage_2026_05_11.py |
New tests to cover VRT GPU and dask+GPU paths plus dtype/name and file-like rejection cases. |
.claude/sweep-test-coverage-state.csv |
Records sweep-3 state update for geotiff VRT backend/parameter coverage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| import numpy as np | ||
| import pytest | ||
| import xarray as xr |
Comment on lines
+40
to
+52
| def _cuda_available() -> bool: | ||
| if importlib.util.find_spec("cupy") is None: | ||
| return False | ||
| try: | ||
| import cupy | ||
| return bool(cupy.cuda.is_available()) | ||
| except Exception: | ||
| return False | ||
|
|
||
|
|
||
| _HAS_CUDA = _cuda_available() | ||
| _gpu_only = pytest.mark.skipif(not _HAS_CUDA, reason="cupy + CUDA required") | ||
|
|
- Remove unused xarray import. - Rename _cuda_available / _HAS_CUDA to _gpu_available / _HAS_GPU so the GPU skip predicate matches the rest of the geotiff test suite (test_backend_kwarg_parity_1561, test_attrs_parity_1548, and the 18 other test files use this name).
This was referenced May 11, 2026
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
Closes the remaining VRT backend-coverage holes from the geotiff deep-sweep:
read_vrt(gpu=True)andread_vrt(gpu=True, chunks=N)pinned: cupy data, cupy_metaon the dask wrap, requested chunk shape preserved.open_geotiff('.vrt', gpu=True[, chunks=N])dispatch covered.read_vrt(dtype=)widening + float-to-int rejection.read_vrt(name=)override + default-from-stem.open_geotiff(BytesIO, gpu=True)andopen_geotiff(BytesIO, chunks=N)error paths.Test-only change. 11 new tests, all passing on a CUDA host. GPU tests skip cleanly when cupy/CUDA are absent.
Refs #1619. Sweep 3 of the same-day geotiff test-coverage deep-sweep (after #1565, #1586, #1596).
Test plan
pytest xrspatial/geotiff/tests/test_vrt_backend_coverage_2026_05_11.py -v-- 11 passed).pytest xrspatial/geotiff/tests/-- 1211 passed, 7 deselected for a pre-existing matplotlib palette failure unrelated to this PR).