geolime.geostats.estimation.kriging

Classes:

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

Grid(metadata, convention)

Neighborhood()

PatternGenerator()

threadpool_limits([limits, user_api])

Change the maximal number of threads that can be used in thread pools.

Functions:

average_kriging(xcoords, xdat, targets, cov, var)

Ordinary / Simple kriging algorithm (punctual).

block_kriging(xcoords, xdat, points, cov, neigh)

Block kriging function.

block_kriging_nodes(xcoords, xdat, point, …)

Punctual kriging function for a specific block node

compute_weights(xcoords, targets, cov)

Compute kriging weights according to a covariance model

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

Applies a covariance model to a given grid for variance calculus

discrete_gaussian_kriging(target_grid, …)

Apply discrete gaussian kriging on a grid.

discrete_gaussian_kriging_block(point, …)

Apply discrete gaussian kriging on a grid block

discrete_gaussian_kriging_by_index(points, …)

Apply discrete gaussian kriging on a set of grid indices.

discrete_gaussian_weights(target_node, …)

Compute Discrete Gaussian Kriging weights

group_data(target_grid, xcoords, xdata)

Create a dataset from point mean in common blocks

in_which_block(x, grid)

Return indexes of block containing point

geolime.geostats.estimation.kriging.average_kriging(xcoords: numpy.ndarray, xdat: numpy.ndarray, targets: numpy.ndarray, cov: geolime.geostats.models.covariance.Covariance, var: float, mean: float = None, variance_estim: bool = False, slope_regression: bool = False, kriging_efficiency: bool = False)

Ordinary / Simple kriging algorithm (punctual). If mean is given as input argument, simple kriging will be applied. Otherwise ordinary kriging is set as default.

Parameters
  • xcoords (np.ndarray) – Reference coordinates for covariance calculus

  • xdat (np.ndarray) – Input data

  • targets (np.ndarray) – Points for estimation

  • cov (Covariance) – Covariance model to be applied

  • var (float) – Input variance

  • mean (float, optional) – Optional mean for simple kriging

  • variance_estim (bool, optional) – Optional. Indicates if the kriging variance (Var(Z^star)) has to be returned (for uniform conditioning) instead of sqrt(Var(Z^star)-Var(Z))

  • slope_regression (bool, optional) – Optional. When defined as True, include slope regression as an array in output list

  • kriging_efficiency (bool, optional) – Optional. When defined as True, include kriging efficiency as an array in output list

Returns

Multiple arrays: kriging estimates and kriging stadard deviation

Return type

np.ndarray

geolime.geostats.estimation.kriging.block_kriging(xcoords: numpy.ndarray, xdat: numpy.ndarray, points: numpy.ndarray, cov: geolime.geostats.models.covariance.Covariance, neigh: geolime.geostats.math.neighborhood.Neighborhood, pattern_generator: geolime.geostats.patterns.pattern_generator.PatternGenerator = None, mean: float = None, variance_estim: bool = False, slope_regression: bool = False, kriging_efficiency: bool = False)

Block kriging function. If discretization is a [1, 1, 1] array: punctual kriging. Block kriging otherwise.

Parameters
  • xcoords (np.ndarray) – Reference coordinates for covariance calculus

  • xdat (np.ndarray) – Input data

  • points (np.ndarray) – List of points to estimate

  • cov (Covariance) – Covariance model to be applied

  • neigh (Neighborhood) – Neighborhood object

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

  • mean (float, optional) – Optional mean for simple kriging.

  • variance_estim (bool, optional) – Optional to compute estimation variance instead

  • slope_regression (bool, optional) – Optional. When defined as True, slope regression array will be included in output list

  • kriging_efficiency (bool, optional) – Optional. When defined as True, kriging efficiency array will be included in output list

Returns

Kriging estimation and standard deviation arrays

Return type

np.ndarray

geolime.geostats.estimation.kriging.block_kriging_nodes(xcoords: numpy.ndarray, xdat: numpy.ndarray, point: numpy.ndarray, cov: geolime.geostats.models.covariance.Covariance, neigh: geolime.geostats.math.neighborhood.Neighborhood, pattern_generator: geolime.geostats.patterns.pattern_generator.PatternGenerator, var: float, mean: float = None, variance_estim: bool = False, slope_regression: bool = False, kriging_efficiency: bool = False)

Punctual kriging function for a specific block node

Parameters
  • xcoords (np.ndarray) – Reference coordinates for covariance calculus

  • xdat (np.ndarray) – Input data

  • point (np.ndarray) – Point to consider for estimation

  • cov (Covariance) – Covariance model to be applied

  • neigh (Neighborhood) – Neighborhood object

  • pattern_generator (PatternGenerator) – Optional function to apply points transformation prior to estimation

  • var (float) – Variance

  • mean (float, optional) – Optional mean for simple kriging.

  • variance_estim (bool, optional) – Optional to compute estimation variance instead

  • slope_regression (bool, optional) – Optional. When defined as True, slope regression array will be included in output list

  • kriging_efficiency (bool, optional) – Optional. When defined as True, kriging efficiency array will be included in output list

