gstools.covmodel.models

GStools subpackage providing different covariance models.

The following classes and functions are provided

Gaussian([dim, var, len_scale, nugget, …]) The Gaussian covariance model.
Exponential([dim, var, len_scale, nugget, …]) The Exponential covariance model.
Matern([dim, var, len_scale, nugget, anis, …]) The Matérn covariance model.
Stable([dim, var, len_scale, nugget, anis, …]) The stable covariance model.
Rational([dim, var, len_scale, nugget, …]) The rational quadratic covariance model.
Linear([dim, var, len_scale, nugget, anis, …]) The bounded linear covariance model.
Circular([dim, var, len_scale, nugget, …]) The circular covariance model.
Spherical([dim, var, len_scale, nugget, …]) The Spherical covariance model.
Intersection([dim, var, len_scale, nugget, …]) The Intersection covariance model.
class gstools.covmodel.models.Gaussian(dim=3, var=1.0, len_scale=1.0, nugget=0.0, anis=1.0, angles=0.0, integral_scale=None, var_raw=None, hankel_kw=None, **opt_arg)[source]

Bases: gstools.covmodel.base.CovModel

The Gaussian covariance model.

Notes

This model is given by the following correlation function:

\mathrm{cor}(r) =
\exp\left(- \frac{\pi}{4} \cdot \left(\frac{r}{\ell}\right)^2\right)

.

Parameters:
  • dim (int, optional) – dimension of the model. Default: 3
  • var (float, optional) – variance of the model (the nugget is not included in “this” variance) Default: 1.0
  • len_scale (float or list, optional) – length scale of the model. If a single value is given, the same length-scale will be used for every direction. If multiple values (for main and transversal directions) are given, anis will be recalculated accordingly. Default: 1.0
  • nugget (float, optional) – nugget of the model. Default: 0.0
  • anis (float or list, optional) – anisotropy ratios in the transversal directions [y, z]. Default: 1.0
  • angles (float or list, optional) –

    angles of rotation:

    • in 2D: given as rotation around z-axis
    • in 3D: given by yaw, pitch, and roll (known as Tait–Bryan angles)

    Default: 0.0

  • integral_scale (float or list or None, optional) – If given, len_scale will be ignored and recalculated, so that the integral scale of the model matches the given one. Default: None
  • var_raw (float or None, optional) – raw variance of the model which will be multiplied with CovModel.var_factor to result in the actual variance. If given, var will be ignored. (This is just for models that override CovModel.var_factor) Default: None
  • hankel_kw (dict or None, optional) – Modify the init-arguments of hankel.SymmetricFourierTransform used for the spectrum calculation. Use with caution (Better: Don’t!). None is equivalent to {"a": -1, "b": 1, "N": 1000, "h": 0.001}.
Attributes:
angles

numpy.ndarray: Rotation angles (in rad) of the model.

anis

numpy.ndarray: The anisotropy factors of the model.

arg

list of str: Names of all arguments.

arg_bounds

dict: Bounds for all parameters.

dim

int: The dimension of the model.

dist_func

tuple of callable: pdf, cdf and ppf.

do_rotation

bool: State if a rotation is performed.

hankel_kw

dict: hankel.SymmetricFourierTransform kwargs.

has_cdf

bool: State if a cdf is defined by the user.

has_ppf

bool: State if a ppf is defined by the user.

integral_scale

float: The main integral scale of the model.

integral_scale_vec

numpy.ndarray: The integral scales in each direction.

len_scale

float: The main length scale of the model.

len_scale_bounds

list: Bounds for the lenght scale.

len_scale_vec

numpy.ndarray: The length scales in each direction.

name

str: The name of the CovModel class.

nugget

float: The nugget of the model.

nugget_bounds

list: Bounds for the nugget.

opt_arg

list of str: Names of the optional arguments.

opt_arg_bounds

dict: Bounds for the optional arguments.

pykrige_angle

2D rotation angle for pykrige.

pykrige_angle_x

3D rotation angle around x for pykrige.

pykrige_angle_y

3D rotation angle around y for pykrige.

pykrige_angle_z

3D rotation angle around z for pykrige.

pykrige_anis

2D anisotropy ratio for pykrige.

pykrige_anis_y

3D anisotropy ratio in y direction for pykrige.

pykrige_anis_z

3D anisotropy ratio in z direction for pykrige.

pykrige_kwargs

Keyword arguments for pykrige routines.

sill

float: The sill of the variogram.

var

float: The variance of the model.

var_bounds

list: Bounds for the variance.

var_raw

float: The raw variance of the model without factor.

Methods

calc_integral_scale() Calculate the integral scale of the isotrope model.
check_arg_bounds() Check arguments to be within the given bounds.
check_opt_arg() Run checks for the optional arguments.
cor_spatial(pos) Spatial correlation respecting anisotropy and rotation.
correlation(r) Gaussian correlation function.
cov_nugget(r) Covariance of the model respecting the nugget at r=0.
cov_spatial(pos) Spatial covariance respecting anisotropy and rotation.
covariance(r) Covariance of the model.
default_arg_bounds() Provide default boundaries for arguments.
default_opt_arg() Provide default optional arguments by the user.
default_opt_arg_bounds() Provide default boundaries for optional arguments.
fit_variogram(x_data, y_data[, maxfev]) Fiting the isotropic variogram-model to given data.
fix_dim() Set a fix dimension for the model.
ln_spectral_rad_pdf(r) Log radial spectral density of the model.
percentile_scale([per]) Calculate the percentile scale of the isotrope model.
plot([func]) Plot a function of a the CovModel.
pykrige_vario([args, r]) Isotropic variogram of the model for pykrige.
set_arg_bounds(**kwargs) Set bounds for the parameters of the model.
spectral_density(k) Spectral density of the covariance model.
spectral_rad_cdf(r) Radial spectral cdf.
spectral_rad_pdf(r) Radial spectral density of the model.
spectral_rad_ppf(u) Radial spectral ppf.
spectrum(k) Spectrum of the covariance model.
var_factor() Factor for the variance.
vario_nugget(r) Isotropic variogram of the model respecting the nugget at r=0.
vario_spatial(pos) Spatial variogram respecting anisotropy and rotation.
variogram(r) Isotropic variogram of the model.
calc_integral_scale()[source]

Calculate the integral scale of the isotrope model.

correlation(r)[source]

Gaussian correlation function.

\mathrm{cor}(r) =
\exp\left(- \frac{\pi}{4}\cdot \left(\frac{r}{\ell}\right)^2\right)

covariance(r)

Covariance of the model.

Given by: C\left(r\right)=
\sigma^2\cdot\mathrm{cor}\left(r\right)

Where \mathrm{cor}(r) is the correlation function.

spectral_density(k)[source]

Spectral density of the covariance model.

This is given by:

\tilde{S}(k) = \frac{S(k)}{\sigma^2}

Where S(k) is the spectrum of the covariance model.

Parameters:k (float) – Radius of the phase: k=\left\Vert\mathbf{k}\right\Vert
spectral_rad_cdf(r)[source]

Radial spectral cdf.

spectral_rad_ppf(u)[source]

Radial spectral ppf.

Notes

Not defined for 3D.

variogram(r)

Isotropic variogram of the model.

Given by: \gamma\left(r\right)=
\sigma^2\cdot\left(1-\mathrm{cor}\left(r\right)\right)+n

Where \mathrm{cor}(r) is the correlation function.

