prtools.medfix#

medfix(input, mask, kernel=(3, 3), nanwarn=False)[source]#

Fix masked entries in a 2-dimensional array via median filtering.

Parameters:
  • input (array_like) – A 2-dimensional input array

  • mask (array_like) – A 2-dimensional mask with the same shape as input. Entries which evaluate to True are considered masked and will be repaired.

  • kernel (array_like, optional) – A scalar or list of length 2 specifying the filter window in each dimension. Elements of kernel should be odd. If kernel is a scalar, it is used for each dimension. Default is (3,3).

  • nanwarn (bool, optional) – If True, a RuntimeWarning will be raised if NaNs are present in the output. Default is False.

Return type:

ndarray

Notes

Masked areas larger than the kernel size will introduce NaNs into the output.