Skip to content

Merge coincident pole and antimeridian nodes in structured grids - #1690

Open
rajeeja wants to merge 2 commits into
mainfrom
rajeeja/structured-coincident-nodes
Open

Merge coincident pole and antimeridian nodes in structured grids#1690
rajeeja wants to merge 2 commits into
mainfrom
rajeeja/structured-coincident-nodes

Conversation

@rajeeja

@rajeeja rajeeja commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Closes #1689

  • _read_structured_grid matched nodes in the lon/lat plane, so the nlon+1 nodes at each pole and the two sides of the antimeridian were never merged.
  • Now matches in Cartesian space, so nodes that are the same point on the sphere collapse: 899 nodes at 1 deg, 3599 at 0.25 deg.
  • Merging leaves each polar quad with a repeated corner, so those faces are now stored as triangles padded with the fill value.
  • Pole valence is nlon as expected (36 at 10 deg, 360 at 1 deg) and V - E + F == 2 confirms a closed sphere.
  • Regional grids that touch neither pole nor the seam are unchanged.
  • Two regression tests added; the global one fails on main.

Match nodes in Cartesian space rather than the lon/lat plane so pole and
antimeridian nodes are recognized as the same point, and store the resulting
polar faces as triangles instead of quads with a repeated corner.
@rajeeja rajeeja self-assigned this Aug 19, 2026
@rajeeja

rajeeja commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Checked the docs and user guide for behavior changes: both datasets in user-guide/structured.ipynb are unaffected (air_temperature is regional, ersstv5 spans 0-358 deg so the seam never closes), and neither collapses a single node. Also fixed tol to stay in degrees rather than silently becoming a chord length, so the documented parameter keeps its meaning. Only grids that actually touch a pole or the antimeridian change.

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.

Grid.from_structured does not merge coincident pole and antimeridian nodes

1 participant