MCPcopy
hub / github.com/pydata/xarray / to_dict

Method to_dict

xarray/core/datatree.py:1453–1473  ·  view source on GitHub ↗

Create a dictionary mapping of paths to the data contained in those nodes. Parameters ---------- relative : bool If True, return relative instead of absolute paths. Returns ------- dict[str, Dataset] See Also ---

(self, relative: bool = False)

Source from the content-addressed store, hash-verified

1451 return obj
1452
1453 def to_dict(self, relative: bool = False) -> dict[str, Dataset]:
1454 """
1455 Create a dictionary mapping of paths to the data contained in those nodes.
1456
1457 Parameters
1458 ----------
1459 relative : bool
1460 If True, return relative instead of absolute paths.
1461
1462 Returns
1463 -------
1464 dict[str, Dataset]
1465
1466 See Also
1467 --------
1468 DataTree.subtree_with_keys
1469 """
1470 return {
1471 node.relative_to(self) if relative else node.path: node.to_dataset()
1472 for node in self.subtree
1473 }
1474
1475 @property
1476 def nbytes(self) -> int:

Callers

nothing calls this directly

Calls 2

relative_toMethod · 0.80
to_datasetMethod · 0.45

Tested by

no test coverage detected