Skip to content

Covariance🍋

Covariance 🍋

Bases: Entity

Nested Covariance class.

Parameters:

Name Type Description Default
cov_list List[CovarianceElem]

List of elementary covariance composing nested model.

required

Raises:

Type Description
TypeError

Covariances do not have the same dimensions.

Attributes:

Name Type Description
dimension int

Covariance dimension.

cov_elem_list List[CovarianceElem]

List of elementary covariances.

sill float

Covariance sill.

metric List[Metric]

Metric defining the covariances (angles and scales).

cov_number) List[Metric]

Number of nested models.

type List[str]

List of covariance types.

cov_elem_list: List[CovarianceElem] property 🍋

Return list of elementary covariances.

Returns:

Type Description
List[CovarianceElem]

List of elementary covariances.

cov_number: int property 🍋

Return number of nested models.

Returns:

Type Description
int

Number of nested models.

dimension: int property 🍋

Return Covariance dimension.

Returns:

Type Description
int

Covariance Dimension.

metric: List[Metric] property 🍋

Return metrics.

Returns:

Type Description
List[Metric]

List of Elementary Metric.

sill: float property 🍋

Return Covariance sill.

Returns:

Type Description
float

Covariance sill.

type: List[str] property 🍋

Return types of nested models.

Returns:

Type Description
List[str]

Types of nested models

eval(x, y, method=VariographyMethod.COVARIOGRAM) 🍋

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

Parameters:

Name Type Description Default
x Vector

First vector.

required
y Vector

Second vector.

required
method VariographyMethod

Method used for computation. Defaults to "COVARIOGRAM".

VariographyMethod.COVARIOGRAM

Returns:

Type Description
float

Computed covariance.

plot(angles=[0, 0, 0], method=VariographyMethod.SEMIVARIOGRAM, maxlag=None, save_file=None) 🍋

Plot covariance along a direction.

Parameters:

Name Type Description Default
angles Angles

Direction to plot covariance along, by default [0, 0, 0].

[0, 0, 0]
method VariographyMethod

Method used for computation, by default 'SEMIVARIOGRAM'.

VariographyMethod.SEMIVARIOGRAM
maxlag Optional[int]

Maximum distance to compute covariance.

None
save_file Optional[str]

Filename of saved figure. Defaults to None.

None

CovarianceElem 🍋

Bases: Entity

Elementary covariance base class. Abstract base class, to be defined by its children.

Parameters:

Name Type Description Default
dimension int

Covariance dimension.

3
sill float

Covariance sill.

1.0
metric Optional[Metric]

Metric information.

None

Attributes:

Name Type Description
dimension int

Covariance dimension.

sill float

Covariance sill.

metric Metric

Metric information.

type str

Covariance type.

dimension: int property 🍋

Return Covariance dimension.

Returns:

Type Description
int

Covariance Dimension.

metric: Metric property 🍋

Return covariance metric.

Returns:

Type Description
Metric

Covariance Metric.

sill: float property 🍋

Return Covariance sill.

Returns:

Type Description
float

Covariance sill.

type: str property 🍋

Return Covariance type.

Returns:

Type Description
str

Covariance type.

cov_func(h) abstractmethod 🍋

Return covariance function applied on a distance h.

Parameters:

Name Type Description Default
h np.ndarray

Metric to apply covariance function on.

required

eval(x, y, method=VariographyMethod.COVARIOGRAM) 🍋

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

Parameters:

Name Type Description Default
x Vector

First vector.

required
y Vector

Second vector.

required
method VariographyMethod

Method used for computation, by default 'COVARIOGRAM'.

VariographyMethod.COVARIOGRAM

Returns:

Type Description
float

Computed covariance

plot(angles=[0, 0, 0], method=VariographyMethod.SEMIVARIOGRAM, maxlag=None, save_file=None) 🍋

Plot covariance along a direction.

Parameters:

Name Type Description Default
angles Angles

Direction to plot covariance along, by default [0, 0, 0].

[0, 0, 0]
method VariographyMethod

Method used for computation, by default 'SEMIVARIOGRAM'.

VariographyMethod.SEMIVARIOGRAM
maxlag Optional[int]

Maximum distance to compute covariance.

None
save_file Optional[str]

Filename of saved figure. Defaults to None.

None

Exponential 🍋

Bases: CovarianceElem

Exponential Covariance Elementary base class.

Attributes:

Name Type Description
dimension int

Covariance dimension.

sill float

Covariance sill.

metric Metric

Metric.

cov_func(h) 🍋

Return covariance function applied on a distance h.

Parameters:

Name Type Description Default
h np.ndarray

Metric to apply covariance function on.

required

Gaussian 🍋

Bases: CovarianceElem

Gaussian Covariance Elementary base class.

Attributes:

Name Type Description
dimension int

Covariance dimension.

sill float

Covariance sill.

metric Metric

Metric.

cov_func(h) 🍋

Return covariance function applied on a distance h.

Parameters:

Name Type Description Default
h np.ndarray

Metric to apply covariance function on.

required

Returns:

Type Description
np.ndarray

Covariance.

Nugget 🍋

Bases: CovarianceElem

Nugget Covariance Elementary base class.

Attributes:

Name Type Description
dimension int

Covariance dimension.

sill float

Covariance sill.

metric Metric

Metric.

cov_func(h) 🍋

Return covariance function applied on a distance h.

Parameters:

Name Type Description Default
h np.ndarray

Metric to apply covariance function on.

required

Spherical 🍋

Bases: CovarianceElem

Spherical Covariance Elementary base class.

Attributes:

Name Type Description
dimension int

Covariance dimension.

sill float

Covariance sill.

metric Metric

Metric.

cov_func(h) 🍋

Return covariance function applied on a distance h.

Parameters:

Name Type Description Default
h np.ndarray

Metric to apply covariance function on.

required

cvv(cov, cell_size, discr=None, lag=None) 🍋

Applies a covariance model to a given grid for variance calculus.

Parameters:

Name Type Description Default
cov Union[Covariance, CovarianceElem]

Covariance model to be applied.

required
cell_size Vector

Size of cell for block covariance computation.

required
discr Optional[Vector]

Number of discretization per cell.

None
lag Optional[Vector]

Lag for the computation of the spatial regularized covariance. If None, lag will be set to 0 (block variance).

None

Returns:

Type Description
float

Regularized Covariance.