RegularBlockModel
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:
| Name | Type | Description | Default |
|---|---|---|---|
client | BlockModelAPIClient | The BlockModelAPIClient used for API operations. | required |
metadata | BlockModel | The block model metadata. | required |
version | Version | The current version information. | required |
cell_data | DataFrame | The cell data as a pandas DataFrame. | required |
context | IContext | None | Optional 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:
| Name | Type | Description | Default |
|---|---|---|---|
context | IContext | The context containing environment, connector, and cache. | required |
data | RegularBlockModelData | The data defining the block model to create. | required |
path | str | None | Optional path for the block model in the workspace. | None |
fb | IFeedback | Optional feedback interface for progress reporting. | NoFeedback |
Returns:
| Type | Description |
|---|---|
RegularBlockModel | A RegularBlockModel instance representing the created block model. |
Raises:
| Type | Description |
|---|---|
ValueError | If 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:
| Name | Type | Description | Default |
|---|---|---|---|
context | IContext | The context containing environment, connector, and cache. | required |
bm_id | UUID | The UUID of the block model to retrieve. | required |
version_id | UUID | None | Optional version UUID. Defaults to the latest version. | None |
columns | list[str] | None | Optional list of columns to retrieve. Defaults to all columns ["*"]. | None |
bbox | BBox | BBoxXYZ | None | Optional bounding box to filter the data. | None |
fb | IFeedback | Optional feedback interface for progress reporting. | NoFeedback |
Returns:
| Type | Description |
|---|---|
RegularBlockModel | A RegularBlockModel instance. |
Raises:
| Type | Description |
|---|---|
ValueError | If the block model is not a regular grid. |