class gstools.covmodel.models.Exponential(dim=3, var=1.0, len_scale=1.0, nugget=0.0, anis=1.0, angles=0.0, integral_scale=None, var_raw=None, hankel_kw=None, **opt_arg)[source]

Bases: gstools.covmodel.base.CovModel

The Exponential covariance model.

Notes

This model is given by the following correlation function:

\mathrm{cor}(r) =
\exp\left(- \frac{r}{\ell} \right)

.

Parameters:
  • dim (int, optional) – dimension of the model. Default: 3
  • var (float, optional) – variance of the model (the nugget is not included in “this” variance) Default: 1.0
  • len_scale (float or list, optional) – length scale of the model. If a single value is given, the same length-scale will be used for every direction. If multiple values (for main and transversal directions) are given, anis will be recalculated accordingly. Default: 1.0
  • nugget (float, optional) – nugget of the model. Default: 0.0
  • anis (float or list, optional) – anisotropy ratios in the transversal directions [y, z]. Default: 1.0
  • angles (float or list, optional) –

    angles of rotation:

    • in 2D: given as rotation around z-axis
    • in 3D: given by yaw, pitch, and roll (known as Tait–Bryan angles)

    Default: 0.0

  • integral_scale (float or list or None, optional) – If given, len_scale will be ignored and recalculated, so that the integral scale of the model matches the given one. Default: None
  • var_raw (float or None, optional) – raw variance of the model which will be multiplied with CovModel.var_factor to result in the actual variance. If given, var will be ignored. (This is just for models that override CovModel.var_factor) Default: None
  • hankel_kw (dict or None, optional) – Modify the init-arguments of hankel.SymmetricFourierTransform used for the spectrum calculation. Use with caution (Better: Don’t!). None is equivalent to {"a": -1, "b": 1, "N": 1000, "h": 0.001}.
Attributes:
angles

numpy.ndarray: Rotation angles (in rad) of the model.

anis

numpy.ndarray: The anisotropy factors of the model.

arg

list of str: Names of all arguments.

arg_bounds

dict: Bounds for all parameters.

dim

int: The dimension of the model.

dist_func

tuple of callable: pdf, cdf and ppf.

do_rotation

bool: State if a rotation is performed.

hankel_kw

dict: hankel.SymmetricFourierTransform kwargs.

has_cdf

bool: State if a cdf is defined by the user.

has_ppf

bool: State if a ppf is defined by the user.

integral_scale

float: The main integral scale of the model.

integral_scale_vec

numpy.ndarray: The integral scales in each direction.

len_scale

float: The main length scale of the model.

len_scale_bounds

list: Bounds for the lenght scale.

len_scale_vec

numpy.ndarray: The length scales in each direction.

name

str: The name of the CovModel class.

nugget

float: The nugget of the model.

nugget_bounds

list: Bounds for the nugget.

opt_arg

list of str: Names of the optional arguments.

opt_arg_bounds

dict: Bounds for the optional arguments.

pykrige_angle

2D rotation angle for pykrige.

pykrige_angle_x

3D rotation angle around x for pykrige.

pykrige_angle_y

3D rotation angle around y for pykrige.

pykrige_angle_z

3D rotation angle around z for pykrige.

pykrige_anis

2D anisotropy ratio for pykrige.

pykrige_anis_y

3D anisotropy ratio in y direction for pykrige.

pykrige_anis_z

3D anisotropy ratio in z direction for pykrige.

pykrige_kwargs

Keyword arguments for pykrige routines.

sill

float: The sill of the variogram.

var

float: The variance of the model.

var_bounds

list: Bounds for the variance.

var_raw

float: The raw variance of the model without factor.

Methods

calc_integral_scale() Calculate the integral scale of the isotrope model.
check_arg_bounds() Check arguments to be within the given bounds.
check_opt_arg() Run checks for the optional arguments.
cor_spatial(pos) Spatial correlation respecting anisotropy and rotation.
correlation(r) Exponential correlation function.
cov_nugget(r) Covariance of the model respecting the nugget at r=0.
cov_spatial(pos) Spatial covariance respecting anisotropy and rotation.
covariance(r) Covariance of the model.
default_arg_bounds() Provide default boundaries for arguments.
default_opt_arg() Provide default optional arguments by the user.
default_opt_arg_bounds() Provide default boundaries for optional arguments.
fit_variogram(x_data, y_data[, maxfev]) Fiting the isotropic variogram-model to given data.
fix_dim() Set a fix dimension for the model.
ln_spectral_rad_pdf(r) Log radial spectral density of the model.
percentile_scale([per]) Calculate the percentile scale of the isotrope model.
plot([func]) Plot a function of a the CovModel.
pykrige_vario([args, r]) Isotropic variogram of the model for pykrige.
set_arg_bounds(**kwargs) Set bounds for the parameters of the model.
spectral_density(k) Spectral density of the covariance model.
spectral_rad_cdf(r) Radial spectral cdf.
spectral_rad_pdf(r) Radial spectral density of the model.
spectral_rad_ppf(u) Radial spectral ppf.
spectrum(k) Spectrum of the covariance model.
var_factor() Factor for the variance.
vario_nugget(r) Isotropic variogram of the model respecting the nugget at r=0.
vario_spatial(pos) Spatial variogram respecting anisotropy and rotation.
variogram(r) Isotropic variogram of the model.
calc_integral_scale()[source]

Calculate the integral scale of the isotrope model.

correlation(r)[source]

Exponential correlation function.

\mathrm{cor}(r) =
\exp\left(- \frac{r}{\ell} \right)

covariance(r)

Covariance of the model.

Given by: C\left(r\right)=
\sigma^2\cdot\mathrm{cor}\left(r\right)

Where \mathrm{cor}(r) is the correlation function.

spectral_density(k)[source]

Spectral density of the covariance model.

This is given by:

\tilde{S}(k) = \frac{S(k)}{\sigma^2}

Where S(k) is the spectrum of the covariance model.

Parameters:k (float) – Radius of the phase: k=\left\Vert\mathbf{k}\right\Vert
spectral_rad_cdf(r)[source]

Radial spectral cdf.

spectral_rad_ppf(u)[source]

Radial spectral ppf.

Notes

Not defined for 3D.

variogram(r)

Isotropic variogram of the model.

Given by: \gamma\left(r\right)=
\sigma^2\cdot\left(1-\mathrm{cor}\left(r\right)\right)+n

Where \mathrm{cor}(r) is the correlation function.

class gstools.covmodel.models.Matern(dim=3, var=1.0, len_scale=1.0, nugget=0.0, anis=1.0, angles=0.0, integral_scale=None, var_raw=None, hankel_kw=None, **opt_arg)[source]

Bases: gstools.covmodel.base.CovModel

The Matérn covariance model.

Notes

This model is given by the following correlation function:

\mathrm{cor}(r) =
\frac{2^{1-\nu}}{\Gamma\left(\nu\right)} \cdot
\left(\sqrt{\nu}\cdot\frac{r}{\ell}\right)^{\nu} \cdot
\mathrm{K}_{\nu}\left(\sqrt{\nu}\cdot\frac{r}{\ell}\right)

Where \Gamma is the gamma function and \mathrm{K}_{\nu} is the modified Bessel function of the second kind.

\nu is a shape parameter and should be >= 0.2.

If \nu > 20, a gaussian model is used, since it is the limit case:

\mathrm{cor}(r) =
\exp\left(- \frac{1}{4} \cdot \left(\frac{r}{\ell}\right)^2\right)

Other Parameters:
 
  • **opt_arg – The following parameters are covered by these keyword arguments
  • nu (float, optional) – Shape parameter. Standard range: [0.2, 30] Default: 1.0
  • .
Parameters:
  • dim (int, optional) – dimension of the model. Default: 3
  • var (float, optional) – variance of the model (the nugget is not included in “this” variance) Default: 1.0
  • len_scale (float or list, optional) – length scale of the model. If a single value is given, the same length-scale will be used for every direction. If multiple values (for main and transversal directions) are given, anis will be recalculated accordingly. Default: 1.0
  • nugget (float, optional) – nugget of the model. Default: 0.0
  • anis (float or list, optional) – anisotropy ratios in the transversal directions [y, z]. Default: 1.0
  • angles (float or list, optional) –

    angles of rotation:

    • in 2D: given as rotation around z-axis
    • in 3D: given by yaw, pitch, and roll (known as Tait–Bryan angles)

    Default: 0.0

  • integral_scale (float or list or None, optional) – If given, len_scale will be ignored and recalculated, so that the integral scale of the model matches the given one. Default: None
  • var_raw (float or None, optional) – raw variance of the model which will be multiplied with CovModel.var_factor to result in the actual variance. If given, var will be ignored. (This is just for models that override CovModel.var_factor) Default: None
  • hankel_kw (dict or None, optional) – Modify the init-arguments of hankel.SymmetricFourierTransform used for the spectrum calculation. Use with caution (Better: Don’t!). None is equivalent to {"a": -1, "b": 1, "N": 1000, "h": 0.001}.
Attributes:
angles

numpy.ndarray: Rotation angles (in rad) of the model.

anis

numpy.ndarray: The anisotropy factors of the model.

arg

list of str: Names of all arguments.

arg_bounds

dict: Bounds for all parameters.

dim

int: The dimension of the model.

dist_func

tuple of callable: pdf, cdf and ppf.

do_rotation

bool: State if a rotation is performed.

hankel_kw

dict: hankel.SymmetricFourierTransform kwargs.

has_cdf

bool: State if a cdf is defined by the user.

has_ppf

bool: State if a ppf is defined by the user.

integral_scale

float: The main integral scale of the model.

integral_scale_vec

numpy.ndarray: The integral scales in each direction.

len_scale

float: The main length scale of the model.

len_scale_bounds

list: Bounds for the lenght scale.

len_scale_vec

numpy.ndarray: The length scales in each direction.

name

str: The name of the CovModel class.

nugget

float: The nugget of the model.

nugget_bounds

list: Bounds for the nugget.

opt_arg

list of str: Names of the optional arguments.

opt_arg_bounds

dict: Bounds for the optional arguments.

pykrige_angle

2D rotation angle for pykrige.

pykrige_angle_x

3D rotation angle around x for pykrige.

pykrige_angle_y

3D rotation angle around y for pykrige.

pykrige_angle_z

3D rotation angle around z for pykrige.

pykrige_anis

2D anisotropy ratio for pykrige.

pykrige_anis_y

3D anisotropy ratio in y direction for pykrige.

pykrige_anis_z

3D anisotropy ratio in z direction for pykrige.

pykrige_kwargs

Keyword arguments for pykrige routines.

sill

float: The sill of the variogram.

var

float: The variance of the model.

var_bounds

list: Bounds for the variance.

var_raw

float: The raw variance of the model without factor.

Methods

calc_integral_scale() Calculate the integral scale of the isotrope model.
check_arg_bounds() Check arguments to be within the given bounds.
check_opt_arg() Run checks for the optional arguments.
cor_spatial(pos) Spatial correlation respecting anisotropy and rotation.
correlation(r) Matérn correlation function.
cov_nugget(r) Covariance of the model respecting the nugget at r=0.
cov_spatial(pos) Spatial covariance respecting anisotropy and rotation.
covariance(r) Covariance of the model.
default_arg_bounds() Provide default boundaries for arguments.
default_opt_arg() Defaults for the optional arguments.
default_opt_arg_bounds() Defaults for boundaries of the optional arguments.
fit_variogram(x_data, y_data[, maxfev]) Fiting the isotropic variogram-model to given data.
fix_dim() Set a fix dimension for the model.
ln_spectral_rad_pdf(r) Log radial spectral density of the model.
percentile_scale([per]) Calculate the percentile scale of the isotrope model.
plot([func]) Plot a function of a the CovModel.
pykrige_vario([args, r]) Isotropic variogram of the model for pykrige.
set_arg_bounds(**kwargs) Set bounds for the parameters of the model.
spectral_density(k) Spectral density of the covariance model.
spectral_rad_pdf(r) Radial spectral density of the model.
spectrum(k) Spectrum of the covariance model.
var_factor() Factor for the variance.
vario_nugget(r) Isotropic variogram of the model respecting the nugget at r=0.
vario_spatial(pos) Spatial variogram respecting anisotropy and rotation.
variogram(r) Isotropic variogram of the model.
calc_integral_scale()[source]

Calculate the integral scale of the isotrope model.

correlation(r)[source]

Matérn correlation function.

\mathrm{cor}(r) =
\frac{2^{1-\nu}}{\Gamma\left(\nu\right)} \cdot
\left(\sqrt{\nu}\cdot\frac{r}{\ell}\right)^{\nu} \cdot
\mathrm{K}_{\nu}\left(\sqrt{\nu}\cdot\frac{r}{\ell}\right)

covariance(r)

Covariance of the model.

Given by: C\left(r\right)=
\sigma^2\cdot\mathrm{cor}\left(r\right)

Where \mathrm{cor}(r) is the correlation function.

default_opt_arg()[source]

Defaults for the optional arguments.

  • {"nu": 1.0}
Returns:Defaults for optional arguments
Return type:dict
default_opt_arg_bounds()[source]

Defaults for boundaries of the optional arguments.

  • {"nu": [0.5, 30.0, "cc"]}
Returns:Boundaries for optional arguments
Return type:dict
spectral_density(k)[source]

Spectral density of the covariance model.

This is given by:

\tilde{S}(k) = \frac{S(k)}{\sigma^2}

Where S(k) is the spectrum of the covariance model.

Parameters:k (float) – Radius of the phase: k=\left\Vert\mathbf{k}\right\Vert
variogram(r)

Isotropic variogram of the model.

Given by: \gamma\left(r\right)=
\sigma^2\cdot\left(1-\mathrm{cor}\left(r\right)\right)+n

Where \mathrm{cor}(r) is the correlation function.

class gstools.covmodel.models.Stable(dim=3, var=1.0, len_scale=1.0, nugget=0.0, anis=1.0, angles=0.0, integral_scale=None, var_raw=None, hankel_kw=None, **opt_arg)[source]

Bases: gstools.covmodel.base.CovModel

The stable covariance model.

Notes

This model is given by the following correlation function:

\mathrm{cor}(r) =
\exp\left(- \left(\frac{r}{\ell}\right)^{\alpha}\right)

\alpha is a shape parameter with \alpha\in(0,2]

Other Parameters:
 
  • **opt_arg – The following parameters are covered by these keyword arguments
  • alpha (float, optional) – Shape parameter. Standard range: (0, 2] Default: 1.5
  • .
Parameters:
  • dim (int, optional) – dimension of the model. Default: 3
  • var (float, optional) – variance of the model (the nugget is not included in “this” variance) Default: 1.0
  • len_scale (float or list, optional) – length scale of the model. If a single value is given, the same length-scale will be used for every direction. If multiple values (for main and transversal directions) are given, anis will be recalculated accordingly. Default: 1.0
  • nugget (float, optional) – nugget of the model. Default: 0.0
  • anis (float or list, optional) – anisotropy ratios in the transversal directions [y, z]. Default: 1.0
  • angles (float or list, optional) –

    angles of rotation:

    • in 2D: given as rotation around z-axis
    • in 3D: given by yaw, pitch, and roll (known as Tait–Bryan angles)

    Default: 0.0

  • integral_scale (float or list or None, optional) – If given, len_scale will be ignored and recalculated, so that the integral scale of the model matches the given one. Default: None
  • var_raw (float or None, optional) – raw variance of the model which will be multiplied with CovModel.var_factor to result in the actual variance. If given, var will be ignored. (This is just for models that override CovModel.var_factor) Default: None
  • hankel_kw (dict or None, optional) – Modify the init-arguments of hankel.SymmetricFourierTransform used for the spectrum calculation. Use with caution (Better: Don’t!). None is equivalent to {"a": -1, "b": 1, "N": 1000, "h": 0.001}.
Attributes:
angles

numpy.ndarray: Rotation angles (in rad) of the model.

anis

numpy.ndarray: The anisotropy factors of the model.

arg

list of str: Names of all arguments.

arg_bounds

dict: Bounds for all parameters.

dim

int: The dimension of the model.

dist_func

tuple of callable: pdf, cdf and ppf.

do_rotation

bool: State if a rotation is performed.

hankel_kw

dict: hankel.SymmetricFourierTransform kwargs.

has_cdf

bool: State if a cdf is defined by the user.

has_ppf

bool: State if a ppf is defined by the user.

integral_scale

float: The main integral scale of the model.

integral_scale_vec

numpy.ndarray: The integral scales in each direction.

len_scale

float: The main length scale of the model.

len_scale_bounds

list: Bounds for the lenght scale.

len_scale_vec

numpy.ndarray: The length scales in each direction.

name

str: The name of the CovModel class.

nugget

float: The nugget of the model.

nugget_bounds

list: Bounds for the nugget.

opt_arg

list of str: Names of the optional arguments.

opt_arg_bounds

dict: Bounds for the optional arguments.

pykrige_angle

2D rotation angle for pykrige.

pykrige_angle_x

3D rotation angle around x for pykrige.

pykrige_angle_y

3D rotation angle around y for pykrige.

pykrige_angle_z

3D rotation angle around z for pykrige.

pykrige_anis

2D anisotropy ratio for pykrige.

pykrige_anis_y

3D anisotropy ratio in y direction for pykrige.

pykrige_anis_z

3D anisotropy ratio in z direction for pykrige.

pykrige_kwargs

Keyword arguments for pykrige routines.

sill

float: The sill of the variogram.

var

float: The variance of the model.

var_bounds

list: Bounds for the variance.

var_raw

float: The raw variance of the model without factor.

Methods

calc_integral_scale() Calculate the integral scale of the isotrope model.
check_arg_bounds() Check arguments to be within the given bounds.
check_opt_arg() Check the optional arguments.
cor_spatial(pos) Spatial correlation respecting anisotropy and rotation.
correlation(r) Stable correlation function.
cov_nugget(r) Covariance of the model respecting the nugget at r=0.
cov_spatial(pos) Spatial covariance respecting anisotropy and rotation.
covariance(r) Covariance of the model.
default_arg_bounds() Provide default boundaries for arguments.
default_opt_arg() Defaults for the optional arguments.
default_opt_arg_bounds() Defaults for boundaries of the optional arguments.
fit_variogram(x_data, y_data[, maxfev]) Fiting the isotropic variogram-model to given data.
fix_dim() Set a fix dimension for the model.
ln_spectral_rad_pdf(r) Log radial spectral density of the model.
percentile_scale([per]) Calculate the percentile scale of the isotrope model.
plot([func]) Plot a function of a the CovModel.
pykrige_vario([args, r]) Isotropic variogram of the model for pykrige.
set_arg_bounds(**kwargs) Set bounds for the parameters of the model.
spectral_density(k) Spectral density of the covariance model.
spectral_rad_pdf(r) Radial spectral density of the model.
spectrum(k) Spectrum of the covariance model.
var_factor() Factor for the variance.
vario_nugget(r) Isotropic variogram of the model respecting the nugget at r=0.
vario_spatial(pos) Spatial variogram respecting anisotropy and rotation.
variogram(r) Isotropic variogram of the model.
check_opt_arg()[source]

Check the optional arguments.

Warns:alpha – If alpha is < 0.3, the model tends to a nugget model and gets numerically unstable.
correlation(r)[source]

Stable correlation function.

\mathrm{cor}(r) =
\exp\left(- \left(\frac{r}{\ell}\right)^{\alpha}\right)

covariance(r)

Covariance of the model.

Given by: C\left(r\right)=
\sigma^2\cdot\mathrm{cor}\left(r\right)

Where \mathrm{cor}(r) is the correlation function.

default_opt_arg()[source]

Defaults for the optional arguments.

  • {"alpha": 1.5}
Returns:Defaults for optional arguments
Return type:dict
default_opt_arg_bounds()[source]

Defaults for boundaries of the optional arguments.

  • {"alpha": [0, 2, "oc"]}
Returns:Boundaries for optional arguments
Return type:dict
variogram(r)

Isotropic variogram of the model.

Given by: \gamma\left(r\right)=
\sigma^2\cdot\left(1-\mathrm{cor}\left(r\right)\right)+n

Where \mathrm{cor}(r) is the correlation function.

class gstools.covmodel.models.Rational(dim=3, var=1.0, len_scale=1.0, nugget=0.0, anis=1.0, angles=0.0, integral_scale=None, var_raw=None, hankel_kw=None, **opt_arg)[source]

Bases: gstools.covmodel.base.CovModel

The rational quadratic covariance model.

Notes

This model is given by the following correlation function:

\mathrm{cor}(r) =
\left(1 + \frac{1}{2\alpha} \cdot
\left(\frac{r}{\ell}\right)^2\right)^{-\alpha}

\alpha is a shape parameter and should be > 0.5.

Other Parameters:
 
  • **opt_arg – The following parameters are covered by these keyword arguments
  • alpha (float, optional) – Shape parameter. Standard range: (0, inf) Default: 1.0
  • .
Parameters:
  • dim (int, optional) – dimension of the model. Default: 3
  • var (float, optional) – variance of the model (the nugget is not included in “this” variance) Default: 1.0
  • len_scale (float or list, optional) – length scale of the model. If a single value is given, the same length-scale will be used for every direction. If multiple values (for main and transversal directions) are given, anis will be recalculated accordingly. Default: 1.0
  • nugget (float, optional) – nugget of the model. Default: 0.0
  • anis (float or list, optional) – anisotropy ratios in the transversal directions [y, z]. Default: 1.0
  • angles (float or list, optional) –

    angles of rotation:

    • in 2D: given as rotation around z-axis
    • in 3D: given by yaw, pitch, and roll (known as Tait–Bryan angles)

    Default: 0.0

  • integral_scale (float or list or None, optional) – If given, len_scale will be ignored and recalculated, so that the integral scale of the model matches the given one. Default: None
  • var_raw (float or None, optional) – raw variance of the model which will be multiplied with CovModel.var_factor to result in the actual variance. If given, var will be ignored. (This is just for models that override CovModel.var_factor) Default: None
  • hankel_kw (dict or None, optional) – Modify the init-arguments of hankel.SymmetricFourierTransform used for the spectrum calculation. Use with caution (Better: Don’t!). None is equivalent to {"a": -1, "b": 1, "N": 1000, "h": 0.001}.
