Skip to main content

RegularBlockModel

GitHub source

RegularBlockModel

evo.blockmodels.typed.regular_block_model.RegularBlockModel

A typed wrapper for regular block models providing pandas DataFrame access.

This class provides a high-level interface for creating, retrieving, and updating regular block models with typed access to grid properties and cell data.

Example usage:

# Create a new block model
data = RegularBlockModelData(
name="My Block Model",
origin=Point3(0, 0, 0),
n_blocks=Size3i(10, 10, 10),
block_size=Size3d(1.0, 1.0, 1.0),
cell_data=my_dataframe,
)
block_model = await RegularBlockModel.create(context, data)

# Retrieve an existing block model
block_model = await RegularBlockModel.get(context, bm_id)
df = block_model.cell_data

# Update attributes
new_version = await block_model.update_attributes(
updated_dataframe,
new_columns=["new_col"],
)

n_blocks

n_blocks: Size3i

The number of blocks in each dimension.

block_size

block_size: Size3d

The size of each block in each dimension.

rotations

rotations: list[tuple[RotationAxis, float]]

The rotations applied to the block model.

__init__

__init__(
client: BlockModelAPIClient,
metadata: BlockModel,
version: Version,
cell_data: DataFrame,
context: IContext | None = None,
) -> None

Initialize a RegularBlockModel instance.

Parameters:

NameTypeDescriptionDefault
clientBlockModelAPIClientThe BlockModelAPIClient used for API operations.required
metadataBlockModelThe block model metadata.required
versionVersionThe current version information.required
cell_dataDataFrameThe cell data as a pandas DataFrame.required
contextIContext | NoneOptional IContext for report and other operations.None

create

create(
context: IContext, data: RegularBlockModelData, path: str | None = None, fb: IFeedback = NoFeedback
) -> RegularBlockModel

Create a new regular block model.

Parameters:

NameTypeDescriptionDefault
contextIContextThe context containing environment, connector, and cache.required
dataRegularBlockModelDataThe data defining the block model to create.required
pathstr | NoneOptional path for the block model in the workspace.None
fbIFeedbackOptional feedback interface for progress reporting.NoFeedback

Returns:

TypeDescription
RegularBlockModelA RegularBlockModel instance representing the created block model.

Raises:

TypeDescription
ValueErrorIf the data is invalid.

get

get(
context: IContext,
bm_id: UUID,
version_id: UUID | None = None,
columns: list[str] | None = None,
bbox: BBox | BBoxXYZ | None = None,
fb: IFeedback = NoFeedback,
) -> RegularBlockModel

Retrieve an existing regular block model.

Parameters:

NameTypeDescriptionDefault
contextIContextThe context containing environment, connector, and cache.required
bm_idUUIDThe UUID of the block model to retrieve.required
version_idUUID | NoneOptional version UUID. Defaults to the latest version.None
columnslist[str] | NoneOptional list of columns to retrieve. Defaults to all columns ["*"].None
bboxBBox | BBoxXYZ | NoneOptional bounding box to filter the data.None
fbIFeedbackOptional feedback interface for progress reporting.NoFeedback

Returns:

TypeDescription
RegularBlockModelA RegularBlockModel instance.

Raises:

TypeDescription
ValueErrorIf the block model is not a regular grid.

What is the reason for your feedback?