openpiv.validation.local_median_val

openpiv.validation.local_median_val(u, v, u_threshold, v_threshold, size=1)[source]

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.

The image masked areas (obstacles, reflections) are marked as masked array:

u = np.ma.masked(u, mask = image_mask)

and it should not be replaced by the local median, but remain masked.

Parameters
  • u (2d np.ndarray) – a two dimensional array containing the u velocity component.

  • v (2d np.ndarray) – a two dimensional array containing the v velocity component.

  • u_threshold (float) – the threshold value for component u

  • v_threshold (float) – the threshold value for component v

Returns

mask – a boolean array. True elements corresponds to outliers.

Return type

boolean 2d np.ndarray