Forward VRT kwargs from read_geotiff_dask#1805
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the GeoTIFF Dask reader’s .vrt fast-path so that direct read_geotiff_dask(<something>.vrt, ...) calls no longer drop important keyword arguments. It ensures VRT reads behave consistently with non-VRT reads when callers specify windowing, band selection, or pixel caps.
Changes:
- Forward
window,band, andmax_pixelsfromread_geotiff_dask()toread_vrt()when the source is a.vrt. - Add regression tests to validate that direct
.vrtreads respectwindow/bandand enforcemax_pixels.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
xrspatial/geotiff/__init__.py |
Forwards VRT-relevant kwargs in the .vrt early-return branch of read_geotiff_dask. |
xrspatial/geotiff/tests/test_read_geotiff_dask_vrt_kwargs_1797.py |
Adds tests covering window/band forwarding and max_pixels enforcement for direct .vrt reads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
2151
to
+2160
| # ``open_geotiff`` already routes ``.vrt`` to ``read_vrt`` before | ||
| # reaching here, so this branch is only hit when ``read_geotiff_dask`` | ||
| # is called directly with a VRT path. Keep it as a defensive fallback | ||
| # rather than letting the windowed-read path try to parse VRT XML as | ||
| # TIFF bytes. ``read_vrt`` is the single source of truth for VRT. | ||
| if isinstance(source, str) and source.lower().endswith('.vrt'): | ||
| return read_vrt(source, dtype=dtype, name=name, chunks=chunks) | ||
| return read_vrt( | ||
| source, dtype=dtype, window=window, band=band, name=name, | ||
| chunks=chunks, max_pixels=max_pixels, | ||
| ) |
brendancol
added a commit
that referenced
this pull request
May 13, 2026
Resolves conflict in xrspatial/geotiff/__init__.py: keeps the `_read_vrt_dask` dispatch hook from the PR branch. All other geotiff changes from main (#1791, #1793, #1801, #1802, #1803, #1804, #1805, #1806) were already integrated into the working tree by the prior 7329dd9 commit; this merge just records the parent so git recognises the reconciliation.
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.
Closes #1795.
For direct read_geotiff_dask calls on .vrt sources, forwards window, band, and max_pixels to read_vrt instead of silently dropping them.
Tested: pytest xrspatial/geotiff/tests/test_read_geotiff_dask_vrt_kwargs_1795.py