def dowd(X):
"""
Return the Dowd Variogram of the given sample X.
X has to be an even-length array of point pairs like: x1, x1+h, x2, x2+h ...., xn, xn + h.
If X.ndim > 1, dowd will be called recursively and a list of Cressie-Hawkins Variances is returned.
Dowd, P. A., (1984): The variogram and kriging: Robust and resistant estimators, in Geostatistics for Natural
Resources Characterization. Edited by G. Verly et al., pp. 91 - 106, D. Reidel, Dordrecht.
:param X:
:return:
"""
_X = np.array(X)
if any([isinstance(_, list) or isinstance(_, np.ndarray) for _ in _X]):
return np.array([dowd(_) for _ in _X])
# check even
if len(_X) % 2 > 0:
raise ValueError('The sample does not have an even length: {}'.format(_X))
# calculate
term1 = np.nanmedian([np.abs(_X[i] - _X[i + 1]) for i in np.arange(0, len(_X) - 1, 2)])
return 0.5 * (2.198 * np.power(term1, 2))
评论列表
文章目录