def outlier_from_local_median(piv, treshold=2.0):
"""Outlier detection algorithm for mask creation.
The calculated residual is compared to a threshold which produces a mask.
The mask consists of nan values at the outlier positions.
This mask can be interpolated to remove the outliers.
:param object piv: Piv Class Object
:param double threshold: threshold for identifying outliers
"""
u_res = get_normalized_residual(piv.u)
v_res = get_normalized_residual(piv.v)
res_total = np.sqrt(u_res**2 + v_res**2)
mask = res_total > treshold
piv.u[mask] = np.nan
piv.v[mask] = np.nan
评论列表
文章目录