Attributes:
angles

numpy.ndarray: Rotation angles (in rad) of the model.

anis

numpy.ndarray: The anisotropy factors of the model.

arg

list of str: Names of all arguments.

arg_bounds

dict: Bounds for all parameters.

dim

int: The dimension of the model.

dist_func

tuple of callable: pdf, cdf and ppf.

do_rotation

bool: State if a rotation is performed.

hankel_kw

dict: hankel.SymmetricFourierTransform kwargs.

has_cdf

bool: State if a cdf is defined by the user.

has_ppf

bool: State if a ppf is defined by the user.

integral_scale

float: The main integral scale of the model.

integral_scale_vec

numpy.ndarray: The integral scales in each direction.

len_scale

float: The main length scale of the model.

len_scale_bounds

list: Bounds for the lenght scale.

len_scale_vec

numpy.ndarray: The length scales in each direction.

name

str: The name of the CovModel class.

nugget

float: The nugget of the model.

nugget_bounds

list: Bounds for the nugget.

opt_arg

list of str: Names of the optional arguments.

opt_arg_bounds

dict: Bounds for the optional arguments.

pykrige_angle

2D rotation angle for pykrige.

pykrige_angle_x

3D rotation angle around x for pykrige.

pykrige_angle_y

3D rotation angle around y for pykrige.

pykrige_angle_z

3D rotation angle around z for pykrige.

pykrige_anis

2D anisotropy ratio for pykrige.

pykrige_anis_y

3D anisotropy ratio in y direction for pykrige.

pykrige_anis_z

3D anisotropy ratio in z direction for pykrige.

pykrige_kwargs

Keyword arguments for pykrige routines.

sill

float: The sill of the variogram.

var

float: The variance of the model.

var_bounds

list: Bounds for the variance.

var_raw

float: The raw variance of the model without factor.

Methods

calc_integral_scale() Calculate the integral scale of the isotrope model.
check_arg_bounds() Check arguments to be within the given bounds.
check_opt_arg() Run checks for the optional arguments.
cor_spatial(pos) Spatial correlation respecting anisotropy and rotation.
correlation(r) Rational correlation function.
cov_nugget(r) Covariance of the model respecting the nugget at r=0.
cov_spatial(pos) Spatial covariance respecting anisotropy and rotation.
covariance(r) Covariance of the model.
default_arg_bounds() Provide default boundaries for arguments.
default_opt_arg() Defaults for the optional arguments.
default_opt_arg_bounds() Defaults for boundaries of the optional arguments.
fit_variogram(x_data, y_data[, maxfev]) Fiting the isotropic variogram-model to given data.
fix_dim() Set a fix dimension for the model.
ln_spectral_rad_pdf(r) Log radial spectral density of the model.
percentile_scale([per]) Calculate the percentile scale of the isotrope model.
plot([func]) Plot a function of a the CovModel.
pykrige_vario([args, r]) Isotropic variogram of the model for pykrige.
set_arg_bounds(**kwargs) Set bounds for the parameters of the model.
spectral_density(k) Spectral density of the covariance model.
spectral_rad_pdf(r) Radial spectral density of the model.
spectrum(k) Spectrum of the covariance model.
var_factor() Factor for the variance.
vario_nugget(r) Isotropic variogram of the model respecting the nugget at r=0.
vario_spatial(pos) Spatial variogram respecting anisotropy and rotation.
variogram(r) Isotropic variogram of the model.
correlation(r)[source]

Rational correlation function.

\mathrm{cor}(r) =
\left(1 + \frac{1}{2\alpha} \cdot
\left(\frac{r}{\ell}\right)^2\right)^{-\alpha}

covariance(r)

Covariance of the model.

Given by: C\left(r\right)=
\sigma^2\cdot\mathrm{cor}\left(r\right)

Where \mathrm{cor}(r) is the correlation function.

default_opt_arg()[source]

Defaults for the optional arguments.

  • {"alpha": 1.0}
Returns:Defaults for optional arguments
Return type:dict
default_opt_arg_bounds()[source]

Defaults for boundaries of the optional arguments.

  • {"alpha": [0.5, inf]}
Returns:Boundaries for optional arguments
Return type:dict
variogram(r)

Isotropic variogram of the model.

Given by: \gamma\left(r\right)=
\sigma^2\cdot\left(1-\mathrm{cor}\left(r\right)\right)+n

Where \mathrm{cor}(r) is the correlation function.

class gstools.covmodel.models.Linear(dim=3, var=1.0, len_scale=1.0, nugget=0.0, anis=1.0, angles=0.0, integral_scale=None, var_raw=None, hankel_kw=None, **opt_arg)[source]

Bases: gstools.covmodel.base.CovModel

The bounded linear covariance model.

This model is derived from the relative intersection area of two lines in 1D, where the middle points have a distance of r and the line lengths are \ell.

Notes

This model is given by the following correlation function:

\mathrm{cor}(r) =
\begin{cases}
1-\frac{r}{\ell}
& r<\ell\\
0 & r\geq\ell
\end{cases}

.

Parameters:
  • dim (int, optional) – dimension of the model. Default: 3
  • var (float, optional) – variance of the model (the nugget is not included in “this” variance) Default: 1.0
  • len_scale (float or list, optional) – length scale of the model. If a single value is given, the same length-scale will be used for every direction. If multiple values (for main and transversal directions) are given, anis will be recalculated accordingly. Default: 1.0
  • nugget (float, optional) – nugget of the model. Default: 0.0
  • anis (float or list, optional) – anisotropy ratios in the transversal directions [y, z]. Default: 1.0
  • angles (float or list, optional) –

    angles of rotation:

    • in 2D: given as rotation around z-axis
    • in 3D: given by yaw, pitch, and roll (known as Tait–Bryan angles)

    Default: 0.0

  • integral_scale (float or list or None, optional) – If given, len_scale will be ignored and recalculated, so that the integral scale of the model matches the given one. Default: None
  • var_raw (float or None, optional) – raw variance of the model which will be multiplied with CovModel.var_factor to result in the actual variance. If given, var will be ignored. (This is just for models that override CovModel.var_factor) Default: None
  • hankel_kw (dict or None, optional) – Modify the init-arguments of hankel.SymmetricFourierTransform used for the spectrum calculation. Use with caution (Better: Don’t!). None is equivalent to {"a": -1, "b": 1, "N": 1000, "h": 0.001}.
Attributes:
angles

numpy.ndarray: Rotation angles (in rad) of the model.

anis

numpy.ndarray: The anisotropy factors of the model.

arg

list of str: Names of all arguments.

arg_bounds

dict: Bounds for all parameters.

dim

int: The dimension of the model.

dist_func

tuple of callable: pdf, cdf and ppf.

do_rotation

bool: State if a rotation is performed.

hankel_kw

dict: hankel.SymmetricFourierTransform kwargs.

has_cdf

bool: State if a cdf is defined by the user.

has_ppf

bool: State if a ppf is defined by the user.

integral_scale

float: The main integral scale of the model.

integral_scale_vec

numpy.ndarray: The integral scales in each direction.

len_scale

float: The main length scale of the model.

len_scale_bounds

list: Bounds for the lenght scale.

len_scale_vec

numpy.ndarray: The length scales in each direction.

name

str: The name of the CovModel class.

nugget

float: The nugget of the model.

nugget_bounds

list: Bounds for the nugget.

opt_arg

list of str: Names of the optional arguments.

opt_arg_bounds

