File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 30
30
from xarray .core .formatting import limit_lines
31
31
from xarray .core .indexes import Index , filter_indexes_from_coords
32
32
from xarray .core .options import _get_keep_attrs
33
- from xarray .core .utils import (
34
- is_dict_like ,
35
- result_name ,
36
- )
33
+ from xarray .core .utils import is_dict_like , result_name
37
34
from xarray .core .variable import Variable
38
35
from xarray .namedarray .parallelcompat import get_chunked_array_type
39
36
from xarray .namedarray .pycompat import is_chunked_array
@@ -1212,6 +1209,8 @@ def apply_ufunc(
1212
1209
dask_gufunc_kwargs .setdefault ("output_sizes" , output_sizes )
1213
1210
1214
1211
if kwargs :
1212
+ if "where" in kwargs and isinstance (kwargs ["where" ], DataArray ):
1213
+ kwargs ["where" ] = kwargs ["where" ].data # type:ignore[index]
1215
1214
func = functools .partial (func , ** kwargs )
1216
1215
1217
1216
if keep_attrs is None :
Original file line number Diff line number Diff line change @@ -2627,3 +2627,14 @@ def test_complex_number_reduce(compute_backend):
2627
2627
# Check that xarray doesn't call into numbagg, which doesn't compile for complex
2628
2628
# numbers at the moment (but will when numba supports dynamic compilation)
2629
2629
da .min ()
2630
+
2631
+
2632
+ def test_fix () -> None :
2633
+ val = 3.0
2634
+ val_fixed = np .fix (val )
2635
+
2636
+ da = xr .DataArray ([val ])
2637
+ expected = xr .DataArray ([val_fixed ])
2638
+
2639
+ actual = np .fix (da )
2640
+ assert_identical (expected , actual )
You can’t perform that action at this time.
0 commit comments