Skip to content

Commit

Permalink
coords refactor: preserve attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Aug 20, 2024
1 parent 723e19b commit 414f95a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xarray/groupers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
def _coordinates_from_variable(variable: Variable) -> Coordinates:
from xarray.core.indexes import create_default_index_implicit

(name,) = variable.dims
new_index, index_vars = create_default_index_implicit(variable)
indexes = {k: new_index for k in index_vars}
new_vars = new_index.create_variables()
new_vars[name].attrs = variable.attrs
return Coordinates(new_vars, indexes)


Expand Down

0 comments on commit 414f95a

Please sign in to comment.