Skip to content

Grid.from_structured does not merge coincident pole and antimeridian nodes #1689

Description

@rajeeja
  • _read_structured_grid builds its KDTree on raw (lon, lat) pairs, so nodes that are the same point on the sphere are never merged.
  • At the pole all nlon+1 nodes sit at lat=90 with distinct lons; at the seam -180.5 and 179.5 differ by exactly 360.
  • Result: n_node is exactly (nlon+1)*(nlat+1), zero merges. 899 nodes should collapse at 1 deg, 3599 at 0.25 deg.
  • The mesh is topologically torn: the pole node should have valence nlon (360 at 1 deg, 1440 at 0.25 deg) but reports 4.
  • Only affects the native to_rectilinear backend; YAC uses reg_2d_new with a cyclic flag and never enumerates nodes.
  • Fix: merge in Cartesian space inside _read_structured_grid.
  • Related to Handling Duplicate Node Indices  #865, which raises the same pole/antimeridian concern for duplicate nodes generally.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status
👀 In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions