Skip to content

Fix: gridA == gridB with equal lon but unequal lat now properly returns False - #1889

Merged
cmdupuis3 merged 1 commit into
mainfrom
sevans/fix-grid-eq-check-lon-and-lat
Nov 10, 2026
Merged

cmdupuis3 merged 1 commit into
mainfrom
sevans/fix-grid-eq-check-lon-and-lat

Conversation

@Sevans711

@Sevans711 Sevans711 commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1881

Overview

Fixes the underlying issue of Grid.__eq__ checking whether self.node_lon.equals(other.node_lon) or self.node_lat.equals(other.node_lat) by instead splitting this into a lon comparison check and lat comparison check. Two grids are only equal if they have equal node_lon and equal node_lat.

Added code for corresponding regression test into test/grid/grid/test_core.py's test_operators_ne, and confirmed locally that this test passes on this branch but fails on main.

PR Checklist

General

  • An issue is created and linked
  • Added appropriate labels (if your uxarray repo permissions allow it)
  • Filled out Overview and Expected Usage (if applicable) sections

Testing & Benchmarking

  • There is adequate test coverage of changes from this PR (add new tests if needed)
  • [N/A] If this PR could affect performance, ran ASV benchmarks and confirmed they show expected behavior (add a new benchmark if necessary)

Documentation and Examples

  • [N/A] Docstrings updated with any function changes, and included in all new functions
  • [N/A] User (public) functions added to docs/api.rst; internal (private) function names start with an underscore (_)
  • [N/A] If touched any notebook files, cleared the output of all cells before committing
  • [N/A] If added new notebook files, put into appropriate directories and referenced in appropriate files

AI Disclosure

AI Usage: GitHub Copilot's inline code suggestions were visible, I might have accepted some of them but I don't recall one way or another.

  • I have tested and take responsibility for all AI-generated content in my PR.

@Sevans711 Sevans711 added the bug Something isn't working label Nov 10, 2026
@Sevans711
Sevans711 marked this pull request as ready for review November 10, 2026 19:36

@dylannelson dylannelson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch! I ran into this confusion once before too like 2 months ago and wasn't sure what was going on. Glad to know there was a reason for it. Thanks for the quick and straightforward change! Works on my end and solves the issue

@cmdupuis3
cmdupuis3 merged commit 19a70e3 into main Nov 10, 2026
22 checks passed
@Sevans711
Sevans711 deleted the sevans/fix-grid-eq-check-lon-and-lat branch November 10, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grid equality checks for equal lon OR lat, instead of both

3 participants