-
Notifications
You must be signed in to change notification settings - Fork 42
Is it possible to move a node drectly? #210
Comments
Hi! At the moment I have no shortcut for that. We could make one, we would just have to decide what the API for such an operation should look like. e.g. dt.move('/other_node/mv_this_node/', to='/') |
Hi thanks for your answer. I would think such a shortcut would be a nice addition. Although, at the moment there probably other things with higher priority. As for the API: I do not know what the most pythonic way to do this. My intuition would say just
i.e without keyword like the console command in a shell, but this is not a strong preference. |
Actually you can also move a node just by reassigning the parent, e.g. dt['/other_node/mv_this_node/'].parent = dt['/']
If we made the node to move a positional arg, and @gluincth would you be interested in submitting a PR to add this feature? |
I'd like to help out. However, my time is very limited and I am not sure if my python-fu is up to it. I will put it on my to-do list but cannot make any promises to be able to do this soon. I have not yet looked at the code base, so where would be a good starting point to add such a short cut? |
@TomNicholas I will love to work on this as an Outreachy intern. |
Hi @Emeka-Onwuepe ! Thank you for your interest. You would need to add an additional method (called |
I am an Outreachy intern and I would love to contribute to this. |
Hello members, i am an Outreachy participant. In response to @gluincth's question, I think a direct way to change a node's position in a tree would be to edit its edges, and make it have new neighbors that correspond to its intended new position. Otherwise, i find that @TomNicholas' idea of creating a "move" method in the DataTree class is most appropriate. |
Hi @nashira26 and @KennethSeruuma, thanks also for your interest. Pull requests are welcome!
@KennethSeruuma a node's edges are simply what is stored in its |
Hello, I am an Outreachy participant and I would like to contribute to this @gluincth's question @TomNicholas . One way to achieve this is by using the For example, if you are using the Code: This will move the node Note that the |
heyy!! everyone im going to solve this problem |
Thats great @utkarsh-chaurasia and @TomNicholas . Hey guys, i would like to request anyone with access to good learning material for datatrees to help us access this material. It would aid these contributions alot. |
Actually, i have read some nice info on datatree in the README.md file. Follow the links in the README.md file to reach even more detailed information about datatree. |
@TomNicholas i would like to inquire whether there are any community specific questions for us (interns) to fill in our application forms. |
Hi @KennethSeruuma - no community-specific questions at the moment! |
Alright. Thanks |
Closing this here, with a solution potentially implemented upstream in pydata/xarray#9442 |
Hi
first thanks for this package!
Question: Is it possible to move a node to another position in the tree directly (possibly in place)?
At the moment I do e.g.
dt['/other_node/mv_this_node/'] = datatree.DataTree(dt['/mv_this_node/'].to_dataset())
newdt = dt.drop_nodes('mv_this_node')
The text was updated successfully, but these errors were encountered: