gstools.variogram.vario_estimate_axis(field, direction='x', estimator='matheron', no_data=nan)[source]

Estimates the variogram along array axis.

The indices of the given direction are used for the bins. Uniform spacings along the given axis are assumed.

The algorithm calculates following equation:

\[\gamma(r_k) = \frac{1}{2 N(r_k)} \sum_{i=1}^{N(r_k)} (z(\mathbf x_i) - z(\mathbf x_i'))^2 \; ,\]

with \(r_k \leq \| \mathbf x_i - \mathbf x_i' \| < r_{k+1}\) being the bins.

Or if the estimator “cressie” was chosen:

\[\gamma(r_k) = \frac{\frac{1}{2}\left(\frac{1}{N(r_k)}\sum_{i=1}^{N(r_k)} \left|z(\mathbf x_i) - z(\mathbf x_i')\right|^{0.5}\right)^4} {0.457 + 0.494 / N(r_k) + 0.045 / N^2(r_k)} \; ,\]

with \(r_k \leq \| \mathbf x_i - \mathbf x_i' \| < r_{k+1}\) being the bins. The Cressie estimator is more robust to outliers [Webster2007].

  • field (numpy.ndarray or – the spatially distributed data (can be masked)

  • direction (str or int) – the axis over which the variogram will be estimated (x, y, z) or (0, 1, 2, …)

  • estimator (str, optional) –

    the estimator function, possible choices:

    • “matheron”: the standard method of moments of Matheron

    • “cressie”: an estimator more robust to outliers

    Default: “matheron”

  • no_data (float, optional) – Value to identify missing data in the given field. Default: numpy.nan


the estimated variogram along the given direction.

Return type



It is assumed that the field is defined on an equidistant Cartesian grid.


Internally uses double precision and also returns doubles.



Webster, R. and Oliver, M. A. “Geostatistics for environmental scientists.”, John Wiley & Sons. (2007)