openpiv_cxx.validate.local_median¶
- openpiv_cxx.validate.local_median(u, v, mask=None, threshold_u=3.0, threshold_v=3.0, threshold=None, size=2, kernel_min_size=1, convention='openpiv')¶
Eliminate spurious vectors with a local median threshold.
This validation method tests for the spatial consistency of the data. Vectors are classified as outliers and replaced with Nan (Not a Number) if the absolute difference with the local median is greater than a user specified threshold. The median is computed for both velocity components.
- Parameters:
u (ndarray) – A two dimensional array containing the u velocity component.
v (ndarray) – A two dimensional array containing the v velocity component.
mask (ndarray, optional) – A two dimensional array containing the flags for invalid vectors.
threshold_u (float) – Threshold for u component.
threshold_v (float) – Threshold for v component.
threshold (float, optional) – Set thresholds for both u and v components.
size (int) – The radius of the median kernel.
kernel_min_size (int) – The minimum amount of non-NaN values in a kernel. If less, the kernel is marked as invalid due to not enough valid points.
convention (str) – Which flag convention to use.
- Returns:
u (ndarray, optional) – A two dimensional array containing the u velocity component, where spurious vectors have been replaced by NaN if convention is set to ‘openpiv’.
v (ndarray, optional) – A two dimensional array containing the v velocity component, where spurious vectors have been replaced by NaN if convention is set to ‘openpiv’.
mask (ndarray) – A boolean or integer array where elemtents that = 0 are valid and 1 = invalid.