xoa.filter.generate_kernel
- xoa.filter.generate_kernel(kernel, data, window_func='ones', isotropic=False, fill_value=0.0, window_kwargs=None, **kwargs)[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. If the kernel has more than one dimension, it is expanded with a size of 1 for missing dimensions.
isotropic (bool, tuple) – Tuple of the dimensions over which must be computed isotropically.
fill_value (float) – Value used by
generate_isotropic_kernel()
to fill the isotropic kernel in its corners.window_func (str) – Function to generate the kernel from its size by calling
get_window_func()
window_kwargs (dict) – Optional arguments passed to
get_window_func()
kwargs (dict) – Extra parameters are merged with window_kwargs
- Returns:
xarray.DataArray – Kernel array with suitable dimensions and shape