Experimental Semivariance and Covariance#

Experimental Variogram#

class pyinterpolate.ExperimentalVariogram(ds: ArrayLike | VariogramPoints = None, values: ArrayLike = None, geometries: ArrayLike = None, step_size: float = None, max_range: float = None, direction: float = None, tolerance: float = None, custom_bins: ndarray | Collection = None, custom_weights: ndarray = None, drop_lags_without_pairs: bool = True, is_semivariance: bool = True, is_covariance: bool = True, as_cloud: bool = False)[source]

Class calculates Experimental Semivariogram and Experimental Covariogram of a given dataset.

Parameters:
dsnumpy array

[x, y, value]

valuesArrayLike, optional

Observation in the i-th geometry (from geometries). Optional parameter, if not given then ds must be provided.

geometriesArrayLike, optional

Array or similar structure with geometries. It must have the same length as values. Optional parameter, if not given then ds must be provided. Point type geometry.

step_sizefloat

The fixed distance between lags grouping point neighbors.

max_rangefloat

The maximum distance at which the semivariance is calculated.

directionfloat, optional

Direction of semivariogram, values from 0 to 360 degrees:

  • 0 or 180: is E-W,

  • 90 or 270 is N-S,

  • 45 or 225 is NE-SW,

  • 135 or 315 is NW-SE.

tolerancefloat, optional

If tolerance is 0 then points must be placed at a single line with the beginning in the origin of the coordinate system and the direction given by y-axis and direction parameter. If tolerance is > 0 then the bin is selected as an elliptical area with major axis pointed in the same direction as the line for 0 tolerance.

  • The major axis size == step_size.

  • The minor axis size is tolerance * step_size

  • The baseline point is at a center of the ellipse.

  • The tolerance == 1 creates an omnidirectional semivariogram.

custom_binsnumpy array, optional

Custom bins for semivariance calculation. If provided, then parameter step_size is ignored and max_range is set to the final bin distance.

custom_weightsnumpy array, optional

Custom weights assigned to points. Only semivariance values are weighted.

drop_lags_without_pairsbool, default=True

Drops lags when there are no point pairs within.

is_semivariancebool, default=True

Calculate experimental semivariance.

is_covariancebool, default=True

Calculate experimental coviariance.

as_cloudbool

Calculate semivariance point-pairs cloud.

Attributes:
semivariancesnumpy array

1-D array with semivariances ordered by lags.

Methods

plot()

Shows experimental variances.

See also

calculate_covariance

function to calculate experimental covariance

calculate_semivariance

function to calculate experimental semivariance

Examples

>>> import numpy as np
>>> from pyinterpolate import ExperimentalVariogram
>>>
>>>
>>> REFERENCE_INPUT = np.array([
...    [0, 0, 8],
...    [1, 0, 6],
...    [2, 0, 4],
...    [3, 0, 3],
...    [4, 0, 6],
...    [5, 0, 5],
...    [6, 0, 7],
...    [7, 0, 2],
...    [8, 0, 8],
...    [9, 0, 9],
...    [10, 0, 5],
...    [11, 0, 6],
...    [12, 0, 3]
...    ])
>>> STEP_SIZE = 1
>>> MAX_RANGE = 4
>>> empirical_smv = ExperimentalVariogram(
...     values=REFERENCE_INPUT[:, -1],
...     geometries=REFERENCE_INPUT[:, :-1],
...     step_size=STEP_SIZE,
...     max_range=MAX_RANGE
... )
>>> print(empirical_smv)
+-----+--------------------+---------------------+
| lag |    semivariance    |      covariance     |
+-----+--------------------+---------------------+
| 1.0 |       4.625        | -0.5434027777777798 |
| 2.0 | 5.2272727272727275 | -0.7954545454545454 |
| 3.0 |        6.0         | -1.2599999999999958 |
+-----+--------------------+---------------------+
plot(semivariance=True, covariance=True, variance=True) None[source]