dict: Bounds for the optional arguments.

pykrige_angle

2D rotation angle for pykrige.

pykrige_angle_x

3D rotation angle around x for pykrige.

pykrige_angle_y

3D rotation angle around y for pykrige.

pykrige_angle_z

3D rotation angle around z for pykrige.

pykrige_anis

2D anisotropy ratio for pykrige.

pykrige_anis_y

3D anisotropy ratio in y direction for pykrige.

pykrige_anis_z

3D anisotropy ratio in z direction for pykrige.

pykrige_kwargs

Keyword arguments for pykrige routines.

sill

float: The sill of the variogram.

var

float: The variance of the model.

var_bounds

list: Bounds for the variance.

var_raw

float: The raw variance of the model without factor.

Methods

calc_integral_scale() Calculate the integral scale of the isotrope model.
check_arg_bounds() Check arguments to be within the given bounds.
check_opt_arg() Run checks for the optional arguments.
cor_spatial(pos) Spatial correlation respecting anisotropy and rotation.
correlation(r) Linear correlation function.
cov_nugget(r) Covariance of the model respecting the nugget at r=0.
cov_spatial(pos) Spatial covariance respecting anisotropy and rotation.
covariance(r) Covariance of the model.
default_arg_bounds() Provide default boundaries for arguments.
default_opt_arg() Provide default optional arguments by the user.
default_opt_arg_bounds() Provide default boundaries for optional arguments.
fit_variogram(x_data, y_data[, maxfev]) Fiting the isotropic variogram-model to given data.
fix_dim() Set a fix dimension for the model.
ln_spectral_rad_pdf(r) Log radial spectral density of the model.
percentile_scale([per]) Calculate the percentile scale of the isotrope model.
plot([func]) Plot a function of a the CovModel.
pykrige_vario([args, r]) Isotropic variogram of the model for pykrige.
set_arg_bounds(**kwargs) Set bounds for the parameters of the model.
spectral_density(k) Spectral density of the covariance model.
spectral_rad_pdf(r) Radial spectral density of the model.
spectrum(k) Spectrum of the covariance model.
var_factor() Factor for the variance.
vario_nugget(r) Isotropic variogram of the model respecting the nugget at r=0.
vario_spatial(pos) Spatial variogram respecting anisotropy and rotation.
variogram(r) Isotropic variogram of the model.
correlation(r)[source]

Linear correlation function.

\mathrm{cor}(r) =
\begin{cases}
1-\frac{r}{\ell}
& r<\ell\\
0 & r\geq\ell
\end{cases}

covariance(r)

Covariance of the model.

Given by: C\left(r\right)=
\sigma^2\cdot\mathrm{cor}\left(r\right)

Where \mathrm{cor}(r) is the correlation function.

variogram(r)

Isotropic variogram of the model.

Given by: \gamma\left(r\right)=
\sigma^2\cdot\left(1-\mathrm{cor}\left(r\right)\right)+n

Where \mathrm{cor}(r) is the correlation function.

class gstools.covmodel.models.Circular(dim=3, var=1.0, len_scale=1.0, nugget=0.0, anis=1.0, angles=0.0, integral_scale=None, var_raw=None, hankel_kw=None, **opt_arg)[source]

Bases: gstools.covmodel.base.CovModel

The circular covariance model.

This model is derived as the relative intersection area of two discs in 2D, where the middle points have a distance of r and the diameters are given by \ell.

Notes

This model is given by the following correlation function:

\mathrm{cor}(r) =
\begin{cases}
\frac{2}{\pi}\cdot\left(
\cos^{-1}\left(\frac{r}{\ell}\right) -
\frac{r}{\ell}\cdot\sqrt{1-\left(\frac{r}{\ell}\right)^{2}}
\right)
& r<\ell\\
0 & r\geq\ell
\end{cases}

.

Parameters:
  • dim (int, optional) – dimension of the model. Default: 3
  • var (float, optional) – variance of the model (the nugget is not included in “this” variance) Default: 1.0
  • len_scale (float or list, optional) – length scale of the model. If a single value is given, the same length-scale will be used for every direction. If multiple values (for main and transversal directions) are given, anis will be recalculated accordingly. Default: 1.0
  • nugget (float, optional) – nugget of the model. Default: 0.0
  • anis (float or list, optional) – anisotropy ratios in the transversal directions [y, z]. Default: 1.0
  • angles (float or list, optional) –

    angles of rotation:

    • in 2D: given as rotation around z-axis
    • in 3D: given by yaw, pitch, and roll (known as Tait–Bryan angles)

    Default: 0.0

  • integral_scale (float or list or None, optional) – If given, len_scale will be ignored and recalculated, so that the integral scale of the model matches the given one. Default: None
  • var_raw (float or None, optional) – raw variance of the model which will be multiplied with CovModel.var_factor to result in the actual variance. If given, var will be ignored. (This is just for models that override CovModel.var_factor) Default: None
  • hankel_kw (dict or None, optional) – Modify the init-arguments of hankel.SymmetricFourierTransform used for the spectrum calculation. Use with caution (Better: Don’t!). None is equivalent to {"a": -1, "b": 1, "N": 1000, "h": 0.001}.
Attributes:
angles

numpy.ndarray: Rotation angles (in rad) of the model.

anis

numpy.ndarray: The anisotropy factors of the model.

arg

list of str: Names of all arguments.

arg_bounds

dict: Bounds for all parameters.

dim

int: The dimension of the model.

dist_func

tuple of callable: pdf, cdf and ppf.

do_rotation

bool: State if a rotation is performed.

hankel_kw

dict: hankel.SymmetricFourierTransform kwargs.

has_cdf

bool: State if a cdf is defined by the user.

has_ppf

bool: State if a ppf is defined by the user.

integral_scale

float: The main integral scale of the model.

integral_scale_vec

numpy.ndarray: The integral scales in each direction.

len_scale

float: The main length scale of the model.

len_scale_bounds

list: Bounds for the lenght scale.

len_scale_vec

numpy.ndarray: The length scales in each direction.

name

str: The name of the CovModel class.

nugget

float: The nugget of the model.

nugget_bounds

list: Bounds for the nugget.

opt_arg

list of str: Names of the optional arguments.

opt_arg_bounds

dict: Bounds for the optional arguments.

pykrige_angle

2D rotation angle for pykrige.

pykrige_angle_x

3D rotation angle around x for pykrige.

pykrige_angle_y

3D rotation angle around y for pykrige.

pykrige_angle_z

3D rotation angle around z for pykrige.

pykrige_anis

2D anisotropy ratio for pykrige.

pykrige_anis_y

3D anisotropy ratio in y direction for pykrige.

pykrige_anis_z

3D anisotropy ratio in z direction for pykrige.

pykrige_kwargs

Keyword arguments for pykrige routines.

sill

float: The sill of the variogram.

var

float: The variance of the model.

var_bounds

list: Bounds for the variance.

var_raw

float: The raw variance of the model without factor.

Methods

