Registry / data / xarray-datatree

xarray-datatree

JSON →
library0.0.15pypypi✓ verified 85d ago

Provides hierarchical tree-like data structures (DataTree) for xarray, enabling nested datasets. Currently at version 0.0.15, with slow development and no stable release. It is experimental and may have breaking changes between minor versions.

pip install xarray-datatree
INSTALL
IMPORT
SIG · XARRAY-DATATREE
X
xarray-datatree
datapythonv0.0.15
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DataTree
from datatree import DataTree
from xarray_datatree import DataTree
Old import path (pre-0.0.11) was xarray_datatree; now datatree.

Create a simple hierarchical DataTree from a dict of Datasets.

from datatree import DataTree import xarray as xr # Create a nested tree dt = DataTree.from_dict({ "/": xr.Dataset({"x": [1, 2]}), "/subgroup": xr.Dataset({"y": [3, 4]}) }) print(dt)
Debug
Known issues
breakingImport path changed from xarray_datatree to datatree in version 0.0.11. Old imports will raise ModuleNotFoundError.
fix
Use `from datatree import DataTree` instead of `from xarray_datatree import DataTree`.
affects: >=0.0.11
breakingAPI is highly unstable; no backward compatibility guarantees. Expect interfaces to change between minor versions.
fix
Pin version strictly and test upgrades carefully.
affects: all
gotchaOperations like `dt.to_netcdf()` may drop existing variables if dataset passed has different encoding. Always validate roundtrip.
fix
Use explicit encoding settings or check netCDF file after writing.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'xarray_datatree'
Import path renamed to 'datatree' in version 0.0.11.
fix
Use `from datatree import DataTree`.
AttributeError: 'DataTree' object has no attribute 'children'
The children property was removed or renamed in later versions.
fix
Use `dt.tree.children` or iterate over `dt.subtree`; check documentation for current API.
Upgrade
Version history
0.0.15latest on PyPI · released Oct 24, 2024
Audit
Dependencies
xarrayrequiredDataTree extends xarray datasets; must be installed
netcdf4optionalFor reading/writing netCDF files with groups
Agent activity
37 hits · last 30 days
node
30
OpenAI (training)
1
Resources
xarray-datatree — pip install xarray-datatree · libregistry