diff --git a/lib/iris/experimental/ugrid/mesh.py b/lib/iris/experimental/ugrid/mesh.py index c1d77c34ba..651906b748 100644 --- a/lib/iris/experimental/ugrid/mesh.py +++ b/lib/iris/experimental/ugrid/mesh.py @@ -2814,7 +2814,10 @@ def axis(self): @property def coord_system(self): - """The coordinate-system of a MeshCoord comes from the related mesh coord.""" + """The coordinate-system of a MeshCoord. + + It comes from the `related` location coordinate in the mesh. + """ # This matches where the coord metadata is drawn from. # See : https://github.com/SciTools/iris/issues/4860 select_kwargs = { @@ -2822,8 +2825,8 @@ def coord_system(self): "axis": self.axis, } try: - # NOTE: at present, a MeshCoord *always* references a related mesh coord of - # its location, from which it's points are taken. + # NOTE: at present, a MeshCoord *always* references the relevant location + # coordinate in the mesh, from which its points are taken. # However this might change in future .. # see : https://github.com/SciTools/iris/discussions/4438#bounds-no-points location_coord = self.mesh.coord(**select_kwargs) diff --git a/lib/iris/tests/integration/experimental/test_meshcoord_coordsys.py b/lib/iris/tests/integration/experimental/test_meshcoord_coordsys.py index 30500e8b02..353d56004f 100644 --- a/lib/iris/tests/integration/experimental/test_meshcoord_coordsys.py +++ b/lib/iris/tests/integration/experimental/test_meshcoord_coordsys.py @@ -110,3 +110,20 @@ def test_assigned_mesh_cs(tmp_path): # since there are no dim-coords, or any other coord with a c-s. # TODO: this may be a mistake -- see https://github.com/SciTools/iris/issues/6051 assert cube.coord_system() is assigned_cs + + +def test_meshcoord_coordsys_copy(tmp_path): + # Check that copying a meshcoord with a coord system works properly. + nc_path = tmp_path / "test_temp.nc" + make_file(nc_path) + with PARSE_UGRID_ON_LOAD.context(): + cube = iris.load_cube(nc_path, "node_data") + node_coord = cube.mesh.coord(include_nodes=True, axis="x") + assigned_cs = GeogCS(1.0) + node_coord.coord_system = assigned_cs + mesh_coord = cube.coord(axis="x") + assert mesh_coord.coord_system is assigned_cs + meshco_copy = mesh_coord.copy() + assert meshco_copy == mesh_coord + # Note: still the same object, because it is derived from the same node_coord + assert meshco_copy.coord_system is assigned_cs