Plots semivariance, covariance, and variance.

Parameters:
semivariancebool, default=True

Show semivariance on a plot. If class attribute is_semivariance is set to False then semivariance is not plotted and warning is printed.

covariancebool, default=True

Show covariance on a plot. If class attribute is_covariance is set to False then covariance is not plotted and warning is printed.

variancebool, default=True

Show variance level on a plot.

Warns:
AttributeSetToFalseWarning

Warning invoked when plotting parameter for semivariance, covariance or variance is set to True but class attributes to calculate those indices are set to False.

pyinterpolate.build_experimental_variogram(ds: ArrayLike | VariogramPoints = None, values: ArrayLike = None, geometries: ArrayLike = None, step_size: float = None, max_range: float = None, direction: float = None, tolerance: float = None, custom_bins: ndarray | Collection = None, custom_weights: ndarray = None, is_semivariance=True, is_covariance=True, as_cloud=False)[source]

Function is an alias to ExperimentalVariogram().

Parameters:
dsnumpy array

[x, y, value]

valuesArrayLike, optional

Observation in the i-th geometry (from geometries). Optional parameter, if not given then ds must be provided.

geometriesArrayLike, optional

Array or similar structure with geometries. It must have the same length as values. Optional parameter, if not given then ds must be provided. Point type geometry.

step_sizefloat

The fixed distance between lags grouping point neighbors.

max_rangefloat

The maximum distance at which the semivariance is calculated.

directionfloat, optional

Direction of semivariogram, values from 0 to 360 degrees:

  • 0 or 180: is E-W,

  • 90 or 270 is N-S,

  • 45 or 225 is NE-SW,

  • 135 or 315 is NW-SE.

tolerancefloat, optional

If tolerance is 0 then points must be placed at a single line with the beginning in the origin of the coordinate system and the direction given by y-axis and direction parameter. If tolerance is > 0 then the bin is selected as an elliptical area with major axis pointed in the same direction as the line for 0 tolerance.

  • The major axis size == step_size.

  • The minor axis size is tolerance * step_size

  • The baseline point is at a center of the ellipse.

  • The tolerance == 1 creates an omnidirectional semivariogram.

custom_binsnumpy array, optional

Custom bins for semivariance calculation. If provided, then parameter step_size is ignored and max_range is set to the final bin distance.

custom_weightsnumpy array, optional

Custom weights assigned to points. Only semivariance values are weighted.

is_semivariancebool, default=True

Calculate experimental semivariance.

is_covariancebool, default=True

Calculate experimental coviariance.

as_cloudbool

Calculate semivariance point-pairs cloud.

Returns:
: ExperimentalVariogram

Examples

>>> import numpy as np
>>> from pyinterpolate import build_experimental_variogram
>>>
>>>
>>> REFERENCE_INPUT = np.array([
...    [0, 0, 8],
...    [1, 0, 6],
...    [2, 0, 4],
...    [3, 0, 3],
...    [4, 0, 6],
...    [5, 0, 5],
...    [6, 0, 7],
...    [7, 0, 2],
...    [8, 0, 8],
...    [9, 0, 9],
...    [10, 0, 5],
...    [11, 0, 6],
...    [12, 0, 3]
...    ])
>>> STEP_SIZE = 1
>>> MAX_RANGE = 4
>>> empirical_smv = build_experimental_variogram(
...     values=REFERENCE_INPUT[:, -1],
...     geometries=REFERENCE_INPUT[:, :-1]
...     step_size=STEP_SIZE,
...     max_range=MAX_RANGE
... )
>>> print(empirical_smv)
+-----+--------------------+---------------------+
| lag |    semivariance    |      covariance     |
+-----+--------------------+---------------------+
| 1.0 |       4.625        | -0.5434027777777798 |
| 2.0 | 5.2272727272727275 | -0.7954545454545454 |
| 3.0 |        6.0         | -1.2599999999999958 |
+-----+--------------------+---------------------+
pyinterpolate.calculate_semivariance(ds: ArrayLike | VariogramPoints = None, values: ArrayLike = None, geometries: ArrayLike = None, step_size: float = None, max_range: float = None, direction: float = None, tolerance: float = None, custom_bins: ArrayLike | Any = None, custom_weights: ArrayLike = None) ndarray[source]

Calculates experimental semivariance.

Parameters:
dsArrayLike, optional

[x, y, value]

valuesArrayLike, optional

Observation in the i-th geometry (from geometries). Optional parameter, if not given then ds must be provided.

geometriesArrayLike, optional

Array or similar structure with geometries. It must have the same length as values. Optional parameter, if not given then ds must be provided. Point type geometry.

step_sizefloat

The fixed distance between lags grouping point neighbors.

max_rangefloat

The maximum distance at which the semivariance is calculated.

directionfloat, optional

Direction of semivariogram, values from 0 to 360 degrees:

  • 0 or 180: is E-W,

  • 90 or 270 is N-S,

  • 45 or 225 is NE-SW,

  • 135 or 315 is NW-SE.

tolerancefloat, optional

If tolerance is 0 then points must be placed at a single line with the beginning in the origin of the coordinate system and the direction given by y axis and direction parameter. If tolerance is > 0 then the bin is selected as an elliptical area with major axis pointed in the same direction as the line for 0 tolerance.

  • The major axis size == step_size.

  • The minor axis size is tolerance * step_size

  • The baseline point is at a center of the ellipse.

  • The tolerance == 1 creates an omnidirectional semivariogram.

custom_binsArrayLike, optional

Custom bins for semivariance calculation. If provided, then parameter step_size is ignored and max_range is set to the final bin distance.

custom_weightsArrayLike, optional

Custom weights assigned to points.

Returns:
semivarianceArrayLike

[lag, semivariance, number of point pairs]

Notes

# Semivariance

It is a measure of dissimilarity between points over distance. We assume that the close observations tend to be similar (see Tobler’s Law). Distant observations are less and less similar up to the distance where the influence of one point value on the other is negligible.

We calculate the empirical semivariance as:

\[g(h) = 0.5 * \frac{1}{n(h)} * \sum_{i=1}^{n(h)}{[z(x_i + h) - z(x_i)]^2}\]

where:

  • \(h\): lag,

  • \(n(h)\): number of point pairs within the lag \(h\),

  • \(g(h)\): empirical semivariance for lag \(h\),

  • \(n(h)\): number of point pairs within a specific lag,

  • \(z(x_i)\): point a (value of observation at point a),

  • \(z(x_i + h)\): point b in distance h from point a (value of observation at point b).

As an output we get array of lags \(h\), semivariances \(g\) and number of points within each lag \(n\).

# Weighted Semivariance

Sometimes, we need to weight each point by a specific factor. It is especially important for the semivariogram deconvolution and Poisson Kriging. The weighting factor could be the time effort for observation at a location (ecology) or population size at a specific block (public health). Implementation of the algorithm follows publications:

1. A. Monestiez P, Dubroca L, Bonnin E, Durbec JP, Guinet C: Comparison of model based geostatistical methods in ecology: application to fin whale spatial distribution in northwestern Mediterranean Sea. In Geostatistics Banff 2004 Volume 2. Edited by: Leuangthong O, Deutsch CV. Dordrecht, The Netherlands, Kluwer Academic Publishers; 2005:777-786.

2. B. Monestiez P, Dubroca L, Bonnin E, Durbec JP, Guinet C: Geostatistical modelling of spatial distribution of Balenoptera physalus in the northwestern Mediterranean Sea from sparse count data and heterogeneous observation efforts. Ecological Modelling 2006.

We calculate the weighted empirical semivariance as:

