Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MeshCoord should support a coordinate system #5562

Closed
pp-mo opened this issue Nov 1, 2023 · 1 comment · Fixed by #6016
Closed

MeshCoord should support a coordinate system #5562

pp-mo opened this issue Nov 1, 2023 · 1 comment · Fixed by #6016
Assignees

Comments

@pp-mo
Copy link
Member

pp-mo commented Nov 1, 2023

On general principles, since a MeshCoord is designed to be a "window" on other data, it should probably "have" the coord-system of the underlying coordinates from which it takes its values + metadata.

context in UGRID

At present, there is no agreed way of attaching a coordinate-system (i.e. grid-mapping) to coordinates of a mesh, since in CF that may only occur via a data-variable.

context in Iris

However, Iris considers the coord-system to be part of a Coord. So, it should make perfectly good sense for a coordinate of a Mesh to have one (though there is currently an apparent bug preventing it).
Likewise, it probably makes sense for the coord-system of a MeshCoord to always follow that of the associated node coordinates, as established for the other metadata.

Desired implementation:

Since a face- or edge-located MeshCoord takes its bounds from the (re-indexed) node_coordinates, and its points from the face_coordinates or edge_coordinates (which however are technically optional), it makes sense that the MeshCoord should inherit a coord_system from either of those -- and if different, that should probably be an error.
For now, the coord_system of a MeshCoord is always None, and must always be so.

Related

@pp-mo pp-mo changed the title MeshCoord should report a coordinate system MeshCoord should support a coordinate system Nov 1, 2023
@trexfeathers
Copy link
Contributor

trexfeathers commented Jun 6, 2024

We expect that in many cases UGRID files will be loaded with no coordinate systems, since there is little detail about grid_mapping in relation to UGRID. There is some debate between Iris developers about whether we should assume a standard GeogCS coordinate system in these cases, since that appears to be UGRID's assumption.

However UGRID is flexible enough that coordinates could really be anything - XY / XYZ / spherical coordinates / S2 indices / ... - and we have already made Iris more rigid than it should be in this regard, so I am personally uncomfortable with baking in even more assumptions.

Therefore, in addition to MeshCoord inheriting the underlying coordinate system, I would also advocate for a new method: Mesh.add_default_coord_system(), which would modify all the Mesh's coordinates by adding GeogCS(iris.analysis.cartography.DEFAULT_SPHERICAL_EARTH_RADIUS). My reasoning being that it would be better for the user to opt-in, rather than obliging them to opt-out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants