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

Function dataset_to_dataarray

xarray/core/parallel.py:68–77  ·  view source on GitHub ↗
(obj: Dataset)

Source from the content-addressed store, hash-verified

66
67
68def dataset_to_dataarray(obj: Dataset) -> DataArray:
69 if not isinstance(obj, Dataset):
70 raise TypeError(f"Expected Dataset, got {type(obj)}")
71
72 if len(obj.data_vars) > 1:
73 raise TypeError(
74 "Trying to convert Dataset with more than one data variable to DataArray"
75 )
76
77 return next(iter(obj.data_vars.values()))
78
79
80def dataarray_to_dataset(obj: DataArray) -> Dataset:

Callers 3

make_metaFunction · 0.85
_wrapperFunction · 0.85
map_blocksFunction · 0.85

Calls 2

typeFunction · 0.85
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…