Skip to content

geotiff: parity matrix harness scaffold (#1985)#2005

Merged
brendancol merged 3 commits into
mainfrom
1985-pr1-parity-matrix-harness
May 18, 2026
Merged

geotiff: parity matrix harness scaffold (#1985)#2005
brendancol merged 3 commits into
mainfrom
1985-pr1-parity-matrix-harness

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

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 cell
calls one assert_parity helper that checks:

Wired on one fixture (int16 single-band, no nodata, EPSG:4326) against
one backend (eager numpy). The _FIXTURES and _BACKENDS lists are
module-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 -v passes locally
  • Existing parity files (test_backend_pixel_parity_matrix_1813.py,
    test_attrs_parity_1548.py) still pass with the new file present

@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 17, 2026
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).
@brendancol brendancol force-pushed the 1985-pr1-parity-matrix-harness branch from 86d329c to 05e90ad Compare May 18, 2026 01:49
@brendancol brendancol merged commit d098e5a into main May 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant