-
Notifications
You must be signed in to change notification settings - Fork 42
API for collapsing subtrees #192
Comments
Hmm, I'm having a hard time pondering through the exact implications or coming up with examples of merging subtrees with more than one level, and what logical results would be, but it feels like there could quickly be unexpected results.
What about starting with |
I was suggesting the latter, but I can also see why you might want the former too.
I don't see how you are supposed to do this without causing ambiguities in naming nodes. This is why I suggested |
Yes, that's a great idea! Having methods like merge_subtree, concat_subtree, and combine_subtree would make it much easier to collapse subtrees into single nodes. Here, i write an example for implementation of these methods:
`
These methods would modify the DataTree object in place, merging, concatenating, or combining the children nodes of the specified node. we could then access the merged, concatenated, or combined node using its path. |
Closed for pydata/xarray#9349 |
Multiple people have requested methods for collapsing children or subtrees into single nodes.
Following on from our discourse discussion @abkfenris @patrickcgray
Also see pydata/xarray#3996 (comment) @rabernat @
How about an API like this?
or maybe even the
_subtree
suffix is superfluous...Then the usage might be
You could chain this with the new
.filter()
too which would be neat.The text was updated successfully, but these errors were encountered: