Skip to content

Commit 22f361d

Browse files
committed
fix by performing check
1 parent beb665a commit 22f361d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

xarray/core/coordinates.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
assert_no_index_corrupted,
2323
create_default_index_implicit,
2424
)
25-
from xarray.core.merge import merge_coordinates_without_align, merge_coords
25+
from xarray.core.merge import (
26+
assert_valid_explicit_coords,
27+
merge_coordinates_without_align,
28+
merge_coords,
29+
)
2630
from xarray.core.types import DataVars, Self, T_DataArray, T_Xarray
2731
from xarray.core.utils import (
2832
Frozen,
@@ -306,6 +310,14 @@ def __init__(
306310
else:
307311
variables[name] = var
308312

313+
dims = set(d for var in variables.values() for d in var.dims)
314+
sizes = {
315+
d: -1 for d in dims
316+
} # TODO the lengths here are never used, so assert_valid_explicit_coords should be refactored
317+
assert_valid_explicit_coords(
318+
variables, dims=sizes, explicit_coords=list(variables)
319+
)
320+
309321
if indexes is None:
310322
indexes = {}
311323
else:

0 commit comments

Comments
 (0)