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

Function _dummy_copy

xarray/core/groupby.py:101–132  ·  view source on GitHub ↗
(xarray_obj)

Source from the content-addressed store, hash-verified

99
100
101def _dummy_copy(xarray_obj):
102 from xarray.core.dataarray import DataArray
103 from xarray.core.dataset import Dataset
104
105 if isinstance(xarray_obj, Dataset):
106 res = Dataset(
107 {
108 k: dtypes.get_fill_value(v.dtype)
109 for k, v in xarray_obj.data_vars.items()
110 },
111 {
112 k: dtypes.get_fill_value(v.dtype)
113 for k, v in xarray_obj.coords.items()
114 if k not in xarray_obj.dims
115 },
116 xarray_obj.attrs,
117 )
118 elif isinstance(xarray_obj, DataArray):
119 res = DataArray(
120 dtypes.get_fill_value(xarray_obj.dtype),
121 {
122 k: dtypes.get_fill_value(v.dtype)
123 for k, v in xarray_obj.coords.items()
124 if k not in xarray_obj.dims
125 },
126 dims=[],
127 name=xarray_obj.name,
128 attrs=xarray_obj.attrs,
129 )
130 else: # pragma: no cover
131 raise AssertionError
132 return res
133
134
135def _is_one_or_none(obj) -> bool:

Callers 1

_iter_over_selectionsFunction · 0.90

Calls 3

DatasetClass · 0.90
DataArrayClass · 0.90
itemsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…