Skip to content

Commit

Permalink
Ayush's fix from #191
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNicholas committed Aug 23, 2024
1 parent 48fbbcc commit 7a15636
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion virtualizarr/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,11 @@ def separate_coords(
coord_vars: dict[
str, tuple[Hashable, Any, dict[Any, Any], dict[Any, Any]] | xr.Variable
] = {}
found_coord_names: set[str] = set()
for name, var in vars.items():
if name in coord_names or var.dims == (name,):
if "coordinates" in var.attrs:
found_coord_names.update(var.attrs["coordinates"].split(" "))
if name in coord_names or var.dims == (name,) or name in found_coord_names:
# use workaround to avoid creating IndexVariables described here https://github.com/pydata/xarray/pull/8107#discussion_r1311214263
if len(var.dims) == 1:
dim1d, *_ = var.dims
Expand Down

0 comments on commit 7a15636

Please sign in to comment.