openpiv.filters.replace_outliers

openpiv.filters.replace_outliers(u, v, method='localmean', n_iter=5, kernel_size=1)

Replace nans in an velocity field using an iterative image inpainting algorithm.

The algorithm is the following:

  1. For each element in the arrays of the u and v components, replace it by a weighted average of the neighbouring elements which are not nan. The weights depends of the method type. If method=localmean weight are equal to 1/( (2*kernel_size+1)**2 -1 )
  2. Several iterations are needed if there are adjacent nan elements. If this is the case, inforation is “spread” from the edges of the missing regions iteratively, until the variation is below a certain threshold.
Parameters :

u : 2d np.ndarray

the u velocity component field

v : 2d np.ndarray

the v velocity component field

n_iter : int

the number of iterations

kernel_size : int

the size of the kernel, default is 1

method : str

the method used to replace nans. Valid options are localmean.

Returns :

uf : 2d np.ndarray

the smoothed u velocity component field, where nans have been replaced

vf : 2d np.ndarray

the smoothed v velocity component field, where nans have been replaced

Previous topic

openpiv.filters._gaussian_kernel

Next topic

openpiv.validation.global_val

This Page