You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WIP implementation of a tree-like hierarchical data structure for xarray.
10
+
**Datatree is a prototype implementation of a tree-like hierarchical data structure for xarray.**
11
11
12
-
This aims to create the data structure discussed in [xarray issue #4118](https://github.com/pydata/xarray/issues/4118), and therefore extend xarray's data model to be able to [handle arbitrarily nested netCDF4 groups](https://github.com/pydata/xarray/issues/1092#issuecomment-868324949).
12
+
Datatree was born after the xarray team recognised a [need for a new hierarchical data structure](https://github.com/pydata/xarray/issues/4118),
13
+
that was more flexible than a single `xarray.Dataset` object.
14
+
The initial motivation was to represent netCDF files / Zarr stores with multiple nested groups in a single in-memory object,
15
+
but `datatree.DataTree` objects have many other uses.
13
16
17
+
### Why Datatree?
18
+
19
+
You might want to use datatree for:
20
+
21
+
- Organising many related datasets, e.g. results of the same experiment with different parameters, or simulations of the same system using different models,
22
+
- Analysing similar data at multiple resolutions simultaneously, such as when doing a convergence study,
23
+
- Comparing heterogenous but related data, such as experimental and theoretical data,
24
+
- I/O with nested data formats such as netCDF / Zarr groups.
25
+
26
+
### Features
14
27
15
28
The approach used here is based on benbovy's [`DatasetNode` example](https://gist.github.com/benbovy/92e7c76220af1aaa4b3a0b65374e233a) - the basic idea is that each tree node wraps a up to a single `xarray.Dataset`. The differences are that this effort:
16
29
- Uses a node structure inspired by [anytree](https://github.com/xarray-contrib/datatree/issues/7) for the tree,
@@ -21,13 +34,30 @@ The approach used here is based on benbovy's [`DatasetNode` example](https://gis
21
34
- Has a printable representation that currently looks like this:
1) Load from a netCDF file (or Zarr store) that has groups via `open_datatree()`.
26
41
2) Using the init method of `DataTree`, which creates an individual node.
27
42
You can then specify the nodes' relationships to one other, either by setting `.parent` and `.chlldren` attributes,
28
43
or through `__get/setitem__` access, e.g. `dt['path/to/node'] = DataTree()`.
29
44
3) Create a tree from a dictionary of paths to datasets using `DataTree.from_dict()`.
30
45
46
+
### Development Roadmap
47
+
48
+
Datatree currently lives in a separate repository to the main xarray package.
49
+
This allows the datatree developers to make changes to it, experiment, and improve it faster.
50
+
51
+
Eventually we plan to fully integrate datatree upstream into xarray's main codebase, at which point the [github.com/xarray-contrib/datatree](https://github.com/xarray-contrib/datatree>) repository will be archived.
52
+
This should not cause much disruption to code that depends on datatree - you will likely only have to change the import line (i.e. from ``from datatree import DataTree`` to ``from xarray import DataTree``).
53
+
54
+
However, until this full integration occurs, datatree's API should not be considered to have the same [level of stability as xarray's](https://docs.xarray.dev/en/stable/contributing.html#backwards-compatibility).
55
+
56
+
### User Feedback
57
+
58
+
We really really really want to hear your opinions on datatree!
59
+
At this point in development, user feedback is critical to help us create something that will suit everyone's needs.
60
+
Please raise any thoughts, issues, suggestions or bugs, no matter how small or large, on the [github issue tracker](https://github.com/xarray-contrib/datatree/issues).
0 commit comments