\[g_w(h) = 0.5 * (SUM|i=1, n(h)|: w(h))^(-1) * (SUM|i=1, n(h)|: w(h) * z_w(h))\]
\[w(h) = [n(x_i) * n(x_i + h)] / [n(u_i) + n(u_i + h)]\]
\[z_w(h) = (z(x_i) - z(x_i + h))^2 - m'\]

where:

  • \(h\): lag,

  • \(g_w(h)\): weighted empirical semivariance for lag \(h\),

  • \(n(h)\): number of point pairs within a specific lag,

  • \(z(x_i)\): point a (rate of specific process at point a),

  • \(z(x_i + h)\): point b in distance \(h\) from point a (rate of specific process at point b),

  • \(n(x_i)\): denominator value size at point a (time, population …),

  • \(n(x_i + h)\): denominator value size at point b in distance \(h\) from point a,

  • \(m'\): weighted mean of rates.

The output of weighted algorithm is the same as for non-weighted data: array of lags \(h\), semivariances \(g\) and number of points within each lag \(n\).

# Directional Semivariogram

The assumption that our observations change in the same way in every direction is rarely true. Let’s consider temperature. It changes from the equator to the poles so in the N-S and S-N axes. The good idea is to test the correlation of our observations in a few different directions. The main difference between an omnidirectional semivariogram and a directional semivariogram is that we take into account a different subset of neighbors:

  • Omnidirectional semivariogram: we test neighbors in a circle,

  • Directional semivariogram: we test neighbors within an ellipse, and one direction is major.

Examples

>>> import numpy as np
>>> from pyinterpolate import calculate_semivariance
>>>
>>>
>>> REFERENCE_INPUT = np.array([
...    [0, 0, 8],
...    [1, 0, 6],
...    [2, 0, 4],
...    [3, 0, 3],
...    [4, 0, 6],
...    [5, 0, 5],
...    [6, 0, 7],
...    [7, 0, 2],
...    [8, 0, 8],
...    [9, 0, 9],
...    [10, 0, 5],
...    [11, 0, 6],
...    [12, 0, 3]
...    ])
>>> STEP_SIZE = 1
>>> MAX_RANGE = 4
>>> semivariances = calculate_semivariance(
...    values=REFERENCE_INPUT[:, -1],
...    geometries=REFERENCE_INPUT[:, :-1],
...    step_size=STEP_SIZE,
...    max_range=MAX_RANGE)
>>> print(semivariances[0])
[ 1.     4.625 24.   ]
pyinterpolate.calculate_covariance(ds: ArrayLike | VariogramPoints = None, values: ArrayLike = None, geometries: ArrayLike = None, step_size: float = None, max_range: float = None, direction: float = None, tolerance: float = None, custom_bins: Any | ndarray = None) ndarray[source]

Calculates experimental covariance.

Parameters:
dsArrayLike, optional

[x, y, value]

valuesArrayLike, optional

Observation in the i-th geometry (from geometries). Optional parameter, if not given then ds must be provided.

geometriesArrayLike, optional

Array or similar structure with geometries. It must have the same length as values. Optional parameter, if not given then ds must be provided. Point type geometry.

step_sizefloat

The fixed distance between lags grouping point neighbors.

max_rangefloat

The maximum distance at which the covariance is calculated.

directionfloat, optional

Direction of covariogram, values from 0 to 360 degrees:

  • 0 or 180: is E-W,

  • 90 or 270 is N-S,

  • 45 or 225 is NE-SW,

  • 135 or 315 is NW-SE.

tolerancefloat, optional

If tolerance is 0 then points must be placed at a single line with the beginning in the origin of the coordinate system and the direction given by y axis and direction parameter. If tolerance is > 0 then the bin is selected as an elliptical area with major axis pointed in the same direction as the line for 0 tolerance.

  • The major axis size == step_size.

  • The minor axis size is tolerance * step_size

  • The baseline point is at a center of the ellipse.

  • The tolerance == 1 creates an omnidirectional covariogram.

custom_binsnumpy array, optional

Custom bins for covariance calculation. If provided, then parameter step_size is ignored and max_range is set to the final bin distance.

Returns:
covariancenumpy array

[lag, covariance, number of point pairs]

Notes

# Covariance

It is a measure of similarity between points over different distances. We assume that the close observations tend to be similar (recall the Tobler’s Law).

We calculate the empirical covariance as:

\[covariance = 1 / (N) * SUM(i=1, N) [z(x_i + h) * z(x_i)] - u^2\]

where:

  • \(N\) - number of observation pairs,

  • \(h\) - distance (lag),

  • \(z(x_i)\) - value at location \(z_i\),

  • \((x_i + h)\) - location at a distance \(h\) from \(x_i\),

  • \(u\) - average value of observations at a given lag distance.

As an output we get array of lags \(h\), covariances \(c\) and number of points within each lag \(n\).

# Directional Covariogram

The assumption that our observations change in the same way in every direction is rarely true. Let’s consider temperature. It changes from the equator to the poles so in the N-S and S-N axes. The good idea is to test the correlation of our observations in a few different directions. The main difference between an omnidirectional covariogram and a directional covariogram is that we take into account a different subset of neighbors:

  • Omnidirectional covariogram: we test neighbors in a circle,

  • Directional covariogram: we test neighbors within an ellipse, and one direction is major.

Examples

>>> import numpy as np
>>> REFERENCE_INPUT = np.array([
...    [0, 0, 8],
...    [1, 0, 6],
...    [2, 0, 4],
...    [3, 0, 3],
...    [4, 0, 6],
...    [5, 0, 5],
...    [6, 0, 7],
...    [7, 0, 2],
...    [8, 0, 8],
...    [9, 0, 9],
...    [10, 0, 5],
...    [11, 0, 6],
...    [12, 0, 3]
...    ])
>>> STEP_SIZE = 1
>>> MAX_RANGE = 4
>>> covariances = calculate_covariance(
...     values=REFERENCE_INPUT[:, -1],
...     geometries=REFERENCE_INPUT[:, :-1],
...     step_size=STEP_SIZE,
...     max_range=MAX_RANGE
... )
>>> print(covariances[0][0])
[ 1.         -0.54340278 24.        ]
>>> print(covariances[1])
4.2485207100591715

Directional Variogram#

class pyinterpolate.DirectionalVariogram(step_size: float, max_range: float, ds: ArrayLike | VariogramPoints = None, values: ArrayLike = None, geometries: ArrayLike = None, tolerance: float = 0.2, custom_weights=None, custom_bins=None)[source]

Class prepares four directional variograms and isotropic variogram.

Parameters:
dsArrayLike, optional

[x, y, value]

valuesArrayLike, optional

Observation in the i-th geometry (from geometries). Optional parameter, if not given then ds must be provided.

geometriesArrayLike, optional

Array or similar structure with geometries. It must have the same length as values. Optional parameter, if not given then ds must be provided. Point type geometry.

step_sizefloat

The fixed distance between lags grouping point neighbors.

max_rangefloat

The maximum distance at which the semivariance is calculated.

tolerancefloat, optional

If tolerance is 0 then points must be placed at a single line with the beginning in the origin of the coordinate system and the direction given by y-axis and direction parameter. If tolerance is > 0 then the bin is selected as an elliptical area with major axis pointed in the same direction as the line for 0 tolerance.

  • The major axis size == step_size.

  • The minor axis size is tolerance * step_size

  • The baseline point is at a center of the ellipse.

  • The tolerance == 1 creates an omnidirectional semivariogram.

custom_binsnumpy array, optional

Custom bins for semivariance calculation. If provided, then parameter step_size is ignored and max_range is set to the final bin distance.

custom_weightsnumpy array, optional

Custom weights assigned to points. Only semivariance values are weighted.

Attributes:
directional_variogramsDict

Dictionary with five variograms:

  • ISO: isotropic,

  • NS: North-South axis,

  • WE: West-East axis,

  • NE-SW: Northeastern-Southwestern axis,

  • NW-SE: Northwestern-Southeastern axis.

directionsDict

Dictionary where keys are directions: NS, WE, NE-SW, NW-SE, and values are angles: 90, 0, 45, 135

dsnumpy array

See ds parameter.

step_sizefloat

See step_size parameter.

max_rangefloat

See max_range parameter.

tolerancefloat

See tolerance parameter.

custom_binsnumpy array, optional

See custom_bins parameter.

custom_weightsfloat

See custom_weights parameter.

Methods

get()

Returns copy of calculated directional variograms or single variogram in a specific direction.

show()

Plot all variograms.

Examples

>>> import numpy as np
>>> from pyinterpolate import DirectionalVariogram
>>>
>>>
>>> ds = np.load('armstrong_data.npy')
>>> step_size = 1.5
>>> max_range = 6
>>> directional_variogram = DirectionalVariogram(
...     step_size=STEP_SIZE,
...     max_range=MAX_RANGE,
...     values=ds[:, -1],
...     geometries=ds[:, :-1]
... )
>>> variograms = directional_variogram.get()
>>> print(variograms.keys())
dict_keys(['ISO', 'NS', 'WE', 'NE-SW', 'NW-SE'])
>>> directional_variogram.show()  # shows variograms in all directions
get(direction=None) Dict | Type[ExperimentalVariogram][source]

Method returns all variograms or a single variogram in a specific direction.

Parameters:
directionstr, default = None

The direction of variogram from a list of possible_variograms attribute: “ISO”, “NS”, “WE”, “NE-SW”, “NW-SE”.

Returns:
: Union[Dict, Type[ExperimentalVariogram]]

The dictionary with variograms for all possible directions, or a single variogram for a specific direction.

show()[source]

Method shows variograms in all directions.

Variogram Cloud#

class pyinterpolate.VariogramCloud(ds: ArrayLike | VariogramPoints = None, values: ArrayLike = None, geometries: ArrayLike = None, step_size: float = None, max_range: float = None, direction: float = None, tolerance: float = None, custom_bins: ndarray | Collection = None, custom_weights: ndarray = None)[source]

Class calculates Variogram Point Cloud and presents it in a scatterplot, boxplot or violinplot.

Parameters:
dsnumpy array

[x, y, value]

valuesArrayLike, optional

Observation in the i-th geometry (from geometries). Optional parameter, if not given then ds must be provided.

geometriesArrayLike, optional

Array or similar structure with geometries. It must have the same length as values. Optional parameter, if not given then ds must be provided. Point type geometry.

step_sizefloat

The fixed distance between lags grouping point neighbors.

max_rangefloat

The maximum distance at which the semivariance is calculated.

directionfloat, optional

Direction of semivariogram, values from 0 to 360 degrees:

  • 0 or 180: is E-W,

  • 90 or 270 is N-S,

  • 45 or 225 is NE-SW,

  • 135 or 315 is NW-SE.

tolerancefloat, optional

If tolerance is 0 then points must be placed at a single line with the beginning in the origin of the coordinate system and the direction given by y-axis and direction parameter. If tolerance is > 0 then the bin is selected as an elliptical area with major axis pointed in the same direction as the line for 0 tolerance.

  • The major axis size == step_size.

  • The minor axis size is tolerance * step_size

  • The baseline point is at a center of the ellipse.

  • The tolerance == 1 creates an omnidirectional semivariogram.

custom_binsnumpy array, optional

Custom bins for semivariance calculation. If provided, then parameter step_size is ignored and max_range is set to the final bin distance.

custom_weightsnumpy array, optional

Custom weights assigned to points. Only semivariance values are weighted.

Attributes:
semivariancesDict

Lag - all semivariances between point pairs: {lag: [semivariances], }.

lagsArrayLike

Lags.

directionfloat

See direction parameter.

tolerancefloat

See tolerance parameter.

Methods

average_semivariance()

Returns lag, average semivariance, number of point pairs as a numpy array.

describe()

The point cloud statistics.

plot()

Plots scatterplot, boxplot or violinplot of the point cloud.

remove_outliers()

Removes outliers from the semivariance plots.

See also

ExperimentalVariogram

class that calculates experimental semivariogram, experimental covariogram and data variance.

Examples

>>> import numpy as np
>>> from pyinterpolate import VariogramCloud
>>>
>>>
>>> REFERENCE_INPUT = np.array([
...    [0, 0, 8],
...    [1, 0, 6],
...    [2, 0, 4],
...    [3, 0, 3],
...    [4, 0, 6],
...    [5, 0, 5],
...    [6, 0, 7],
...    [7, 0, 2],
...    [8, 0, 8],
...    [9, 0, 9],
...    [10, 0, 5],
...    [11, 0, 6],
...    [12, 0, 3]
...    ])
>>> STEP_SIZE = 1
>>> MAX_RANGE = 4
>>> vc = VariogramCloud(
...     values=REFERENCE_INPUT[:, -1],
...     geometries=REFERENCE_INPUT[:, :-1],
...     step_size=STEP_SIZE,
...     max_range=MAX_RANGE
... )
>>> stats = vc.describe()
>>> print(stats[1]['count'])
24
>>> print(stats[2]['median'])
9
average_semivariance()[source]

Returns mean of semivariances for each lag - which is equal to the experimental semivariogram output.

Returns:
: numpy array

Mean of semivariances for each lag.

describe(as_dataframe=False) Dict | DataFrame[source]

Method calculates basic statistics. Includes count (point pairs number), average semivariance, standard deviation, minimum, 1st quartile, median, 3rd quartile, maximum, skewness, and kurtosis.

Returns:
statisticsDict
>>> statistics = {
...      lag_number:
...      {
...          'count': point pairs count,
...          'mean': mean semivariance,
...          'std': standard deviation,
...          'min': minimal variance,
...          '25%': first quartile of variances,
...          'median': second quartile of variances,
...          '75%': third quartile of variances,
...          'max': max variance,
...          'skewness': skewness,
...          'kurtosis': kurtosis
...      }
...  }
experimental_semivariances() ExperimentalVariogram[source]

Returns experimental semivariogram.

Returns:
: ExperimentalVariogram

Experimental semivariogram object.

plot(kind='scatter')[source]

Method plots variogram point cloud.

Parameters:
kindstring, default=’scatter’

available plot types: ‘scatter’, ‘box’, ‘violin’

Returns:
: bool

True if Figure was plotted.

remove_outliers(method='zscore', z_lower_limit=-3, z_upper_limit=3, iqr_lower_limit=1.5, iqr_upper_limit=1.5, inplace=False)[source]

Method cleans semivariogram point cloud from outliers.

Parameters:
methodstr, default=’zscore’

Method used to detect outliers. Can be ‘zscore’ or ‘iqr’.

z_lower_limitfloat

Number of standard deviations from the mean to the left side of a distribution. Must be lower than 0.

z_upper_limitfloat

Number of standard deviations from the mean to the right side of a distribution. Must be greater than 0.

iqr_lower_limitfloat

Number of standard deviations from the 1st quartile into the lowest values. Must be greater or equal to zero.

iqr_upper_limitfloat

Number of standard deviations from the 3rd quartile into the largest values. Must be greater or equal to zero.

inplacebool, default = False

Overwrite semivariances or return new object.

Returns:
: VariogramCloud

If inplace is set to False then method returns new instance of an object with cleaned semivariances.

Raises:
RunetimeError

The attribute experimental_point_cloud is not calculated.