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
I just spent some time, with help from colleagues, trying to figure out why my data didn't have a realization coordinate. It turned out that it did have a realization coordinate, but the error message was misleading.
How To Reproduce
importirisimportiris.coordsimportiris.cubeprint(f"{iris.__version__=}")
cube=iris.cube.Cube(1)
coord=iris.coords.DimCoord(1, standard_name="realization", units=1)
cube.add_aux_coord(coord.copy())
coord.var_name="realization"# without this line we get no exception.cube.coord(coord)
iris.__version__='3.2.1.post0'
Traceback (most recent call last):
File "coord_matching.py", line 14, in <module>
cube.coord(coord)
File "[python-path]/python3.8/site-packages/iris/cube.py", line 1919, in coord
raise iris.exceptions.CoordinateNotFoundError(emsg)
iris.exceptions.CoordinateNotFoundError: "Expected to find exactly 1 'realization' coordinate, but found none."
Expected behaviour
The error message should be clearer about what it is trying to match. Or it should make a more lenient comparison between the coordinates.
Environment
OS & Version: RHEL7
Iris Version: 3.2.1.post0
The text was updated successfully, but these errors were encountered:
I've put up a very simple PR to make it more obvious that an object is being compared against rather than a string. A more verbose error message could potentially give more detail, but I think it would be a bit more complicated to do so there could be diminishing returns going down that route. Let me know if you think these error messages would have been sufficient.
🐛 Bug Report
I just spent some time, with help from colleagues, trying to figure out why my data didn't have a realization coordinate. It turned out that it did have a realization coordinate, but the error message was misleading.
How To Reproduce
Expected behaviour
The error message should be clearer about what it is trying to match. Or it should make a more lenient comparison between the coordinates.
Environment
The text was updated successfully, but these errors were encountered: