A tree-like hierarchical collection of xarray objects. Attempts to present an API like that of xarray.Dataset, but methods are wrapped to also update all the tree's child nodes.
| 460 | |
| 461 | |
| 462 | class DataTree( |
| 463 | NamedNode, |
| 464 | DataTreeAggregations, |
| 465 | DataTreeOpsMixin, |
| 466 | TreeAttrAccessMixin, |
| 467 | Mapping[str, "DataArray | DataTree"], |
| 468 | ): |
| 469 | """ |
| 470 | A tree-like hierarchical collection of xarray objects. |
| 471 | |
| 472 | Attempts to present an API like that of xarray.Dataset, but methods are wrapped to also update all the tree's child nodes. |
| 473 | """ |
| 474 | |
| 475 | # TODO Some way of sorting children by depth |
| 476 | |
| 477 | # TODO do we need a watch out for if methods intended only for root nodes are called on non-root nodes? |
| 478 | |
| 479 | # TODO dataset methods which should not or cannot act over the whole tree, such as .to_array |
| 480 | |
| 481 | # TODO .loc method |
| 482 | |
| 483 | # TODO a lot of properties like .variables could be defined in a DataMapping class which both Dataset and DataTree inherit from |
| 484 | |
| 485 | # TODO all groupby classes |
| 486 | |
| 487 | # TODO a lot of properties like .variables could be defined in a DataMapping class which both Dataset and DataTree inherit from |
| 488 | |
| 489 | # TODO all groupby classes |
| 490 | |
| 491 | _name: str | None |
| 492 | _parent: DataTree | None |
| 493 | _children: dict[str, DataTree] |
| 494 | _cache: dict[str, Any] # used by _CachedAccessor |
| 495 | _data_variables: dict[Hashable, Variable] |
| 496 | _node_coord_variables: dict[Hashable, Variable] |
| 497 | _node_dims: dict[Hashable, int] |
| 498 | _node_indexes: dict[Hashable, Index] |
| 499 | _attrs: dict[Hashable, Any] | None |
| 500 | _encoding: dict[Hashable, Any] | None |
| 501 | _close: Callable[[], None] | None |
| 502 | |
| 503 | __slots__ = ( |
| 504 | "_attrs", |
| 505 | "_cache", # used by _CachedAccessor |
| 506 | "_children", |
| 507 | "_close", |
| 508 | "_data_variables", |
| 509 | "_encoding", |
| 510 | "_name", |
| 511 | "_node_coord_variables", |
| 512 | "_node_dims", |
| 513 | "_node_indexes", |
| 514 | "_parent", |
| 515 | ) |
| 516 | |
| 517 | def __init__( |
| 518 | self, |
| 519 | dataset: Dataset | Coordinates | None = None, |
no outgoing calls
searching dependent graphs…