MCPcopy Index your code
hub / github.com/pydata/xarray / to_dataset

Method to_dataset

xarray/core/datatree.py:698–733  ·  view source on GitHub ↗

Return the data in this node as a new xarray.Dataset object. Parameters ---------- inherit : bool or {"all_coords", "indexes"}, default True Controls which coordinates are inherited from parent nodes. - True or "indexes": inherit only indexe

(
        self, inherit: bool | Literal["all_coords", "indexes"] = True
    )

Source from the content-addressed store, hash-verified

696 ds = dataset
697
698 def to_dataset(
699 self, inherit: bool | Literal["all_coords", "indexes"] = True
700 ) -> Dataset:
701 """
702 Return the data in this node as a new xarray.Dataset object.
703
704 Parameters
705 ----------
706 inherit : bool or {"all_coords", "indexes"}, default True
707 Controls which coordinates are inherited from parent nodes.
708
709 - True or "indexes": inherit only indexed coordinates (default).
710 - "all_coords": inherit all coordinates, including non-index coordinates.
711 - False: only include coordinates defined at this node.
712
713 See Also
714 --------
715 DataTree.dataset
716 """
717 coord_vars, indexes = self._resolve_inherit(inherit)
718 variables = dict(self._data_variables)
719 variables |= coord_vars
720 dims = (
721 dict(self._node_dims)
722 if inherit is False
723 else calculate_dimensions(variables)
724 )
725 return Dataset._construct_direct(
726 variables,
727 set(coord_vars),
728 dims,
729 None if self._attrs is None else dict(self._attrs),
730 indexes,
731 None if self._encoding is None else dict(self._encoding),
732 None,
733 )
734
735 @property
736 def has_data(self) -> bool:

Callers 15

_pre_attachMethod · 0.95
_replace_nodeMethod · 0.95
updateMethod · 0.95
data_varsMethod · 0.95
test_emptyMethod · 0.95
test_data_argMethod · 0.95
test_create_with_dataMethod · 0.95
test_set_dataMethod · 0.95
make_datatreeMethod · 0.45

Calls 3

_resolve_inheritMethod · 0.95
calculate_dimensionsFunction · 0.85
_construct_directMethod · 0.45