---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[8], line 1
----> 1 da = da.copy()
2 da
File ~/projects/fsspec_caching/venv/lib/python3.9/site-packages/xarray/core/dataarray.py:1237, in DataArray.copy(self, deep, data)
1169 def copy(self, deep: bool = True, data: Any = None) -> Self:
1170 """Returns a copy of this array.
1171
1172 If `deep=True`, a deep copy is made of the data array.
(...)
1235 pandas.DataFrame.copy
1236 """
-> 1237 return self._copy(deep=deep, data=data)
File ~/projects/fsspec_caching/venv/lib/python3.9/site-packages/xarray/core/dataarray.py:1245, in DataArray._copy(self, deep, data, memo)
1239 def _copy(
1240 self,
1241 deep: bool = True,
1242 data: Any = None,
1243 memo: dict[int, Any] | None = None,
1244 ) -> Self:
-> 1245 variable = self.variable._copy(deep=deep, data=data, memo=memo)
1246 indexes, index_vars = self.xindexes.copy_indexes(deep=deep)
1248 coords = {}
File ~/projects/fsspec_caching/venv/lib/python3.9/site-packages/xarray/core/variable.py:931, in Variable._copy(self, deep, data, memo)
928 ndata = indexing.MemoryCachedArray(data_old.array) # type: ignore[assignment]
930 if deep:
--> 931 ndata = copy.deepcopy(ndata, memo)
933 else:
934 ndata = as_compatible_data(data)
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:172, in deepcopy(x, memo, _nil)
170 y = x
171 else:
--> 172 y = _reconstruct(x, memo, *rv)
174 # If is its own copy, don't memoize.
175 if y is not x:
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:270, in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
268 if state is not None:
269 if deep:
--> 270 state = deepcopy(state, memo)
271 if hasattr(y, '__setstate__'):
272 y.__setstate__(state)
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:146, in deepcopy(x, memo, _nil)
144 copier = _deepcopy_dispatch.get(cls)
145 if copier is not None:
--> 146 y = copier(x, memo)
147 else:
148 if issubclass(cls, type):
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:210, in _deepcopy_tuple(x, memo, deepcopy)
209 def _deepcopy_tuple(x, memo, deepcopy=deepcopy):
--> 210 y = [deepcopy(a, memo) for a in x]
211 # We're not going to put the tuple in the memo, but it's still important we
212 # check for it, in case the tuple contains recursive mutable structures.
213 try:
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:210, in <listcomp>(.0)
209 def _deepcopy_tuple(x, memo, deepcopy=deepcopy):
--> 210 y = [deepcopy(a, memo) for a in x]
211 # We're not going to put the tuple in the memo, but it's still important we
212 # check for it, in case the tuple contains recursive mutable structures.
213 try:
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:146, in deepcopy(x, memo, _nil)
144 copier = _deepcopy_dispatch.get(cls)
145 if copier is not None:
--> 146 y = copier(x, memo)
147 else:
148 if issubclass(cls, type):
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:230, in _deepcopy_dict(x, memo, deepcopy)
228 memo[id(x)] = y
229 for key, value in x.items():
--> 230 y[deepcopy(key, memo)] = deepcopy(value, memo)
231 return y
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:172, in deepcopy(x, memo, _nil)
170 y = x
171 else:
--> 172 y = _reconstruct(x, memo, *rv)
174 # If is its own copy, don't memoize.
175 if y is not x:
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:270, in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
268 if state is not None:
269 if deep:
--> 270 state = deepcopy(state, memo)
271 if hasattr(y, '__setstate__'):
272 y.__setstate__(state)
[... skipping similar frames: deepcopy at line 146 (1 times)]
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:230, in _deepcopy_dict(x, memo, deepcopy)
228 memo[id(x)] = y
229 for key, value in x.items():
--> 230 y[deepcopy(key, memo)] = deepcopy(value, memo)
231 return y
[... skipping similar frames: _reconstruct at line 270 (1 times), deepcopy at line 172 (1 times), deepcopy at line 146 (1 times)]
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:210, in _deepcopy_tuple(x, memo, deepcopy)
209 def _deepcopy_tuple(x, memo, deepcopy=deepcopy):
--> 210 y = [deepcopy(a, memo) for a in x]
211 # We're not going to put the tuple in the memo, but it's still important we
212 # check for it, in case the tuple contains recursive mutable structures.
213 try:
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:210, in <listcomp>(.0)
209 def _deepcopy_tuple(x, memo, deepcopy=deepcopy):
--> 210 y = [deepcopy(a, memo) for a in x]
211 # We're not going to put the tuple in the memo, but it's still important we
212 # check for it, in case the tuple contains recursive mutable structures.
213 try:
[... skipping similar frames: deepcopy at line 146 (3 times), _deepcopy_dict at line 230 (2 times), <listcomp> at line 210 (1 times), _deepcopy_tuple at line 210 (1 times), _reconstruct at line 270 (1 times), deepcopy at line 172 (1 times)]
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:172, in deepcopy(x, memo, _nil)
170 y = x
171 else:
--> 172 y = _reconstruct(x, memo, *rv)
174 # If is its own copy, don't memoize.
175 if y is not x:
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:270, in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)
268 if state is not None:
269 if deep:
--> 270 state = deepcopy(state, memo)
271 if hasattr(y, '__setstate__'):
272 y.__setstate__(state)
[... skipping similar frames: deepcopy at line 146 (1 times)]
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:210, in _deepcopy_tuple(x, memo, deepcopy)
209 def _deepcopy_tuple(x, memo, deepcopy=deepcopy):
--> 210 y = [deepcopy(a, memo) for a in x]
211 # We're not going to put the tuple in the memo, but it's still important we
212 # check for it, in case the tuple contains recursive mutable structures.
213 try:
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:210, in <listcomp>(.0)
209 def _deepcopy_tuple(x, memo, deepcopy=deepcopy):
--> 210 y = [deepcopy(a, memo) for a in x]
211 # We're not going to put the tuple in the memo, but it's still important we
212 # check for it, in case the tuple contains recursive mutable structures.
213 try:
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:146, in deepcopy(x, memo, _nil)
144 copier = _deepcopy_dispatch.get(cls)
145 if copier is not None:
--> 146 y = copier(x, memo)
147 else:
148 if issubclass(cls, type):
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:230, in _deepcopy_dict(x, memo, deepcopy)
228 memo[id(x)] = y
229 for key, value in x.items():
--> 230 y[deepcopy(key, memo)] = deepcopy(value, memo)
231 return y
File ~/.pyenv/versions/3.9.0/lib/python3.9/copy.py:161, in deepcopy(x, memo, _nil)
159 reductor = getattr(x, "__reduce_ex__", None)
160 if reductor is not None:
--> 161 rv = reductor(4)
162 else:
163 reductor = getattr(x, "__reduce__", None)
TypeError: cannot pickle '_thread.lock' object