Note
Go to the end to download the full example code
Rotated Block Model
This example demonstrates how to create a rotated block model.
import tempfile
from pathlib import Path
from parq_blockmodel import ParquetBlockModel
import pyvista as pv
Create a parquet block model
We will create a block model with a shape of 3x3x3 blocks, each block having a size of 1.0 in all dimensions. We will apply rotation.
corner = (0.0, 0.0, 0.0)
block_size = (1.0, 1.0, 1.0)
shape = (2, 2, 2)
temp_dir: Path = Path(tempfile.gettempdir()) / "block_model_example"
temp_dir.mkdir(parents=True, exist_ok=True)
# create a temporary file path for the block model
pbm: ParquetBlockModel = ParquetBlockModel.create_demo_block_model(filename=temp_dir / "demo_block_model.parquet",
block_size=block_size, corner=corner, shape=shape,
axis_azimuth=30, axis_dip=0, axis_plunge=0,
)
pbm
ParquetBlockModel(name=demo_block_model, path=/tmp/block_model_example/demo_block_model.pbm.parquet)
Check the block model
print("Block Model Path:", pbm.blockmodel_path)
print("Name:", pbm.name)
print("Axis Angles:", pbm.geometry.axis_angles)
print("Data Shape:", pbm.data.shape)
print("Data Head:\n", pbm.data.head())
print("Model Attributes:", pbm.attributes)
Block Model Path: /tmp/block_model_example/demo_block_model.pbm.parquet
Name: demo_block_model
Axis Angles: (29.999999999999996, 0.0, 0.0)
Data Shape: (8, 3)
Data Head:
c_index f_index depth
x y z
0.683013 0.183013 0.5 0 0 1.5
1.5 1 4 0.5
1.183013 1.049038 0.5 2 2 1.5
1.5 3 6 0.5
1.549038 -0.316987 0.5 4 1 1.5
Model Attributes: ['c_index', 'f_index', 'depth']
Visualise
p: pv.Plotter = pbm.plot(scalar='depth', grid_type="image")
p.show()

Total running time of the script: (0 minutes 1.071 seconds)