From 138e18d87b662673395c90775ee45de72f4c134d Mon Sep 17 00:00:00 2001 From: Victor Ezekiel Date: Fri, 24 Nov 2023 06:26:26 +0100 Subject: [PATCH 1/4] add madogram --- src/gstools/variogram/estimator.pyx | 5 +++++ src/gstools/variogram/variogram.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/gstools/variogram/estimator.pyx b/src/gstools/variogram/estimator.pyx index 611f5efb..9828ba33 100644 --- a/src/gstools/variogram/estimator.pyx +++ b/src/gstools/variogram/estimator.pyx @@ -96,6 +96,9 @@ cdef inline double estimator_matheron(const double f_diff) nogil: cdef inline double estimator_cressie(const double f_diff) nogil: return sqrt(fabs(f_diff)) +cdef inline double estimator_madogram(const double f_diff) nogil: + return fabs(f_diff) + ctypedef double (*_estimator_func)(const double) nogil cdef inline void normalization_matheron( @@ -151,6 +154,8 @@ cdef _estimator_func choose_estimator_func(str estimator_type): cdef _estimator_func estimator_func if estimator_type == 'm': estimator_func = estimator_matheron + elif estimator_type == 'f': + estimator_func = estimator_madogram else: # estimator_type == 'c' estimator_func = estimator_cressie return estimator_func diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index 69746658..30550f5f 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -53,6 +53,8 @@ def _set_estimator(estimator): """Translate the verbose Python estimator identifier to single char.""" if estimator.lower() == "matheron": cython_estimator = "m" + elif estimator.lower() == "madogram": + cython_estimator = "f" elif estimator.lower() == "cressie": cython_estimator = "c" else: @@ -157,6 +159,7 @@ def vario_estimate( * "matheron": the standard method of moments of Matheron * "cressie": an estimator more robust to outliers + * "madogram": an esitmator for Madogram Default: "matheron" latlon : :class:`bool`, optional From c4cc8d017f52791006e49500352ed098d2be6d62 Mon Sep 17 00:00:00 2001 From: Victor Ezekiel <43010620+ibkvictor@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:51:43 +0100 Subject: [PATCH 2/4] Update variogram.py --- src/gstools/variogram/variogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index 30550f5f..af4765c1 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -159,7 +159,7 @@ def vario_estimate( * "matheron": the standard method of moments of Matheron * "cressie": an estimator more robust to outliers - * "madogram": an esitmator for Madogram + * "madogram": an estimator for Madogram Default: "matheron" latlon : :class:`bool`, optional From 8692f5f473d8543a644f177c8a63d6227142467c Mon Sep 17 00:00:00 2001 From: Victor Ezekiel <43010620+ibkvictor@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:57:34 +0100 Subject: [PATCH 3/4] Update variogram.py based on commit resolve discussion. estimator changed to `a`. --- src/gstools/variogram/variogram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index af4765c1..52ca07f5 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -54,7 +54,7 @@ def _set_estimator(estimator): if estimator.lower() == "matheron": cython_estimator = "m" elif estimator.lower() == "madogram": - cython_estimator = "f" + cython_estimator = "a" elif estimator.lower() == "cressie": cython_estimator = "c" else: From c6af7091ca2eff18b1e99974ad8f6b62e7f436cd Mon Sep 17 00:00:00 2001 From: Victor Ezekiel <43010620+ibkvictor@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:37:18 +0100 Subject: [PATCH 4/4] Update variogram.py included relevant citation. --- src/gstools/variogram/variogram.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gstools/variogram/variogram.py b/src/gstools/variogram/variogram.py index 52ca07f5..15e69639 100644 --- a/src/gstools/variogram/variogram.py +++ b/src/gstools/variogram/variogram.py @@ -110,6 +110,15 @@ def vario_estimate( with :math:`r_k \leq \| \mathbf x_i - \mathbf x_i' \| < r_{k+1}` being the bins. + Or if the estimator "f-madogram" was chosen: + .. math:: + \gamma(r_k) = \frac{1}{2 N(r_k)} \sum_{i=1}^{N(r_k)} |z(\mathbf x_i) - + z(\mathbf x_i')| \; , + + with :math: `r_k \leq \| \mathbf x_i - \mathbf x_i' \| < r_{k+1}` + being the bins. + The F-madogram estimator is prefered for extreme values [Cooley2006]_. Also see [Neves2011]_. + Or if the estimator "cressie" was chosen: .. math::