Skip to content

Fix coordinate metadata precedence for xarray axes - #4140

Open
ShianMike wants to merge 2 commits into
Unidata:mainfrom
ShianMike:fix/3860-coordinate-priority
Open

ShianMike wants to merge 2 commits into
Unidata:mainfrom
ShianMike:fix/3860-coordinate-priority

Conversation

@ShianMike

@ShianMike ShianMike commented Sep 25, 2026 •

Copy link
Copy Markdown

Summary

Fixes #3860. Coordinate identification now prefers CF and other coordinate metadata over the name matching fallback. A coordinate named latlike, lonlike, ylike, or xlike no longer makes a metadata identified latitude, longitude, y, or x axis ambiguous.

The name fallback remains available when an axis has no metadata identified coordinate. One dimensional latitude and longitude coordinates still serve as y and x when separate geometric axes are absent.

Verification

  • Refreshed the branch against upstream main (5edfa018) in 0ca3e347. With xarray 2026.9.0 on Windows, tests/test_xarray.py had 257 passes on the refreshed branch and 254 on clean main. The same four dataset attribute tests failed on both trees. The three coordinate regression cases added by this PR passed.
  • Added the exact gridded coordinate reproduction from Coordinate identification for 2d latitude/longitude fails in presence of similarly named auxilliary variables #3860 and a self contained variant. The new regression test failed before the fix and passes with it.
  • tests/test_xarray.py: 246 passed, 11 skipped, 4 deselected.
  • Ruff passed for both changed files.
  • Four dataset attribute tests fail unchanged on upstream main with Python 3.14 and xarray 2025.11.0. I confirmed those four failures in a separate clean worktree at 07df928b0; they are unrelated to coordinate identification.

Hosted CI status

The results below are from the September 25 runs on ad69ba79. GitHub has started a new set of checks against current main at 0ca3e347.

  • Passing: PyPI tests on Python 3.11–3.14 (including minimum and no-extras jobs), Conda tests on Windows 3.11/3.13/3.14, Conda docs on macOS and Windows, Linux docs on Python 3.13, lint, CodeQL, coverage checks, and CLA.
  • Failing: Linux docs on Python 3.11/3.12/3.14 because the existing examples/remote/basic.py live GOES lookup raises ValueError: No result found for <current time>.
  • Failing: Conda tests on macOS 3.11/3.12/3.14 in existing plotting tests, starting with RuntimeWarning: invalid value encountered in create_collection and followed by open-figure warnings. No plotting or remote-example files are changed in this PR.

@ShianMike
ShianMike requested a review from a team as a code owner September 25, 2026 07:00
@ShianMike
ShianMike requested review from dopplershift and removed request for a team September 25, 2026 07:00
@CLAassistant

CLAassistant commented Sep 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coordinate identification for 2d latitude/longitude fails in presence of similarly named auxilliary variables

2 participants