(dataset: Dataset, cache: bool)
| 108 | |
| 109 | |
| 110 | def _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 | |
| 121 | def _protect_datatree_variables_inplace(tree: DataTree, cache: bool) -> None: |
no test coverage detected
searching dependent graphs…