Skip to content

geotiff tests: consolidate coords cluster - #2455

Merged
brendancol merged 4 commits into
mainfrom
issue-2428
May 26, 2026
Merged

brendancol merged 4 commits into
mainfrom
issue-2428

Conversation

@brendancol

Copy link
Copy Markdown
Contributor

Closes #2428. Cluster 4 of long-tail epic #2424. Tests-only.

Summary

Fold seven top-level coord-edge-case files into the existing
xrspatial/geotiff/tests/read/test_coords.py:

  • test_coord_regularity_1720.py
  • test_coords_1813.py
  • test_coords_to_transform_3d_1643.py
  • test_int_coord_sentinel_2087.py
  • test_int_coords_round_trip_hotfix_1962.py
  • test_multi_tiepoint_validation_2117.py
  • test_rational_zero_denominator_2313.py

The boundary file test_non_uniform_coords_alias_2215.py also folds
cleanly because the alias resolution layers onto the same writer-side
_coords_to_transform validation already covered in section 5; it lands
in the same section rather than waiting for a follow-up.

Sections in the extended file

  1. coords_from_pixel_geometry / transform_tuple_from_pixel_geometry
    / coords_from_geo_info helpers.
  2. _extract_transform multi-tiepoint consistency.
  3. Zero-denominator RATIONAL / SRATIONAL rejection.
  4. Descending / ascending coord round trip (pre-existing from Epic: Consolidate the GeoTIFF test suite (354 files → ~50) #2390).
  5. _coords_to_transform writer-side validation: regularity (1D),
    3D (y, x, band) / (band, y, x), and alias-aware
    NonUniformCoordsError across y/x, lat/lon,
    latitude/longitude, row/col.
  6. Integer-coord round trip and the _NO_GEOREF_KEY marker.
    Integration sub-cluster gated on XRSPATIAL_RUN_INTEGRATION=1.

Audit

xrspatial/geotiff/tests/CLUSTER_AUDIT_COORDS.md maps every old
file::test to its new file::test_id. The audit file is deleted on a
final commit before merge.

Verification

  • pytest xrspatial/geotiff/tests/read/test_coords.py -v: 101 passed,
    2 skipped (integration-gated).
  • pytest xrspatial/geotiff/tests/ -x -q: 5817 passed, 68 skipped,
    2 xfailed.
  • find xrspatial/geotiff/tests -name 'test_*.py' | wc -l: 242
    (was 249; -7 deleted, +0 added because test_coords.py already
    existed).

Test plan

  • New read/test_coords.py passes on this checkout.
  • Full xrspatial/geotiff/tests/ suite passes.
  • CI green across numpy / cupy / dask+numpy / dask+cupy.
  • Audit file deleted on the pre-merge commit.

Fold seven top-level files into read/test_coords.py:

- test_coord_regularity_1720.py
- test_coords_1813.py
- test_coords_to_transform_3d_1643.py
- test_int_coord_sentinel_2087.py
- test_int_coords_round_trip_hotfix_1962.py
- test_multi_tiepoint_validation_2117.py
- test_rational_zero_denominator_2313.py

The boundary file test_non_uniform_coords_alias_2215.py also folds
cleanly because the alias resolution layers onto the same writer-side
_coords_to_transform validation already covered in section 5; it lands
in the same section.

Sections in the extended file:

1. coords_from_pixel_geometry / coords_from_geo_info helpers.
2. _extract_transform multi-tiepoint consistency.
3. Zero-denominator RATIONAL / SRATIONAL rejection.
4. Descending / ascending coord round trip (pre-existing from #2390).
5. _coords_to_transform writer-side validation: regularity, 3D layouts,
   and alias-aware NonUniformCoordsError.
6. Integer-coord round trip and the _NO_GEOREF_KEY marker. Integration
   sub-cluster gated on XRSPATIAL_RUN_INTEGRATION=1.

CLUSTER_AUDIT_COORDS.md maps every old file::test to its new
file::test_id. The audit file is deleted on a final commit before merge.

Cluster 4 of long-tail epic #2424. Tests-only -- no source changes.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 26, 2026

@brendancol brendancol left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: geotiff tests: consolidate coords cluster

Blockers

None.

Suggestions

None.

Nits

  • xrspatial/geotiff/tests/read/test_coords.py:68-78: the local _gpu_available() helper and _HAS_GPU constant duplicate the shared requires_gpu marker from ..conftest. The 3D-roundtrip GPU test could swap @pytest.mark.skipif(not _HAS_GPU, reason="cupy + CUDA required") for @requires_gpu and drop the local probe. The original test_coords_to_transform_3d_1643.py carried the same local helper, so this is a faithful fold; worth tidying in a follow-up.
  • xrspatial/geotiff/tests/read/test_coords.py:94-110: _make_da (float32 sequential) and _make_da_uint8 (uint8 zeros) sit next to each other and take the same (x_coords, y_coords) arg order. A one-line note in each docstring about which sections use which would save a reader from grepping.

What looks good

  • Test count parity verified: 103 collected before, 103 after. I checked out the prior commit and re-collected to confirm.
  • Full suite is 5817 passed, 68 skipped, 2 xfailed.
  • CLUSTER_AUDIT_COORDS.md maps every old file::test to its new id, including the parametrized variants. PR body says it gets deleted in a pre-merge commit.
  • Boundary call on test_non_uniform_coords_alias_2215.py was folded into section 5 instead of being deferred. The alias-resolution tests really do belong with the rest of the _coords_to_transform writer-side checks.
  • Sections are ordered low-level helpers first, then tiepoint, RATIONAL, round trip, writer validation, integer-coord marker. Easy to scan.
  • Integration cases stayed behind requires_integration.
  • No xrspatial/geotiff/ source touched.

Checklist

  • All consolidated tests pass on this checkout
  • Test count parity verified (103 = 103)
  • No source changes
  • Audit file present and complete
  • No pyflakes warnings
  • Stays in lane (read/test_coords.py)

- Drop the local _gpu_available()/_HAS_GPU pair in favour of the
  shared requires_gpu marker from _helpers/markers.py via conftest.
- Note in the shared-helpers comment which sections use _make_da
  (float32 sequential) vs _make_da_uint8 (uint8 zero).

@brendancol brendancol left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up after nit fixes (d707736)

Both nits from the previous pass are addressed in d707736:

  • The local _gpu_available() / _HAS_GPU pair is gone. test_write_geotiff_gpu_roundtrip_3d now uses @requires_gpu from _helpers/markers.py via the conftest re-export. importlib.util import dropped.
  • The shared-helpers block carries a comment explaining when to use _make_da (float32 sequential, for round-trip / orientation tests in section 4) versus _make_da_uint8 (uint8 zero, for the _coords_to_transform regularity checks in section 5).

Re-ran after the fixes:

  • pytest xrspatial/geotiff/tests/read/test_coords.py -q: 101 passed, 2 skipped.
  • pyflakes: clean.

No remaining blockers, suggestions, or nits.

@brendancol
brendancol merged commit f0e1cee into main May 26, 2026
7 checks passed
@brendancol
brendancol deleted the issue-2428 branch June 25, 2026 13:00
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.

Consolidation cluster 4: coords (long-tail epic #2424)

1 participant