Returns

Kriging estimates and standard deviation arrays

Return type

np.ndarray

geolime.geostats.estimation.kriging.compute_weights(xcoords: numpy.ndarray, targets: numpy.ndarray, cov: geolime.geostats.models.covariance.Covariance)

Compute kriging weights according to a covariance model

Parameters
  • xcoords (np.ndarray) – Reference coordinates for covariance calculus

  • targets (np.ndarray) – Points for covariance evaluation

  • cov (Covariance) – Covariance model

Returns

Multiple output containing the simple kriging weights, kriging means, Ordinary kriging weights, initial covariance and a debugging weight array

Return type

np.ndarray

geolime.geostats.estimation.kriging.discrete_gaussian_kriging(target_grid: geolime.objects.grid.Grid, xcoords: numpy.ndarray, xdata: numpy.ndarray, cov: geolime.geostats.models.covariance.Covariance, neigh: geolime.geostats.math.neighborhood.Neighborhood, r: float)

Apply discrete gaussian kriging on a grid. Doesn’t require data grouping and input indices.

Parameters
  • target_grid (Grid) – Grid to apply discrete gaussian kriging to

  • xcoords (np.ndarray) – Input coordinates (not centered)

  • xdata (np.ndarray) – Input values

  • cov (Covariance) – Covariance model to be applied

  • neigh (Neighborhood) – Neighborhood to be considered for kriging

  • r (float) – Change of support coefficient

Returns

Kriging estimation and standard deviation array

Return type

np.ndarray

geolime.geostats.estimation.kriging.discrete_gaussian_kriging_block(point: numpy.ndarray, xcoordsc: numpy.ndarray, mean_by_block: numpy.ndarray, n_points_in_blocks: numpy.ndarray, cov: geolime.geostats.models.covariance.Covariance, neigh: geolime.geostats.math.neighborhood.Neighborhood, r: float)

Apply discrete gaussian kriging on a grid block

Parameters
  • point (np.ndarray) – Point to apply discrete gaussian kriging to

  • xcoordsc (np.ndarray) – Center coordinates

  • mean_by_block (np.ndarray) – Block mean array

  • n_points_in_blocks (np.ndarray) – Number of points in block array

  • cov (Covariance) – Covariance model to be applied

  • neigh (Neighborhood) – Neighborhood to be considered for kriging

  • r (float) – Change of support coefficient

Returns

Kriging estimation and standard deviation arrays

Return type

List

geolime.geostats.estimation.kriging.discrete_gaussian_kriging_by_index(points: numpy.ndarray, xcoords_c: numpy.ndarray, mean_by_block: numpy.ndarray, n_points_in_blocks: numpy.ndarray, cov: geolime.geostats.models.covariance.Covariance, neigh: geolime.geostats.math.neighborhood.Neighborhood, r: float)

Apply discrete gaussian kriging on a set of grid indices. To be used after grouping the data in block centers.

Parameters
  • points (np.ndarray) – Points to apply discrete gaussian kriging to

  • xcoords_c (np.ndarray) – Center coordinates

  • mean_by_block (np.ndarray) – Mean by block array

  • n_points_in_blocks (np.ndarray) – Number of points in block array

  • cov (Covariance) – Covariance model to be applied

  • neigh (Neighborhood) – Neighborhood to be considered for kriging

  • r (float) – Change of support coefficient

Returns

Description of returned object.

Return type

type

geolime.geostats.estimation.kriging.discrete_gaussian_weights(target_node: numpy.ndarray, coords: numpy.ndarray, n: int, cov: geolime.geostats.models.covariance.Covariance, r: float)

Compute Discrete Gaussian Kriging weights

Parameters
  • target_node (np.ndarray) – Node array to apply Discrete Gaussian Kriging to

  • coords (np.ndarray) – Input coordinates array

  • n (int) – Number of points in block

  • cov (Covariance) – Covariance model to be applied

  • r (float) – Change of support coefficient

Returns

Weights and covariance arrays

Return type

np.ndarray

geolime.geostats.estimation.kriging.group_data(target_grid: geolime.objects.grid.Grid, xcoords: numpy.ndarray, xdata: numpy.ndarray)

Create a dataset from point mean in common blocks

Parameters
  • target_grid (Grid) – Input grid from which to group blocks

  • xcoords (np.ndarray) – Input coordinates

  • xdata (np.ndarray) – Input values to be grouped and mean estimated

Returns

Multiple arrays are returned: a center coordinates array, the number of points in blocks and the block means

Return type

np.ndarray

geolime.geostats.estimation.kriging.in_which_block(x: numpy.ndarray, grid: geolime.objects.grid.Grid)

Return indexes of block containing point

Parameters
  • x (np.ndarray) – Input coordinates

  • grid (Grid) – Input grid to be parsed

Returns

List of block indices

Return type

List[int]