skbel.spatial
This package provides a set of functions to perform spatial analysis on the data from the skbel package.
skbel.spatial.spatial
- skbel.spatial.spatial.block_shaped(arr: array, nrows: int, ncols: int, nlay: int = 1) array[source]
Return an array of shape (nlayers, nrows, ncols)
- Parameters:
arr – Array
nrows – Number of rows
ncols – Number of columns
nlay – Number of layers
- Returns:
Array of shape (nlayers, nrows, ncols)
- skbel.spatial.spatial.blocks_from_rc(rows: array, columns: array) array[source]
Returns the blocks forming a 2D grid whose rows and columns widths are defined by the two arrays rows, columns.
- Parameters:
rows – Array of row widths
columns – Array of column widths
- Returns:
Array of blocks
- skbel.spatial.spatial.blocks_from_rc_3d(rows: array, columns: array, layers: array) array[source]
Returns the blocks forming a 2D grid whose rows and columns widths are defined by the two arrays rows, columns.
- Parameters:
rows – Array of row widths
columns – Array of column widths
layers – Array of layer widths
- Returns:
Array of blocks
- skbel.spatial.spatial.contour_extract(x_lim, y_lim, grf, Z)[source]
Extract the 0 contour from the sampled posterior, corresponding to the field delineation.
- Parameters:
x_lim – x limits of the grid
y_lim – y limits of the grid
grf – grid resolution
Z – sampled posterior
- Returns:
contour (x, y, vertices)
- skbel.spatial.spatial.contours_vertices(x: list, y: list, arrays: array, c: float = 0, ignore: bool = True) array[source]
Extracts contour vertices from a list of matrices.
- Parameters:
x – x coordinates of the grid
y – y coordinates of the grid
arrays – list of matrices
c – Contour value
ignore – Bool value to consider multiple contours or not (see comments)
- Returns:
vertices array
- skbel.spatial.spatial.get_centroids(array: array, grf: float) array[source]
Given a (m, n) matrix of cells dimensions in the x-y axes, returns the (m, n, 2) matrix of the coordinates of centroids.
- Parameters:
array – (m, n) array
grf – float: Cell dimension
- Returns:
(m, n, 2) array
- skbel.spatial.spatial.grid_parameters(x_lim: list = None, y_lim: list = None, z_lim=None, grf: float = 1) -> (<built-in function array>, <class 'int'>, <class 'int'>)[source]
Generates grid parameters given dimensions.
- Parameters:
x_lim – X limits
y_lim – Y limits
z_lim – Z limits
grf – Cell dimension
- Returns:
(cell centers, number of rows, number of columns)
- skbel.spatial.spatial.rc_from_blocks(blocks: array) -> (<built-in function array>, <built-in function array>, <built-in function array>)[source]
Computes the x, y and z coordinates of the cell centers from the blocks.
- Parameters:
blocks – Array of blocks
- Returns:
(dx, dy, dz) dimensions of the cells
- skbel.spatial.spatial.refine_axis(widths: list[float], r_pt: float, ext: float, cnd: float, d_dim: float, a_lim: float) array[source]
Refines one 1D axis around a point belonging to it.
- Example:
along_c = refine_axis([10m, 10m… 10m], 500m, 70m, 2m, 10m, 1500m)
- Parameters:
widths – Array of cell widths along axis.
r_pt – 1D point on the axis around which refining will occur.
ext – Extent (distance) of the refinement around the point.
cnd – New cell size after refinement.
d_dim – Base cell dimension.
a_lim – Limit of the axis.
- Returns:
Refined axis (widths)
- skbel.spatial.spatial.refine_machine(xlim: list, ylim: list, new_grf: int) -> (<class 'int'>, <class 'int'>, <built-in function array>, <built-in function array>)[source]
Refines the grid to a new resolution.
- Parameters:
xlim – x limits of the grid
ylim – y limits of the grid
new_grf – new grid resolution
- Returns:
new grid resolution (nrow, ncol, x, y)