Skip to content

Commit ac38d19

Browse files
authored
move kwarg's output_sizes and meta to dask_gufunc_kwargs for in… (#4391)
* move kwarg's `output_sizes` and `meta` to `dask_gufunc_kwargs` for internal use of `apply_ufunc` (follow-up to #4060, fixes #4385) * add pull request referenz to `whats-new.rst`
1 parent 13caf96 commit ac38d19

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

doc/whats-new.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Documentation
9494
Internal Changes
9595
~~~~~~~~~~~~~~~~
9696
- Use :py:func:`dask.array.apply_gufunc` instead of :py:func:`dask.array.blockwise` in
97-
:py:func:`xarray.apply_ufunc` when using ``dask='parallelized'``. (:pull:`4060`)
97+
:py:func:`xarray.apply_ufunc` when using ``dask='parallelized'``. (:pull:`4060`, :pull:`4391`)
9898
- Fix ``pip install .`` when no ``.git`` directory exists; namely when the xarray source
9999
directory has been rsync'ed by PyCharm Professional for a remote deployment over SSH.
100100
By `Guido Imperiale <https://github.com/crusaderky>`_

xarray/core/variable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ def _wrapper(npa, **kwargs):
18591859
exclude_dims=set(dim),
18601860
output_core_dims=[["quantile"]],
18611861
output_dtypes=[np.float64],
1862-
output_sizes={"quantile": len(q)},
1862+
dask_gufunc_kwargs=dict(output_sizes={"quantile": len(q)}),
18631863
dask="parallelized",
18641864
kwargs={"q": q, "axis": axis, "interpolation": interpolation},
18651865
)

xarray/tests/test_computation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ def func(x):
785785
output_core_dims=[["sign"]],
786786
dask="parallelized",
787787
output_dtypes=[obj.dtype],
788-
output_sizes={"sign": 2},
788+
dask_gufunc_kwargs=dict(output_sizes={"sign": 2}),
789789
)
790790

791791
expected = stack_negative(data_array.compute())
@@ -897,7 +897,7 @@ def test_vectorize_dask_dtype_meta():
897897
vectorize=True,
898898
dask="parallelized",
899899
output_dtypes=[int],
900-
meta=np.ndarray((0, 0), dtype=np.float),
900+
dask_gufunc_kwargs=dict(meta=np.ndarray((0, 0), dtype=np.float)),
901901
)
902902

903903
assert_identical(expected, actual)
@@ -1129,7 +1129,7 @@ def test_vectorize_dask_new_output_dims():
11291129
vectorize=True,
11301130
dask="parallelized",
11311131
output_dtypes=[float],
1132-
output_sizes={"z": 1},
1132+
dask_gufunc_kwargs=dict(output_sizes={"z": 1}),
11331133
).transpose(*expected.dims)
11341134
assert_identical(expected, actual)
11351135

@@ -1141,7 +1141,7 @@ def test_vectorize_dask_new_output_dims():
11411141
vectorize=True,
11421142
dask="parallelized",
11431143
output_dtypes=[float],
1144-
output_sizes={"z1": 1},
1144+
dask_gufunc_kwargs=dict(output_sizes={"z1": 1}),
11451145
)
11461146

11471147
with raises_regex(

0 commit comments

Comments
 (0)