Skip to content
This repository was archived by the owner on Oct 24, 2024. It is now read-only.
This repository was archived by the owner on Oct 24, 2024. It is now read-only.

Tree linkage + dataset in one object nonideal for UI tree view #303

Closed
@marcel-goldschen-ohm

Description

@marcel-goldschen-ohm

First, let me thank you for your efforts. I love the idea of a tree of xarray datasets, so kudos! However, I'm encountering a pretty annoying issue that I believe stems from 1) the design choice of having the tree linkage and dataset all wrapped in the same DataTree object, and 2) the current lack of support in xarray for renaming vars/coords "inplace". The issue is that (as far as I can tell) the only way to rename a var/coord is to create a new DataTree object (i.e., dt2 = dt1.rename_vars({'x': 'y'}) just as for datasets. This isn't really a problem for writing simple analysis scripts. However, when working with a UI such as a tree model/view to interface a datatree things get annoying. Imagine that your UI tree has items for both the datasets and the vars/coords within the datasets. Now the end user would like to edit the name of one of the variables. To do that you have to create a new DataTree node which then has to be updated for every item in the tree UI that references that node (i.e., every var/coord in that node that is displayed in the UI tree). This is a real pain which could be avoided by decoupling the dataset from the tree linkage, e.g., a tree node class which holds a dataset attribute so that the node references can persist during any renaming. The other advantage of this approach is that the dataset is then just a plain array dataset, so one does not have to think about compatibility or anything. You could still implement path selection, etc., via the tree node class. I know, this is a major design change, so I get it if it is unlikely to be implemented. However, a graphical tree UI for interfacing this sort of data structure is pretty desirable, and the current design is not ideal for that (basically, node references should persist for ease of use with the UI tree, which current renaming convention for xarray datasets and DataTree objects doesn't allow). Of course, it is possible that I just don't know the proper way to do this, so please correct me if I am off base here. Cheers!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions