Skip to content

Block Model🍋

BlockModel 🍋

Bases: GridObject

A BlockModel is considered cartesian/XYZ oriented with fixed cell size. The cells may not be contiguous and don't have to all be defined. The grid is considered cell-centered.

For instance, a block model can be of shape 5 x 3 x 2 but only have 3 cells defined at [1, 2, 1], [1, 3, 1] and [2, 3, 1].

Grid dimensions and cell sizes are inferred from the X, Y, Z geometry. The grid is assumed to be cartesian and to have a constant cell size.

Parameters:

Name Type Description Default
name str

object name.

required
xyz Optional[Data]

cell centers of the block model.

None
atol float

absolute tolerance used to automatically calculate the cell dimension. It is the distance tolerance (same unit as xyz) to consider whether the dimensions of all cells can be considered equal. Defaults to 0.001.

0.001
cell_size Vector

bypass automatic cell size inference and enforce cell size. Note that the shape and origin of the Block Model is directly computed from the cell size: providing an erroneous cell size may have undesirable side effects.

None

Raises:

Type Description
ValueError
  • Variable cell size is inferred and cell_size is not provided.
  • There is a single cell in one of the axes and cell_size is not provided.
  • If the provided cell_size does not have 3 dimensions.
  • If the provided cell_size has negative values.

Example

import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
bm = geo.BlockModel("MyBM", xyz)

convert_to_gis_object(name, properties=None, agg_methods=[AggregationMethod.SUM, AggregationMethod.MIN, AggregationMethod.MAX, AggregationMethod.MEAN], region=None, region_agg=None) 🍋

Create a new GISObject from the GeoRefObject. The original GeoRefObject is not modified.

Parameters:

Name Type Description Default
name str

name of the GISObject to create.

required
properties Optional[List[str]]

list of properties name to transfer to the GIS Object. Setting to None or empty list will select all existing properties.

None
agg_methods List[Union[AggregationMethod, Callable]]

aggregation data methods. See Pandas - Group By to find out supported methods.

[SUM, MIN, MAX, MEAN]
region Optional[str]

Object region or condition to select data from.

None
region_agg Optional[RegionAggregationMethod]

Aggregation region method.

None

Returns:

Type Description
GISObject

GeoLime GISObject.

Raises:

Type Description
ValueError

'X' or 'Y' are part of the properties.

AttributeError

One of the aggregation methods is not supported.

delete_cells(region) 🍋

Delete cells in region.

Parameters:

Name Type Description Default
region str

Region or condition to select cells.

required

downscale(name, discr) 🍋

Downscale the BlockModel by a given discretisation.

Parameters:

Name Type Description Default
name str

name of the newly created BlockModel.

required
discr Vector

Discretisation of the new BlockModel.

required

Returns:

Type Description
BlockModel

BlockModel object downscaled.

Raises:

Type Description
ValueError
  • discr must be of dimension 3.
  • discr must be composed of integers.

keep_only_cells(region) 🍋

Keep cells in region.

Parameters:

Name Type Description Default
region str

Region or condition to select cells.

required

to_pyvista(properties=None) 🍋

Export BlockModel and selected properties to Pyvista UnstructuredGrid.

Parameters:

Name Type Description Default
properties Optional[Union[str, List[str]]]

Property or list of properties to export to Pyvista.

None

Returns:

Type Description
UnstructuredGrid

UnstructuredGrid object.


Last update: 2022-01-06