geolime.geostats.models.covariance

Classes:

ABCMeta(name, bases, namespace, **kwargs)

Metaclass for defining Abstract Base Classes (ABCs).

Covariance(dim, angles, 0.0, 0.0], scales, …)

CovarianceElem(dim, angles, scales, …)

Enum(value)

Generic enumeration.

Exponential(dim, angles, scales, convention)

Gaussian(dim, angles, scales, convention)

Nugget(dim, angles, scales, convention)

PatternGenerator()

Spherical(dim, angles, scales, convention)

Data:

Callable

Callable type; Callable[[int], str] is a function of (int) -> str.

List

The central part of internal API.

Functions:

abstractmethod(funcobj)

A decorator indicating abstract methods.

anisotropic_distance([a])

Anisotropic distance between two points according to the anisotropy matrix a.

cvv(cov[, pattern_generator, lag, method])

Applies a covariance model to a given grid for variance calculus

distance_matrix(x1, x2[, distance])

Computes the distance matrix of two sets of points in the Euclidean space according to a distance.

euclidian_distance(x, y)

Compute the Euclidean distance between two points.

rot_z(alpha[, deg, clockwise])

Rotation againt the Z axis

rot_zyx(angles[, deg, clockwise])

Example of a convention (RGeoStats)

rotational_angles(angles)

Compute the angles in radians necessary for matrix rotation operation from geographic azimuth, dip and pitch angles defined in degrees

class geolime.geostats.models.covariance.Covariance(dim: int, angles: List[float] = [0.0, 0.0, 0.0], scales: List[float] = [1.0, 1.0, 1.0], convention: Callable = <function rot_zyx>)

Bases: object

Methods:

apply_model(variogram[, method, …])

Compute the model matching an experimental variogram

cov_func(h)

Covariance model to be defined when derived

eval(x, y[, method])

Applies a covariance model to a distance matrix computed from a set of vectors

get_n_cov()

Retrieve number of covariance elements

get_total_sill()

Retrieve total sill

is_pure_nugget()

Check if the covariance is a pure nugget (single element Nugget)

plot(variogram[, method, border_ratio, nlag])

Plot an experimental variogram

apply_model(variogram: pandas.core.frame.DataFrame, method: enum.Enum = 'semivariogram', border_ratio: float = 1.1, nlag: int = 200)

Compute the model matching an experimental variogram

Parameters
  • variogram (pd.DataFrame) – Variogram to be plotted

  • method (Enum) – “semivariogram” or “covariogram”

  • border_ratio (float) – Plot extend

  • nlag (int) – Number of lags

Returns

Return type

None

abstract cov_func(h: numpy.ndarray)

Covariance model to be defined when derived

Parameters

h (np.ndarray) – Distance matrix

Returns

Covariance

Return type

type

eval(x: numpy.ndarray, y: numpy.ndarray, method: enum.Enum = 'covariogram')

Applies a covariance model to a distance matrix computed from a set of vectors

Parameters
  • x (np.ndarray) – First vector

  • y (np.ndarray) – Second vector

  • method (Enum) – covariogram or semivariogram

Returns

Covariance

Return type

np.ndarray

get_n_cov()

Retrieve number of covariance elements

get_total_sill()

Retrieve total sill

Returns

Sum of sills

Return type

float

is_pure_nugget()

Check if the covariance is a pure nugget (single element Nugget)

plot(variogram: pandas.core.frame.DataFrame, method: enum.Enum = 'semivariogram', border_ratio: float = 1.1, nlag: int = 200)

Plot an experimental variogram

Parameters
  • variogram (pd.DataFrame) – Variogram to be plotted

  • method (Enum) – “semivariogram” or “covariogram”

  • border_ratio (float) – Plot extend

  • nlag (int) – Number of lags

Returns

Return type

None

class geolime.geostats.models.covariance.CovarianceElem(dim: int, angles: List[float] = None, scales: List[float] = None, cov_func: Callable = None, convention: Callable = None, name: str = '')

Bases: object

Methods:

eval(x1, x2)

Applies a covariance model to a distance matrix computed from a set of vectors

get_anisotropy()

update()

Updates covariance parameters according to covariance type

eval(x1: numpy.ndarray, x2: numpy.ndarray)

Applies a covariance model to a distance matrix computed from a set of vectors

Parameters
  • x2 (np.ndarray) – First vector

  • x1 (np.ndarray) – Second vector

Returns

Computed covariance

Return type

np.ndarray

get_anisotropy()
update()

Updates covariance parameters according to covariance type

class geolime.geostats.models.covariance.Exponential(dim: int = 3, angles: List[float] = None, scales: List[float] = None, convention: Callable = None)

Bases: geolime.geostats.models.covariance.Covariance

Methods:

cov_func(h)

Exponential covariance model

cov_func(h: numpy.ndarray)

Exponential covariance model

Parameters

h (np.ndarray) – Distance matrix

Returns

Covariance

Return type

np.ndarray

class geolime.geostats.models.covariance.Gaussian(dim: int = 3, angles: List[float] = None, scales: List[float] = None, convention: Callable = None)

Bases: geolime.geostats.models.covariance.Covariance

Methods:

cov_func(h)

Exponential covariance model

cov_func(h: numpy.ndarray)

Exponential covariance model

Parameters

h (np.ndarray) – Distance matrix

Returns

Covariance

Return type

np.ndarray

class geolime.geostats.models.covariance.Nugget(dim: int = 3, angles: List[float] = None, scales: List[float] = None, convention: Callable = None)

Bases: geolime.geostats.models.covariance.Covariance

Methods:

cov_func(h)

Nugget covariance model

cov_func(h: numpy.ndarray)

Nugget covariance model

Parameters

h (np.ndarray) – Distance matrix

Returns

Covariance

Return type

np.ndarray

class geolime.geostats.models.covariance.Spherical(dim: int = 3, angles: List[float] = None, scales: List[float] = None, convention: Callable = None)

Bases: geolime.geostats.models.covariance.Covariance

Methods:

cov_func(h)

Spherical covariance model

cov_func(h: numpy.ndarray)

Spherical covariance model

Parameters

h (np.ndarray) – Distance matrix

Returns

Covariance

Return type

np.ndarray

geolime.geostats.models.covariance.cvv(cov: geolime.geostats.models.covariance.Covariance, pattern_generator: geolime.geostats.patterns.pattern_generator.PatternGenerator = None, lag: List[float] = None, method: enum.Enum = 'covariogram')

Applies a covariance model to a given grid for variance calculus

Parameters
  • cov (Covariance) – Covariance model to be applied

  • pattern_generator (PatternGenerator) – Optional points pattern to consider for cvv calculation E.g. refinment pattern of a grid cell into [x, x, x]

  • lag (List[float]) – Lag for the computation of the spatial regularized covariance. If None, lag will be set to 0 (block variance)

  • method (Enum) – “covariogram” or “semivariogram”

Returns

Regularized Covariance

Return type

float