calc_integral_scale() Calculate the integral scale of the isotrope model.
check_arg_bounds() Check arguments to be within the given bounds.
check_opt_arg() Run checks for the optional arguments.
cor_spatial(pos) Spatial correlation respecting anisotropy and rotation.
correlation(r) Circular correlation function.
cov_nugget(r) Covariance of the model respecting the nugget at r=0.
cov_spatial(pos) Spatial covariance respecting anisotropy and rotation.
covariance(r) Covariance of the model.
default_arg_bounds() Provide default boundaries for arguments.
default_opt_arg() Provide default optional arguments by the user.
default_opt_arg_bounds() Provide default boundaries for optional arguments.
fit_variogram(x_data, y_data[, maxfev]) Fiting the isotropic variogram-model to given data.
fix_dim() Set a fix dimension for the model.
ln_spectral_rad_pdf(r) Log radial spectral density of the model.
percentile_scale([per]) Calculate the percentile scale of the isotrope model.
plot([func]) Plot a function of a the CovModel.
pykrige_vario([args, r]) Isotropic variogram of the model for pykrige.
set_arg_bounds(**kwargs) Set bounds for the parameters of the model.
spectral_density(k) Spectral density of the covariance model.
spectral_rad_pdf(r) Radial spectral density of the model.
spectrum(k) Spectrum of the covariance model.
var_factor() Factor for the variance.
vario_nugget(r) Isotropic variogram of the model respecting the nugget at r=0.
vario_spatial(pos) Spatial variogram respecting anisotropy and rotation.
variogram(r) Isotropic variogram of the model.
correlation(r)[source]

Circular correlation function.

\mathrm{cor}(r) =
\begin{cases}
\frac{2}{\pi}\cdot\left(
\cos^{-1}\left(\frac{r}{\ell}\right) -
\frac{r}{\ell}\cdot\sqrt{1-\left(\frac{r}{\ell}\right)^{2}}
\right)
& r<\ell\\
0 & r\geq\ell
\end{cases}

covariance(r)

Covariance of the model.

Given by: C\left(r\right)=
\sigma^2\cdot\mathrm{cor}\left(r\right)

Where \mathrm{cor}(r) is the correlation function.

variogram(r)

Isotropic variogram of the model.

Given by: \gamma\left(r\right)=
\sigma^2\cdot\left(1-\mathrm{cor}\left(r\right)\right)+n

Where \mathrm{cor}(r) is the correlation function.

class gstools.covmodel.models.Spherical(dim=3, var=1.0, len_scale=1.0, nugget=0.0, anis=1.0, angles=0.0, integral_scale=None, var_raw=None, hankel_kw=None, **opt_arg)[source]

Bases: gstools.covmodel.base.CovModel

The Spherical covariance model.

This model is derived from the relative intersection area of two spheres in 3D, where the middle points have a distance of r and the diameters are given by \ell.

Notes

This model is given by the following correlation function:

\mathrm{cor}(r) =
\begin{cases}
1-\frac{3}{2}\cdot\frac{r}{\ell} +
\frac{1}{2}\cdot\left(\frac{r}{\ell}\right)^{3}
& r<\ell\\
0 & r\geq\ell
\end{cases}

.

Parameters:
  • dim (int, optional) – dimension of the model. Default: 3
  • var (float, optional) – variance of the model (the nugget is not included in “this” variance) Default: 1.0
  • len_scale (float or list, optional) – length scale of the model. If a single value is given, the same length-scale will be used for every direction. If multiple values (for main and transversal directions) are given, anis will be recalculated accordingly. Default: 1.0
  • nugget (float, optional) – nugget of the model. Default: 0.0
  • anis (float or list, optional) – anisotropy ratios in the transversal directions [y, z]. Default: 1.0
  • angles (float or list, optional) –

    angles of rotation:

    • in 2D: given as rotation around z-axis
    • in 3D: given by yaw, pitch, and roll (known as Tait–Bryan angles)

    Default: 0.0

  • integral_scale (float or list or None, optional) – If given, len_scale will be ignored and recalculated, so that the integral scale of the model matches the given one. Default: None
  • var_raw (float or None, optional) – raw variance of the model which will be multiplied with CovModel.var_factor to result in the actual variance. If given, var will be ignored. (This is just for models that override CovModel.var_factor) Default: None
  • hankel_kw (dict or None, optional) – Modify the init-arguments of hankel.SymmetricFourierTransform used for the spectrum calculation. Use with caution (Better: Don’t!). None is equivalent to {"a": -1, "b": 1, "N": 1000, "h": 0.001}.
Attributes:
angles

numpy.ndarray: Rotation angles (in rad) of the model.

anis

numpy.ndarray: The anisotropy factors of the model.

arg

list of str: Names of all arguments.

arg_bounds

dict: Bounds for all parameters.

dim

int: The dimension of the model.

dist_func

tuple of callable: pdf, cdf and ppf.

do_rotation

bool: State if a rotation is performed.

hankel_kw

dict: hankel.SymmetricFourierTransform kwargs.

has_cdf

bool: State if a cdf is defined by the user.

has_ppf

bool: State if a ppf is defined by the user.

integral_scale

float: The main integral scale of the model.

integral_scale_vec

numpy.ndarray: The integral scales in each direction.

len_scale

float: The main length scale of the model.

len_scale_bounds

list: Bounds for the lenght scale.

len_scale_vec

numpy.ndarray: The length scales in each direction.

name

str: The name of the CovModel class.

nugget

float: The nugget of the model.

nugget_bounds

list: Bounds for the nugget.

opt_arg

list of str: Names of the optional arguments.

opt_arg_bounds

dict: Bounds for the optional arguments.

pykrige_angle

2D rotation angle for pykrige.

pykrige_angle_x

3D rotation angle around x for pykrige.

pykrige_angle_y

3D rotation angle around y for pykrige.

pykrige_angle_z

3D rotation angle around z for pykrige.

pykrige_anis

2D anisotropy ratio for pykrige.

pykrige_anis_y

3D anisotropy ratio in y direction for pykrige.

pykrige_anis_z

3D anisotropy ratio in z direction for pykrige.

pykrige_kwargs

Keyword arguments for pykrige routines.

sill

float: The sill of the variogram.

var

float: The variance of the model.

var_bounds

list: Bounds for the variance.

var_raw

float: The raw variance of the model without factor.

Methods

calc_integral_scale() Calculate the integral scale of the isotrope model.
check_arg_bounds() Check arguments to be within the given bounds.
check_opt_arg() Run checks for the optional arguments.
cor_spatial(pos) Spatial correlation respecting anisotropy and rotation.
correlation(r) Spherical correlation function.
cov_nugget(r) Covariance of the model respecting the nugget at r=0.
cov_spatial(pos) Spatial covariance respecting anisotropy and rotation.
covariance(r) Covariance of the model.
default_arg_bounds() Provide default boundaries for arguments.
default_opt_arg() Provide default optional arguments by the user.
default_opt_arg_bounds() Provide default boundaries for optional arguments.
fit_variogram(x_data, y_data[, maxfev]) Fiting the isotropic variogram-model to given data.
fix_dim() Set a fix dimension for the model.
ln_spectral_rad_pdf(r) Log radial spectral density of the model.
percentile_scale([per]) Calculate the percentile scale of the isotrope model.
plot([func]) Plot a function of a the CovModel.
pykrige_vario([args, r]) Isotropic variogram of the model for pykrige.
set_arg_bounds(**kwargs) Set bounds for the parameters of the model.
spectral_density(k) Spectral density of the covariance model.
spectral_rad_pdf(r) Radial spectral density of the model.
spectrum(k) Spectrum of the covariance model.
var_factor() Factor for the variance.
vario_nugget(r) Isotropic variogram of the model respecting the nugget at r=0.
vario_spatial(pos) Spatial variogram respecting anisotropy and rotation.
variogram(r) Isotropic variogram of the model.
correlation(r)[source]

Spherical correlation function.

