Skip to main content

Hierarchical tree-like data structures for xarray

Project description

datatree

CI GitHub Workflow Status Code Coverage Status pre-commit.ci status
Docs Documentation Status
Package Conda PyPI
License License

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:
drawing

You can create a DataTree object in 3 ways:

  1. Load from a netCDF file (or Zarr store) that has groups via open_datatree().
  2. 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().
  3. Create a tree from a dictionary of paths to datasets using DataTree.from_dict().

Project details


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.10.tar.gz (69.0 kB view details)

Uploaded Source

Built Distribution

xarray_datatree-0.0.10-py3-none-any.whl (53.3 kB view details)

Uploaded Python 3

File details

Details for the file xarray-datatree-0.0.10.tar.gz.

File metadata

  • Download URL: xarray-datatree-0.0.10.tar.gz
  • Upload date:
  • Size: 69.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for xarray-datatree-0.0.10.tar.gz
Algorithm Hash digest
SHA256 71cfb4b881eed816e2967e4fbf3b5d2f19c30cc19aefe95531ab7209d0ce5366
MD5 760b47f364e43aeb124556a4ee02ae86
BLAKE2b-256 52caeeaa213e3803c5ab53743de4d723766bdd663de7eea4bf126cf3df454d3e

See more details on using hashes here.

File details

Details for the file xarray_datatree-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for xarray_datatree-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 cfc762296915888e0020457b78f0b908514be67ac49d8cbb0ca571161c136a32
MD5 7f84c4c43f0b914240131005a3526eba
BLAKE2b-256 da992eaa47551d6408d65edd528c85994b35b9fe0fa880679066bc00ad60f53d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page