Skip to content

Commit

Permalink
fix by sorting before insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNicholas committed Jul 30, 2024
1 parent 97b5aa9 commit f32d262
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xarray/core/datatree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,8 @@ def from_dict(

if d:
# Populate tree with children determined from data_objects mapping
for path, data in d.items():
# Sort keys so as to insert nodes from root first (see GH issue #9276)
for path, data in sorted(d.items()):
# Create and set new node
node_name = NodePath(path).name
if isinstance(data, DataTree):
Expand Down

0 comments on commit f32d262

Please sign in to comment.