BlockModel ¶
Regular or masked grid of blocks, 2D or 3D, optionally rotated.
corners
property
¶
corners
(n, 8, 3) world-space corners of each row's box: vertex c (0..8)
takes the row's minimum extent on axis a if bit a of c is 0, its
maximum if 1.
extents
property
¶
extents
(n, 6) sub-block extents as fractions of the parent cell
[u0, v0, w0, u1, v1, w1], or None when not sub-blocked.
length_unit
property
¶
length_unit
Unit of the coordinates, such as m or ft; None when not declared.
convert_units
method descriptor
¶
convert_units(column, *, to)
New model with column converted to unit to; see Table.convert_units.
discretize
method descriptor
¶
discretize(n)
Nodes discretizing every block, e.g. targets for simulate(blocks=).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int or sequence of int
|
Nodes per axis inside each block; an int applies to x, y and z, or to x and y only in a 2D model. |
required |
Returns:
| Type | Description |
|---|---|
BlockModel
|
A masked grid |
from_extents
staticmethod
¶
from_extents(
*objects,
size,
buffer=Ellipsis,
rotation=None,
snap=Ellipsis,
crs=None,
length_unit=None,
)
Smallest regular grid holding every object plus a buffer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*objects
|
(PointSet, Drillholes, Mesh, Polylines, BlockModel or array_like)
|
What the grid must cover: points, drill hole paths, mesh or line
vertices, the corners of another grid, or |
required |
size
|
sequence of float
|
|
required |
buffer
|
float or sequence of float
|
Margin added on each side, one value or one per grid axis. |
0.0
|
rotation
|
tuple of float
|
Azimuth, dip and rake in degrees; the extents are measured along the rotated grid axes. |
None
|
snap
|
bool, float or sequence of float
|
Put the origin on a multiple of this step, measured along the grid
axes, so grids built from different data line up; |
False
|
crs
|
str
|
|
None
|
Returns:
| Type | Description |
|---|---|
BlockModel
|
A regular model without attributes, with the fewest blocks along each axis that hold every point. |
from_meshes
staticmethod
¶
from_meshes(
origin,
size,
count,
meshes,
subgrid,
*,
rotation=Ellipsis,
column="domain",
fill=None,
crs=None,
length_unit=None,
)
Sub-blocked model of the grid origin, size, count and
rotation from prioritized meshes; see subblock.
grid ¶
grid(column)
column (a name or one value per row) on the full grid as an (nz, ny, nx)
array, NaN (None for text) in absent cells; for regular and masked models.
regularize
method descriptor
¶
regularize(target, *, min_fraction=0.0)
Columns of this model averaged onto the blocks of target.
Each row of this model counts in a target block by the volume they share, from exact box overlaps, so it works both ways between regular, masked and sub-blocked models: to a coarser grid, sub-blocks to their parents, or a regular estimate onto sub-blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
BlockModel
|
Blocks to average onto, with the same rotation (the origin and sizes may differ). Its own columns are kept. |
required |
min_fraction
|
float
|
Blocks less covered than this are null. |
0.0
|
Returns:
| Type | Description |
|---|---|
BlockModel
|
|
row_at
method descriptor
¶
row_at(points)
Row holding each point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
array_like
|
|
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
|
sample ¶
sample(points, column)
Value of column (a name or one value per row) at each point; NaN, or None
for text, outside the model or in a missing block.
subblock
method descriptor
¶
subblock(meshes, subgrid, *, column='domain', fill=None)
Sub-blocks every block by prioritized meshes.
Each block is split on a regular subgrid; each sub-cell takes the
label of the first domain holding its center. Blocks of one label stay
whole, others keep runs of sub-cells merged along x, then y.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meshes
|
sequence of (Mesh or Polylines, str, str)
|
|
required |
subgrid
|
int or sequence of int
|
Sub-cells per axis, which sets the smallest sub-block; an int applies to x, y and z, or to x and y only in a 2D model. |
required |
column
|
str
|
Name of the label column. |
"domain"
|
fill
|
str
|
Label of the sub-cells no domain holds; without it they are dropped. |
None
|
Returns:
| Type | Description |
|---|---|
BlockModel
|
Sub-blocked model on |
subblocked
staticmethod
¶
subblocked(
origin,
size,
count,
parent,
extents,
*,
rotation=Ellipsis,
subgrid=None,
attributes=None,
crs=None,
length_unit=None,
)
Sub-blocked model: parent cell of each sub-block (sorted) and its
(n, 6) extent as fractions of that cell; subgrid (e.g. (4, 4, 8))
requires corners on that subdivision.
to_length_unit
method descriptor
¶
to_length_unit(unit, *, crs=None)
A copy with the coordinates converted to unit, the new length unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit
|
str
|
A length unit, such as |
required |
crs
|
str
|
The CRS of the converted coordinates; required when the coordinates have a CRS, which a change of unit changes. |
None
|
Raises:
| Type | Description |
|---|---|
InvalidInput
|
Without a length unit to convert from, or with a CRS and no |
to_regular
method descriptor
¶
to_regular()
Every parent cell, absent cells null. Sub-blocks merge into their
parent as in regularize, without the fraction column: floats as
volume-weighted means, other columns by volume majority.
with_attributes
method descriptor
¶
with_attributes(table)
New model with table as the attributes, one row per block.
with_column
method descriptor
¶
with_column(name, values, *, unit=None)
New model with the attribute name added or replaced: numbers (NaN is
null) or text (None is null). The column takes unit, or else the unit
values carries.
with_columns
method descriptor
¶
with_columns(data)
New model with the columns of data, a dict or table, added or replaced.
with_units
method descriptor
¶
with_units(units)
New model with the units of units, column name to unit; None removes one.
used in