anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: ouranosinc/xclim
Issue: Dask of june breaks xclim

The most recent dask release deprecated (with no warning) passing both `meta` and `output_dtypes` to `apply_gfunc` which is itself called by `xarray.apply_ufunc` when `dask='parallelized'`.

The fix is simply to remove one of them, dask recommends using `meta`. AFAIK, this will be retrocompatible.

Changed files:
xclim/indices/fwi.py, xclim/sdba/utils.py

diff --git a/xclim/indices/fwi.py b/xclim/indices/fwi.py
index 92e166d1..f4435a64 100644
--- a/xclim/indices/fwi.py
+++ b/xclim/indices/fwi.py
@@ -1118,7 +1118,6 @@ def fire_weather_ufunc(
         input_core_dims=input_core_dims,
         output_core_dims=output_core_dims,
         dask="parallelized",
-        output_dtypes=output_dtypes,
         dask_gufunc_kwargs={
             "meta": tuple(np.array((), dtype=dtype) for dtype in output_dtypes)
         },
diff --git a/xclim/sdba/utils.py b/xclim/sdba/utils.py
index 78879806..ee12c190 100644
--- a/xclim/sdba/utils.py
+++ b/xclim/sdba/utils.py
@@ -656,7 +656,6 @@ def get_clusters(data: xr.DataArray, u1, u2, dim: str = "time"):
         input_core_dims=[[dim], [], []],
         output_core_dims=[["cluster"], ["cluster"], ["cluster"], ["cluster"], []],
         kwargs={"N": N},
-        output_dtypes=[int, int, int, data.dtype, int],
         dask="parallelized",
         vectorize=True,
         dask_gufunc_kwargs={
Repository: ouranosinc/xclim
Issue: Documentation failing due to advanced SDBA notebook

Not sure why the build checks didn't catch this, but it looks like something in the sdba-advanced notebook is crashing the ReadTheDocs Jupyter kernels:
```
...
reading sources... [ 79%] notebooks/sdba-advanced
/home/docs/checkouts/readthedocs.org/user_builds/xclim/envs/latest/lib/python3.6/importlib/__init__.py:126: FutureWarning: Submodule 'checks' is deprecated in favor of 'cfchecks', 'datachecks' and 'missing'. It will be removed in xclim 0.19
  return _bootstrap._gcd_import(name[level:], package, level)
ERROR:traitlets:Kernel died while waiting for execute reply.
/home/docs/checkouts/readthedocs.org/user_builds/xclim/envs/latest/lib/python3.6/site-packages/xclim/ensembles.py:docstring of xclim.ensembles.create_ensemble:33: WARNING: Inline emphasis start-string without end-string.
/home/docs/checkouts/readthedocs.org/user_builds/xclim/envs/latest/lib/python3.6/site-packages/xclim/ensembles.py:docstring of xclim.ensembles.create_ensemble:37: WARNING: Inline emphasis start-string without end-string.
../HISTORY.rst:31: WARNING: duplicate label new features and enhancements, other instance in /home/docs/checkouts/readthedocs.org/user_builds/xclim/checkouts/latest/docs/history.rst
/home/docs/checkouts/readthedocs.org/user_builds/xclim/checkouts/latest/docs/itable.rst:2: WARNING: Field list ends without a blank line; unexpected unindent.
```

Changed files:
xclim/sdba/loess.py

diff --git a/xclim/sdba/loess.py b/xclim/sdba/loess.py
index c6b4fca6..11235b46 100644
--- a/xclim/sdba/loess.py
+++ b/xclim/sdba/loess.py
@@ -72,16 +72,14 @@ def _loess_nb(
     r = int(np.round(f * n))
     yest = np.zeros(n)
     delta = np.ones(n)
-    weights = np.empty((n, n))
-    for i in range(n):
-        diffs = np.abs(x - x[i])
-        h = np.sort(diffs)[r]
-        w = diffs / h
-        weights[:, i] = weight_func(w)
 
     for iteration in range(niter):
         for i in range(n):
-            w = delta * weights[:, i]
+            # The weights computation is repeater niter times
+            # The loss in speed is a clear gain in memory
+            diffs = np.abs(x - x[i])
+            h = np.sort(diffs)[r]
+            w = delta * weight_func(diffs / h)
             yest[i] = reg_func(x[i], x, y, w)
 
         if iteration < niter - 1: