Hierarchical tree-like data structures for xarray
Project description
datatree
WIP implementation of a tree-like hierarchical data structure for xarray.
This aims to create the data structure discussed in xarray issue #4118, and therefore extend xarray's data model to be able to handle arbitrarily nested netCDF4 groups.
The approach used here is based on benbovy's DatasetNode
example - the basic idea is that each tree node wraps a up to a single xarray.Dataset
. The differences are that this effort:
- Uses a node structure inspired by anytree for the tree,
- Implements path-like getting and setting,
- Has functions for mapping user-supplied functions over every node in the tree,
- Automatically dispatches some of
xarray.Dataset
's API over every node in the tree (such as.isel
), - Has a bunch of tests,
- Has a printable representation that currently looks like this:
You can create a DataTree
object in 3 ways:
- Load from a netCDF file (or Zarr store) that has groups via
open_datatree()
. - Using the init method of
DataTree
, which creates an individual node. You can then specify the nodes' relationships to one other, either by setting.parent
and.chlldren
attributes, or through__get/setitem__
access, e.g.dt['path/to/node'] = DataTree()
. - Create a tree from a dictionary of paths to datasets using
DataTree.from_dict()
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xarray-datatree-0.0.9.tar.gz
(69.4 kB
view details)
Built Distribution
File details
Details for the file xarray-datatree-0.0.9.tar.gz
.
File metadata
- Download URL: xarray-datatree-0.0.9.tar.gz
- Upload date:
- Size: 69.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3005997cc3c3dd89a8d9ca5c483ebcc5080c7e9b42323956d01ffa4c5eb2c41a |
|
MD5 | 835419903ed2badb8c07dc5add931d09 |
|
BLAKE2b-256 | acdb89e226a1c606390fc39a41b31881f64f8a15985ff0c5470574d6fa92f9cc |
File details
Details for the file xarray_datatree-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: xarray_datatree-0.0.9-py3-none-any.whl
- Upload date:
- Size: 50.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e9ca1e5ce0dce6ac84675ec836875beb24e450e0774659cbc8141311965db64 |
|
MD5 | c379c756549b68938ba5b796bd52d123 |
|
BLAKE2b-256 | cb711dd70489753c4fe0a73d1a525669b85ddce26603bf3629ad9f6586c9b0a2 |