gstools.variogram

GStools subpackage providing tools for estimating and fitting variograms.

Variogram estimation

vario_estimate_unstructured(pos, field, …) Estimates the variogram on a unstructured grid.
vario_estimate_structured(field[, direction]) Estimates the variogram on a regular grid.

gstools.variogram.vario_estimate_unstructured(pos, field, bin_edges, sampling_size=None, sampling_seed=None)[source]

Estimates the variogram on a unstructured grid.

The algorithm calculates following equation:

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

r_k \leq \| \mathbf x_i - \mathbf x_i' \| < r_{k+1}

Notes

Internally uses double precision and also returns doubles.

Parameters:
  • pos (list) – the position tuple, containing main direction and transversal directions
  • field (numpy.ndarray) – the spatially distributed data
  • bin_edges (numpy.ndarray) – the bins on which the variogram will be calculated
  • sampling_size (int or None, optional) – for large input data, this method can take a long time to compute the variogram, therefore this argument specifies the number of data points to sample randomly Default: None
  • sampling_seed (int or None, optional) – seed for samples if sampling_size is given. Default: None
Returns:

the estimated variogram and the bin centers

Return type:

tuple of numpy.ndarray

gstools.variogram.vario_estimate_structured(field, direction='x')[source]

Estimates the variogram on a regular grid.

The indices of the given direction are used for the bins. The algorithm calculates following equation:

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

r_k \leq \| \mathbf x_i - \mathbf x_i' \| < r_{k+1}

Warning

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

Notes

Internally uses double precision and also returns doubles.

Parameters:
  • field (numpy.ndarray) – the spatially distributed data
  • direction (str) – the axis over which the variogram will be estimated (x, y, z)
Returns:

the estimated variogram along the given direction.

Return type:

numpy.ndarray