code: def windowed_run_count_ufunc(x, window):
      
      return xr.apply_ufunc(windowed_run_count_1d,
                            x,
                            input_core_dims=[['time'], ],
                            vectorize=True,
                            dask='parallelized',
                            output_dtypes=[np.int, ],
                            keep_attrs=True,
                            kwargs={'window': window})
docs: Dask-parallel version of windowed_run_count_1d, ie the number of consecutive true values in
      array for runs at least as long as given duration.
  
      Parameters
      ----------
      x : bool array
        Input array
      window : int
        Minimum duration of consecutive run to accumulate values.
  
      Returns
      -------
      out : func
        A function operating along the time dimension of a dask-array.