\mathrm{cor}(r) =
\begin{cases}
1-\frac{3}{2}\cdot\frac{r}{\ell} +
\frac{1}{2}\cdot\left(\frac{r}{\ell}\right)^{3}
& r<\ell\\
0 & r\geq\ell
\end{cases}

covariance(r)

Covariance of the model.

Given by: C\left(r\right)=
\sigma^2\cdot\mathrm{cor}\left(r\right)

Where \mathrm{cor}(r) is the correlation function.

variogram(r)

Isotropic variogram of the model.

Given by: \gamma\left(r\right)=
\sigma^2\cdot\left(1-\mathrm{cor}\left(r\right)\right)+n

Where \mathrm{cor}(r) is the correlation function.

class gstools.covmodel.models.Intersection(dim=3, var=1.0, len_scale=1.0, nugget=0.0, anis=1.0, angles=0.0, integral_scale=None, var_raw=None, hankel_kw=None, **opt_arg)[source]

Bases: gstools.covmodel.base.CovModel

The Intersection covariance model.

This model is derived from the relative intersection area of two d-dimensional spheres, where the middle points have a distance of r and the diameters are given by \ell.

In 1D this is the Linear model, in 2D this is the Circular model and in 3D this is the Spherical model.

Notes

This model is given by the following correlation functions.

In 1D:

\mathrm{cor}(r) =
\begin{cases}
1-\frac{r}{\ell}
& r<\ell\\
0 & r\geq\ell
\end{cases}

In 2D:

\mathrm{cor}(r) =
\begin{cases}
\frac{2}{\pi}\cdot\left(
\cos^{-1}\left(\frac{r}{\ell}\right) -
\frac{r}{\ell}\cdot\sqrt{1-\left(\frac{r}{\ell}\right)^{2}}
\right)
& r<\ell\\
0 & r\geq\ell
\end{cases}

In 3D:

\mathrm{cor}(r) =
\begin{cases}
1-\frac{3}{2}\cdot\frac{r}{\ell} +
\frac{1}{2}\cdot\left(\frac{r}{\ell}\right)^{3}
& r<\ell\\
0 & r\geq\ell
\end{cases}

.

Parameters:
  • dim (int, optional) – dimension of the model. Default: 3
  • var (float, optional) – variance of the model (the nugget is not included in “this” variance) Default: 1.0
  • len_scale (float or list, optional) – length scale of the model. If a single value is given, the same length-scale will be used for every direction. If multiple values (for main and transversal directions) are given, anis will be recalculated accordingly. Default: 1.0
  • nugget (float, optional) – nugget of the model. Default: 0.0
  • anis (float or list, optional) – anisotropy ratios in the transversal directions [y, z]. Default: 1.0
  • angles (float or list, optional) –

    angles of rotation:

    • in 2D: given as rotation around z-axis
    • in 3D: given by yaw, pitch, and roll (known as Tait–Bryan angles)

    Default: 0.0

  • integral_scale (float or list or None, optional) – If given, len_scale will be ignored and recalculated, so that the integral scale of the model matches the given one. Default: None
  • var_raw (float or None, optional) – raw variance of the model which will be multiplied with CovModel.var_factor to result in the actual variance. If given, var will be ignored. (This is just for models that override CovModel.var_factor) Default: None
  • hankel_kw (dict or None, optional) – Modify the init-arguments of hankel.SymmetricFourierTransform used for the spectrum calculation. Use with caution (Better: Don’t!). None is equivalent to {"a": -1, "b": 1, "N": 1000, "h": 0.001}.
Attributes:
angles

numpy.ndarray: Rotation angles (in rad) of the model.

anis

numpy.ndarray: The anisotropy factors of the model.

arg

list of str: Names of all arguments.

arg_bounds

dict: Bounds for all parameters.

dim

int: The dimension of the model.

dist_func

tuple of callable: pdf, cdf and ppf.

do_rotation

bool: State if a rotation is performed.

hankel_kw

dict: hankel.SymmetricFourierTransform kwargs.

has_cdf

bool: State if a cdf is defined by the user.

has_ppf

bool: State if a ppf is defined by the user.

integral_scale

float: The main integral scale of the model.

integral_scale_vec

numpy.ndarray: The integral scales in each direction.

len_scale

float: The main length scale of the model.

len_scale_bounds

list: Bounds for the lenght scale.

len_scale_vec

numpy.ndarray: The length scales in each direction.

name

str: The name of the CovModel class.

nugget

float: The nugget of the model.

nugget_bounds

list: Bounds for the nugget.

opt_arg

list of str: Names of the optional arguments.

opt_arg_bounds

dict: Bounds for the optional arguments.

pykrige_angle

2D rotation angle for pykrige.

pykrige_angle_x

3D rotation angle around x for pykrige.

pykrige_angle_y

3D rotation angle around y for pykrige.

pykrige_angle_z

3D rotation angle around z for pykrige.

pykrige_anis

2D anisotropy ratio for pykrige.

pykrige_anis_y

3D anisotropy ratio in y direction for pykrige.

pykrige_anis_z

3D anisotropy ratio in z direction for pykrige.

pykrige_kwargs

Keyword arguments for pykrige routines.

sill

float: The sill of the variogram.

var

float: The variance of the model.

var_bounds

list: Bounds for the variance.

var_raw

float: The raw variance of the model without factor.

Methods

calc_integral_scale() Calculate the integral scale of the isotrope model.
check_arg_bounds() Check arguments to be within the given bounds.
check_opt_arg() Run checks for the optional arguments.
cor_spatial(pos) Spatial correlation respecting anisotropy and rotation.
cov_nugget(r) Covariance of the model respecting the nugget at r=0.
cov_spatial(pos) Spatial covariance respecting anisotropy and rotation.
covariance(r) Covariance of the model.
default_arg_bounds() Provide default boundaries for arguments.
default_opt_arg() Provide default optional arguments by the user.
default_opt_arg_bounds() Provide default boundaries for optional arguments.
fit_variogram(x_data, y_data[, maxfev]) Fiting the isotropic variogram-model to given data.
fix_dim() Set a fix dimension for the model.
ln_spectral_rad_pdf(r) Log radial spectral density of the model.
percentile_scale([per]) Calculate the percentile scale of the isotrope model.
plot([func]) Plot a function of a the CovModel.
pykrige_vario([args, r]) Isotropic variogram of the model for pykrige.
set_arg_bounds(**kwargs) Set bounds for the parameters of the model.
spectral_density(k) Spectral density of the covariance model.
spectral_rad_pdf(r) Radial spectral density of the model.
spectrum(k) Spectrum of the covariance model.
var_factor() Factor for the variance.
vario_nugget(r) Isotropic variogram of the model respecting the nugget at r=0.
vario_spatial(pos) Spatial variogram respecting anisotropy and rotation.
variogram(r) Isotropic variogram of the model.
correlation  
correlation(r)[source]
covariance(r)

Covariance of the model.

Given by: C\left(r\right)=
\sigma^2\cdot\mathrm{cor}\left(r\right)

Where \mathrm{cor}(r) is the correlation function.

spectral_density(k)[source]

Spectral density of the covariance model.

This is given by:

\tilde{S}(k) = \frac{S(k)}{\sigma^2}

Where S(k) is the spectrum of the covariance model.

Parameters:k (float) – Radius of the phase: k=\left\Vert\mathbf{k}\right\Vert
variogram(r)

Isotropic variogram of the model.

Given by: \gamma\left(r\right)=
\sigma^2\cdot\left(1-\mathrm{cor}\left(r\right)\right)+n

Where \mathrm{cor}(r) is the correlation function.