Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added estimator madogram #332

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/gstools/variogram/estimator.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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':
LSchueler marked this conversation as resolved.
Show resolved Hide resolved
estimator_func = estimator_madogram
else: # estimator_type == 'c'
estimator_func = estimator_cressie
return estimator_func
Expand Down
3 changes: 3 additions & 0 deletions src/gstools/variogram/variogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
LSchueler marked this conversation as resolved.
Show resolved Hide resolved
elif estimator.lower() == "cressie":
cython_estimator = "c"
else:
Expand Down Expand Up @@ -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
LSchueler marked this conversation as resolved.
Show resolved Hide resolved

Default: "matheron"
latlon : :class:`bool`, optional
Expand Down