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

Function _protect_dataset_variables_inplace

xarray/backends/api.py:110–118  ·  view source on GitHub ↗
(dataset: Dataset, cache: bool)

Source from the content-addressed store, hash-verified

108
109
110def _protect_dataset_variables_inplace(dataset: Dataset, cache: bool) -> None:
111 for name, variable in dataset.variables.items():
112 if name not in dataset._indexes:
113 # no need to protect IndexVariable objects
114 data: indexing.ExplicitlyIndexedNDArrayMixin
115 data = indexing.CopyOnWriteArray(variable._data)
116 if cache:
117 data = indexing.MemoryCachedArray(data)
118 variable.data = data
119
120
121def _protect_datatree_variables_inplace(tree: DataTree, cache: bool) -> None:

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…