Grids¶
Grid¶
- class Grid(*args, **kwargs)[source]¶
Bases:
SpatialComponent
Basic grid class.
- property as_corner_point¶
Corner-point representation of the grid.
- bounding_box¶
Pair of diagonal corner points for grid’s bounding box.
- calculate_neighbours_distances(connectivity=1, fill_value=-1, neighbours_matrix=None)[source]¶
Calculate distances between neighbors for all active cells.
- Parameters:
connectivity (int, optional) – Maximum number of orthogonal hops to consider a cell is as a neighbor., by default 1.
fill_value (int, optional) – Value to fill indices of inactive or absent neighbors, by default -1.
neighbours_matrix (numpy.ndarray, optional) – Matrix with indices of neighbors in unraveled form.
- Returns:
Matrix of distances.
- Return type:
- property cell_centroids¶
Centroids of cells.
- property cell_volumes¶
Volumes of cells.
- create_vtk_grid(use_only_active=True, scaling=True, **kwargs)[source]¶
Creates pyvista unstructured grid object.
- Returns:
grid
- Return type:
pyvista.core.pointset.UnstructuredGrid object
- property ex¶
Unit vector along grid X axis.
- property ey¶
Unit vector along grid Y axis.
- get_neighbors_matrix(connectivity=1, fill_value=-1, ravel_index=False)[source]¶
Get indices of neighbors for all active cells.
- Parameters:
- Returns:
res – Matrix of active neighbors and matrix of distances if ‘calculate_distances’.
- Return type:
misc
- property origin¶
Grid axes origin relative to the map coordinates.
- property xyz¶
Cell vertices coordinates.
Orthogonal uniform grid¶
Corner-point grid¶
- class CornerPointGrid(*args, **kwargs)[source]¶
Bases:
Grid
Corner point grid.
- property as_corner_point¶
Returns itself.
- cell_bases(cell_indices)[source]¶
Calculate basis vectors of coordinate systems connected to cells.
- Parameters:
cells_indices (List[np.ndarray]) – Indices of the cells.
- Returns:
Basis vectors of coordinate systems connected to cells.
- Return type:
np.ndarray
- cell_sizes(cell_indices)[source]¶
Calculate approximate sizes of cells.
- Parameters:
cells_indices (List[np.ndarray]) – Indices of the cells.
- Returns:
Sizes of cells.
- Return type:
np.ndarray
- property cell_volumes¶
Volumes of cells.
- crop_minimal_cube()[source]¶
Crop to minimal cube containing active cells.
- Returns:
(grid, min_slices) – New grid and slices for active cube.
- Return type:
- crop_minimal_grid(nz, fillna=None)[source]¶
Create a new grid in a region between upper and bottom surfaces enclosing active cells. Actnum transfer should be made separately.
- faces_centers(cells_indices)[source]¶
Calculate coordinates of cell faces centers.
- Parameters:
cells_indices (List[np.ndarray]) – Indices of the cells.
- Returns:
coordinates of cell faces centers.
- Return type:
np.ndarray
- map_grid()[source]¶
Map pillars (COORD) to axis defined by `MAPAXES’.
- Returns:
Grid with updated COORD and MAPAXES fields.
- Return type:
- property origin¶
Grid axes origin relative to the map coordinates.
- orthogonalize(dimens, only_active=False)[source]¶
Construct orthogonal grid. Actnum tranfer should be made separately.
- upscale(factors=(2, 2, 2), actnum_upscale='vote')[source]¶
Upscale grid according to factors given.
- Parameters:
factors (tuple, int) – Scale factors along each axis. If int, factors are the same for each axis.
actnum_upscale (str) – Method to actnum upscaling. If ‘vote’, upscaled cell is active if majority of finer cells are active. If ‘any’, upscaled cell is active if any of finer cells is active. Default to ‘vote’.
- Returns:
grid – Upscaled grid.
- Return type:
- property xyz¶
x, y, z coordinates of cells vertices.