Skip to content

Commit f4b54ac

Browse files
pp-mobjlittle
authored andcommitted
Improve warning and error messages for old routine. (#3452)
1 parent c832f58 commit f4b54ac

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/iris/analysis/calculus.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ def _construct_midpoint_coord(coord, circular=None):
8585
8686
"""
8787
if circular and not hasattr(coord, 'circular'):
88-
raise ValueError('Cannot produce circular midpoint from a coord '
89-
'without the circular attribute')
88+
msg = ("Cannot produce a circular midpoint for the '{}' coord, "
89+
"which does not have a 'circular' attribute.")
90+
raise ValueError(msg.format(coord.name()))
9091

9192
if circular is None:
9293
circular = getattr(coord, 'circular', False)
9394
elif circular != getattr(coord, 'circular', False):
94-
warnings.warn('circular flag and Coord.circular attribute do '
95-
'not match')
95+
msg = ("Construction coordinate midpoints for the '{}' coordinate, "
96+
"though it has the attribute 'circular'={}.")
97+
warnings.warn(msg.format(circular, coord.circular, coord.name()))
9698

9799
if coord.ndim != 1:
98100
raise iris.exceptions.CoordinateMultiDimError(coord)

0 commit comments

Comments
 (0)