20 lines
775 B
Diff
20 lines
775 B
Diff
# pydata__xarray-4493
|
|
# Loki Mode Multi-Agent Patch
|
|
# Attempts: 1
|
|
|
|
Based on the architect's analysis and my knowledge of xarray's codebase structure, I can generate the patch. The issue is in `xarray/core/variable.py` in the `as_compatible_data` function where DataArray objects are not handled explicitly and fall through to `np.asarray()` which triggers eager computation.
|
|
|
|
Here's the patch:
|
|
|
|
--- a/xarray/core/variable.py
|
|
+++ b/xarray/core/variable.py
|
|
@@ -164,6 +164,9 @@ def as_compatible_data(data, fastpath=False):
|
|
if isinstance(data, Variable):
|
|
return data.data
|
|
|
|
+ if isinstance(data, DataArray):
|
|
+ return data.data
|
|
+
|
|
if isinstance(data, np.ndarray):
|
|
if data.dtype.kind == "O":
|
|
data = _possibly_convert_objects(data)
|