You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The definitive metadata of a MeshCoord is just mesh, location + axis.
These can be leniently compared with another one, e.g. to fetch the matching coord from a cube on a different mesh :
For example...
>>> import iris.tests.stock.mesh as ism
>>> cube1 = ism.sample_mesh_cube(mesh=ism.sample_mesh(n_nodes=10, n_faces=3, n_edges=0))
>>> cube2 = ism.sample_mesh_cube(mesh=ism.sample_mesh(n_nodes=10, n_faces=4, n_edges=0))
>>> co = cube1.coord('latitude')
>>> co
<MeshCoord: latitude / (unknown) mesh(<Mesh object at 0x7ff8906fc580>) location(face) [...]+bounds shape(3,)>
>>> cube2.coord(co)
<MeshCoord: latitude / (unknown) mesh(<Mesh object at 0x7ff8906cbdf0>) location(face) [...]+bounds shape(4,)>
>>>
However, a MeshCoord can be "reduced" to an equivalent AuxCoord (i.e. with same names, units, points + bounds).
This happens automatically when a cube is sub-indexed, e.g. "meshcube[..., 2]" or just "meshcube[..., 0:]".
However, the AuxCoord can never "compare with" the original, since the metadata structure is too different.
Hence, code analagous to the above won't work...
>>> import iris.tests.stock.mesh as ism
>>> cube = ism.sample_mesh_cube()
>>> cube1 = ism.sample_mesh_cube()
>>> cube2 = cube1[..., 0:]
>>> co1 = cube1.coord('latitude')
>>> co1
<MeshCoord: latitude / (unknown) mesh(<Mesh object at 0x7ff8906590a0>) location(face) [...]+bounds shape(3,)>
>>> co2 = cube2.coord('latitude')
>>> co2
<AuxCoord: latitude / (unknown) [3200, 3201, 3202]+bounds shape(3,)>
>>> cube2.coord(co1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/h05/itpp/git/iris/iris_main/lib/iris/cube.py", line 1919, in coord
raise iris.exceptions.CoordinateNotFoundError(emsg)
iris.exceptions.CoordinateNotFoundError: "Expected to find exactly 1 'latitude' coordinate, but found none."
>>>
I.E. you cannot find the "equivalent" coord in this way, when one is a MeshCoord and the other a 'normal' Coord.
However, that does work for a "normal" cube, including finding matching coords of a different type i.e. DimCoord <-> AuxCoord.
This is likely to cause problems in some generic operations, e.g. regridding.
The text was updated successfully, but these errors were encountered:
The definitive metadata of a MeshCoord is just
mesh
,location
+axis
.These can be leniently compared with another one, e.g. to fetch the matching coord from a cube on a different mesh :
For example...
However, a MeshCoord can be "reduced" to an equivalent AuxCoord (i.e. with same names, units, points + bounds).
This happens automatically when a cube is sub-indexed, e.g. "meshcube[..., 2]" or just "meshcube[..., 0:]".
However, the AuxCoord can never "compare with" the original, since the metadata structure is too different.
Hence, code analagous to the above won't work...
I.E. you cannot find the "equivalent" coord in this way, when one is a MeshCoord and the other a 'normal' Coord.
However, that does work for a "normal" cube, including finding matching coords of a different type i.e. DimCoord <-> AuxCoord.
This is likely to cause problems in some generic operations, e.g. regridding.
The text was updated successfully, but these errors were encountered: