Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/iris/analysis/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,16 @@ def _construct_midpoint_coord(coord, circular=None):

"""
if circular and not hasattr(coord, 'circular'):
raise ValueError('Cannot produce circular midpoint from a coord '
'without the circular attribute')
msg = ("Cannot produce a circular midpoint for the '{}' coord, "
"which does not have a 'circular' attribute.")
raise ValueError(msg.format(coord.name()))

if circular is None:
circular = getattr(coord, 'circular', False)
elif circular != getattr(coord, 'circular', False):
warnings.warn('circular flag and Coord.circular attribute do '
'not match')
msg = ("Construction coordinate midpoints for the '{}' coordinate, "
"though it has the attribute 'circular'={}.")
warnings.warn(msg.format(circular, coord.circular, coord.name()))

if coord.ndim != 1:
raise iris.exceptions.CoordinateMultiDimError(coord)
Expand Down