geotiff: parity matrix harness scaffold (#1985)#2005
Merged
Conversation
brendancol
added a commit
that referenced
this pull request
May 17, 2026
Follow-up to review on PR #2005. - Wire a dask+numpy backend row so the matrix runs one real cross-backend cell from day one. The eager-numpy row stays as the self-check. - Builder signature is now ``(dir_path, target_path)``: the caller owns the cache-key filename and passes it to the builder. Removes the rename round-trip that papered over an underscored builder name vs a dashed cache key. - Sanitise ``/`` in ``fix_id`` so future fixture ids like ``stripped/int16/none`` (the convention in ``test_backend_pixel_parity_matrix_1813.py``) do not create subdirectories under the session tmp dir. - Fix the ``_wrap_2d`` docstring transform example. The actual read-back tuple for a height-H fixture is ``(1.0, 0.0, -0.5, 0.0, -1.0, H - 0.5)`` due to the PixelIsArea half-pixel offset that the writer round-trips.
brendancol
added a commit
that referenced
this pull request
May 17, 2026
Second review-pr pass on PR #2005 caught that ``_FixtureSpec.dtype`` was declared and documented but never read by ``assert_parity``. The only dtype check was reference-vs-actual inside ``_assert_pixels_equal``, which means a backend bug that uniformly upcasts in both the reference read and the backend read would not be caught. Assert ``actual.dtype == spec.dtype`` against the spec so a silent upcast that the reference also exhibits still fails the cell. Update the ``assert_parity`` docstring to match what the function actually does (dims/coords/transform vs reference; dtype, crs, nodata vs spec).
PR 1 of the issue #1985 plan. Adds xrspatial/geotiff/tests/test_backend_parity_matrix.py: a single parametrized harness that asserts pixel array, dtype, dims, coord values, transform tuple, CRS, nodata sentinel, masking state, and a small canonical-attrs subset for one (fixture, backend) cell at a time. Wired up end-to-end on one fixture (int16 single-band, no nodata, EPSG:4326) against one backend (eager numpy). The fixture list and backend list are module-level constants so follow-up PRs in the plan add a row each instead of editing the harness body. The "selected canonical attrs" subset and the masked_nodata assertion are gated on issues #1984 and #1988 respectively; both are stubbed so this PR does not depend on either landing.
Follow-up to review on PR #2005. - Wire a dask+numpy backend row so the matrix runs one real cross-backend cell from day one. The eager-numpy row stays as the self-check. - Builder signature is now ``(dir_path, target_path)``: the caller owns the cache-key filename and passes it to the builder. Removes the rename round-trip that papered over an underscored builder name vs a dashed cache key. - Sanitise ``/`` in ``fix_id`` so future fixture ids like ``stripped/int16/none`` (the convention in ``test_backend_pixel_parity_matrix_1813.py``) do not create subdirectories under the session tmp dir. - Fix the ``_wrap_2d`` docstring transform example. The actual read-back tuple for a height-H fixture is ``(1.0, 0.0, -0.5, 0.0, -1.0, H - 0.5)`` due to the PixelIsArea half-pixel offset that the writer round-trips.
Second review-pr pass on PR #2005 caught that ``_FixtureSpec.dtype`` was declared and documented but never read by ``assert_parity``. The only dtype check was reference-vs-actual inside ``_assert_pixels_equal``, which means a backend bug that uniformly upcasts in both the reference read and the backend read would not be caught. Assert ``actual.dtype == spec.dtype`` against the spec so a silent upcast that the reference also exhibits still fails the cell. Update the ``assert_parity`` docstring to match what the function actually does (dims/coords/transform vs reference; dtype, crs, nodata vs spec).
86d329c to
05e90ad
Compare
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
PR 1 of the issue #1985 plan. Adds a single parametrized harness for the
required backend parity matrix and wires it end-to-end on one
(fixture, backend) cell.
Module:
xrspatial/geotiff/tests/test_backend_parity_matrix.py. Each cellcalls one
assert_parityhelper that checks:crs_wktstringattrs.get('masked_nodata')), gated on issue geotiff: split declared nodata from masked-data state in DataArray attrs #1988raster_type,transform,crs,crs_wkt), gated on issue geotiff: define a public contract for DataArray attrs (canonical / alias / pass-through) #1984 PR 4Wired on one fixture (int16 single-band, no nodata, EPSG:4326) against
one backend (eager numpy). The
_FIXTURESand_BACKENDSlists aremodule-level so follow-up PRs add a row, not a function.
Scope of follow-ups
This is the scaffold from PR list item 1 in the issue. The rest of the
plan adds dtype variants, multi-band layouts, nodata variants,
no-georef and PixelIsPoint, COG overviews, plus the dask, GPU, dask+GPU,
HTTP, and VRT backends. None of those touch the harness itself.
The masked_nodata and canonical-attrs assertions are deliberately
permissive until issues #1984 PR 4 and #1988 land. Until then absence
is accepted; once those land the assertions tighten in a separate PR.
Test plan
pytest xrspatial/geotiff/tests/test_backend_parity_matrix.py -vpasses locallytest_backend_pixel_parity_matrix_1813.py,test_attrs_parity_1548.py) still pass with the new file present