Skip to content

Validate reproject input coordinate spacing#2204

Closed
puneetdixit200 wants to merge 1 commit into
xarray-contrib:mainfrom
puneetdixit200:fix/2184-reproject-coordinate-validation
Closed

Validate reproject input coordinate spacing#2204
puneetdixit200 wants to merge 1 commit into
xarray-contrib:mainfrom
puneetdixit200:fix/2184-reproject-coordinate-validation

Conversation

@puneetdixit200
Copy link
Copy Markdown

Summary

  • Validate reproject() and merge() input x/y coordinates before CRS resolution.
  • Reject non-monotonic axes and irregular spacing with axis-specific ValueError messages that include the worst step deviation.
  • Add regression coverage for irregular x coordinates, non-monotonic y coordinates, and merge inputs.

Closes #2184

Validation

  • uv run pytest -q xrspatial/tests/test_reproject.py::TestReproject::test_reproject_rejects_irregular_x_before_crs_resolution xrspatial/tests/test_reproject.py::TestReproject::test_reproject_rejects_non_monotonic_y xrspatial/tests/test_reproject.py::TestMerge::test_merge_rejects_irregular_input_coords
  • uv run pytest -q xrspatial/tests/test_reproject.py::TestReproject xrspatial/tests/test_reproject.py::TestMerge xrspatial/tests/test_reproject.py::TestMergeSameCrsYOrientation xrspatial/tests/test_reproject.py::TestMergeMixedNodata xrspatial/tests/test_reproject.py::TestMerge3DRejection
  • uv run pytest -q xrspatial/tests/test_reproject.py -k 'not test_vertical_crs_attr_is_epsg_int'
  • uv run python -m compileall -q xrspatial/reproject/__init__.py xrspatial/tests/test_reproject.py
  • git diff --check
  • Manual reproduction of the issue example for both reproject() and merge().

Notes:

  • The full uv run pytest -q xrspatial/tests/test_reproject.py run reached 277 passed / 18 skipped, then failed in TestVerticalShift::test_vertical_crs_attr_is_epsg_int because local Python SSL certificate verification failed while downloading geoid data from cdn.proj.org.
  • uv run flake8 xrspatial/reproject/__init__.py xrspatial/tests/test_reproject.py reports existing lint findings in those files; I left that unrelated cleanup out of this fix.

AI-assisted review

  • I ran the xarray-spatial AI-assisted review workflow for this PR.
  • I reviewed the review output myself and made my own judgment about what to accept.
  • I understand this change and can maintain it.
  • This PR does not attribute authorship to an AI tool or service.

Review notes:

  • The command-suite review checklist was applied to the diff.
  • No backend-specific implementation changed; validation runs before numpy, dask, or CuPy dispatch.
  • The only open concern from local verification is the unrelated SSL/download failure noted above.

@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 20, 2026
@puneetdixit200 puneetdixit200 marked this pull request as ready for review May 20, 2026 19:39
@brendancol
Copy link
Copy Markdown
Contributor

Hi @puneetdixit200, thanks for the PR!

Would you mind filing a quick New contributor introduction issue when you get a chance? It helps us point you at issues that fit what you'd like to work on. Most fields are optional.

Reviewing your PR doesn't depend on it, just a friendly nudge.

@brendancol
Copy link
Copy Markdown
Contributor

brendancol commented May 20, 2026

@puneetdixit200 thanks for the submission, but this a duplicate PR with #2192

Closing this PR for now, but would be happy to chat and help get you setup for contribution. With some of the AI assisted workflows, issues and PRs are created close together so it can be hard to jump into an issue as there is a decent possibility its already being worked on.

@brendancol brendancol closed this May 20, 2026
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.

reproject: irregular x/y coordinates accepted but interpreted as a regular grid

2 participants