xoa.filter.generate_kernel

xoa.filter.generate_kernel(kernel, data, isotropic=False, window_func='ones', fill_value=0.0, window_args=None, window_kwargs=None)[source]

Generate a kernel that is compatible with a given data array

Parameters
  • kernel (xarray.DataArray, np.ndarray, int, list, dictorthokernels) –

    Ready to use kernel or specs to generate it.

    • If an int, the kernel built with ones with a size of kernel along all dimensions.

    • If a tuple, the kernel is built with ones and a shape equal to kernel.

    • If a numpy array, it is used as is.

    The final data array is transposed and/or expanded with xoa.coords.transpose() to fit into the input data array.

  • data (xarray.DataArray) – Data array that the kernel must be compatible with

  • isotropic (bool, tuple) – Tuple of the dimensions over which must be computed isotropically.

Returns

xarray.DataArray – Kernel array with suitable dimensions and shape