Skip to content

Commit 70be853

Browse files
authored
Fix singleton coord in core dim orders (#592)
1 parent e6b7915 commit 70be853

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cf_xarray/helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ def _get_core_dim_orders(core_dim_coords: dict[str, np.ndarray]) -> dict[str, st
222222
core_dim_orders = {}
223223

224224
for dim, coords in core_dim_coords.items():
225+
if coords.size <= 1:
226+
# A single value, same as all values are equal, treat as ascending
227+
core_dim_orders[dim] = "ascending"
228+
continue
229+
225230
diffs = np.diff(coords)
226231

227232
# Handle datetime64 and timedelta64 safely for both numpy 1.26.4 and numpy 2

0 commit comments

Comments
 (0)