Skip to content

Commit

Permalink
move kwarg's output_sizes and meta to dask_gufunc_kwargs for in… (
Browse files Browse the repository at this point in the history
#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`
  • Loading branch information
kmuehlbauer authored Aug 30, 2020
1 parent 13caf96 commit ac38d19
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Documentation
Internal Changes
~~~~~~~~~~~~~~~~
- Use :py:func:`dask.array.apply_gufunc` instead of :py:func:`dask.array.blockwise` in
:py:func:`xarray.apply_ufunc` when using ``dask='parallelized'``. (:pull:`4060`)
:py:func:`xarray.apply_ufunc` when using ``dask='parallelized'``. (:pull:`4060`, :pull:`4391`)
- Fix ``pip install .`` when no ``.git`` directory exists; namely when the xarray source
directory has been rsync'ed by PyCharm Professional for a remote deployment over SSH.
By `Guido Imperiale <https://github.com/crusaderky>`_
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,7 @@ def _wrapper(npa, **kwargs):
exclude_dims=set(dim),
output_core_dims=[["quantile"]],
output_dtypes=[np.float64],
output_sizes={"quantile": len(q)},
dask_gufunc_kwargs=dict(output_sizes={"quantile": len(q)}),
dask="parallelized",
kwargs={"q": q, "axis": axis, "interpolation": interpolation},
)
Expand Down
8 changes: 4 additions & 4 deletions xarray/tests/test_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ def func(x):
output_core_dims=[["sign"]],
dask="parallelized",
output_dtypes=[obj.dtype],
output_sizes={"sign": 2},
dask_gufunc_kwargs=dict(output_sizes={"sign": 2}),
)

expected = stack_negative(data_array.compute())
Expand Down Expand Up @@ -897,7 +897,7 @@ def test_vectorize_dask_dtype_meta():
vectorize=True,
dask="parallelized",
output_dtypes=[int],
meta=np.ndarray((0, 0), dtype=np.float),
dask_gufunc_kwargs=dict(meta=np.ndarray((0, 0), dtype=np.float)),
)

assert_identical(expected, actual)
Expand Down Expand Up @@ -1129,7 +1129,7 @@ def test_vectorize_dask_new_output_dims():
vectorize=True,
dask="parallelized",
output_dtypes=[float],
output_sizes={"z": 1},
dask_gufunc_kwargs=dict(output_sizes={"z": 1}),
).transpose(*expected.dims)
assert_identical(expected, actual)

Expand All @@ -1141,7 +1141,7 @@ def test_vectorize_dask_new_output_dims():
vectorize=True,
dask="parallelized",
output_dtypes=[float],
output_sizes={"z1": 1},
dask_gufunc_kwargs=dict(output_sizes={"z1": 1}),
)

with raises_regex(
Expand Down

0 comments on commit ac38d19

Please sign in to comment.