Skip to content
Open
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions cf_xarray/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,16 @@ def _get_ordered_vertices(
if _is_bounds_monotonic(bounds):
vertices = np.concatenate((bounds[..., :, 0], bounds[..., -1:, 1]), axis=-1)
else:

if order == "ascending":
endpoints = np.minimum(bounds[..., :, 0], bounds[..., :, 1])
last_endpoint = np.maximum(bounds[..., -1, 0], bounds[..., -1, 1])
elif order == "descending":
endpoints = np.maximum(bounds[..., :, 0], bounds[..., :, 1])
last_endpoint = np.minimum(bounds[..., -1, 0], bounds[..., -1, 1])
elif order == "mixed":
raise ValueError(
"Cannot determine vertices for non-monotonic bounds with mixed core "
else:
raise NotImplementedError(
f"Cannot determine vertices for non-monotonic bounds with {order} core "
Comment on lines +341 to +343
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @malmans2, I addressed your comment here. This PR is ready for another review.

The new else statement will catch any order that is not "ascending" or "descending". I kept the same error message (beside specifying the order value) because it should be helpful for the user.

"dimension orders. Try normalizing the coordinates to a monotonic "
"convention and try again."
)
Expand Down
Loading