Create a single node of a DataTree. The node may optionally contain data in the form of data and coordinate variables, stored in the same way as data is stored in an xarray.Dataset. Parameters ---------- dataset : Dataset, optional
(
self,
dataset: Dataset | Coordinates | None = None,
children: Mapping[str, DataTree] | None = None,
name: str | None = None,
)
| 515 | ) |
| 516 | |
| 517 | def __init__( |
| 518 | self, |
| 519 | dataset: Dataset | Coordinates | None = None, |
| 520 | children: Mapping[str, DataTree] | None = None, |
| 521 | name: str | None = None, |
| 522 | ): |
| 523 | """ |
| 524 | Create a single node of a DataTree. |
| 525 | |
| 526 | The node may optionally contain data in the form of data and coordinate |
| 527 | variables, stored in the same way as data is stored in an |
| 528 | xarray.Dataset. |
| 529 | |
| 530 | Parameters |
| 531 | ---------- |
| 532 | dataset : Dataset, optional |
| 533 | Data to store directly at this node. |
| 534 | children : Mapping[str, DataTree], optional |
| 535 | Any child nodes of this node. |
| 536 | name : str, optional |
| 537 | Name for this node of the tree. |
| 538 | |
| 539 | Returns |
| 540 | ------- |
| 541 | DataTree |
| 542 | |
| 543 | See Also |
| 544 | -------- |
| 545 | DataTree.from_dict |
| 546 | """ |
| 547 | self._set_node_data(_to_new_dataset(dataset)) |
| 548 | |
| 549 | # comes after setting node data as this will check for clashes between child names and existing variable names |
| 550 | super().__init__(name=name, children=children) |
| 551 | |
| 552 | def _set_node_data(self, dataset: Dataset): |
| 553 | _check_for_slashes_in_names(dataset.variables) |
nothing calls this directly
no test coverage detected