.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/04_rotated_blockmodel.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_04_rotated_blockmodel.py: Rotated Block Model =================== This example demonstrates how to create a rotated block model. .. GENERATED FROM PYTHON SOURCE LINES 8-14 .. code-block:: default import tempfile from pathlib import Path from parq_blockmodel import ParquetBlockModel import pyvista as pv .. GENERATED FROM PYTHON SOURCE LINES 15-19 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. .. GENERATED FROM PYTHON SOURCE LINES 19-36 .. code-block:: default 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 .. rst-class:: sphx-glr-script-out .. code-block:: none ParquetBlockModel(name=demo_block_model, path=/tmp/block_model_example/demo_block_model.pbm.parquet) .. GENERATED FROM PYTHON SOURCE LINES 37-39 Check the block model --------------------- .. GENERATED FROM PYTHON SOURCE LINES 39-46 .. code-block:: default 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) .. rst-class:: sphx-glr-script-out .. code-block:: none 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'] .. GENERATED FROM PYTHON SOURCE LINES 47-48 Visualise .. GENERATED FROM PYTHON SOURCE LINES 48-51 .. code-block:: default p: pv.Plotter = pbm.plot(scalar='depth', grid_type="image") p.show() .. image-sg:: /auto_examples/images/sphx_glr_04_rotated_blockmodel_001.png :alt: 04 rotated blockmodel :srcset: /auto_examples/images/sphx_glr_04_rotated_blockmodel_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.071 seconds) .. _sphx_glr_download_auto_examples_04_rotated_blockmodel.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 04_rotated_blockmodel.py <04_rotated_blockmodel.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 04_rotated_blockmodel.ipynb <04_rotated_blockmodel.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_