Skip to content

Commit a346a48

Browse files
tomvothecoderpre-commit-ci[bot]aulemahal
authored
Raise ValueError in _get_ordered_vertices() with "mixed" order (#595)
* Raise a ValueError in `_get_ordered_vertices()` with `"mixed"` core dim order * Replace ValueError with NotImplementedError * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Pascal Bourgault <[email protected]>
1 parent e82882b commit a346a48

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cf_xarray/helpers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,12 @@ def _get_ordered_vertices(
338338
elif order == "descending":
339339
endpoints = np.maximum(bounds[..., :, 0], bounds[..., :, 1])
340340
last_endpoint = np.minimum(bounds[..., -1, 0], bounds[..., -1, 1])
341+
else:
342+
raise NotImplementedError(
343+
f"Cannot determine vertices for non-monotonic bounds with {order} core "
344+
"dimension orders. Try normalizing the coordinates to a monotonic "
345+
"convention and try again."
346+
)
341347

342348
vertices = np.concatenate(
343349
[endpoints, np.expand_dims(last_endpoint, axis=-1)], axis=-1

0 commit comments

Comments
 (0)