Skip to main content

A Python package for efficient storage, manipulation, and analysis of mining block models using Parquet files.

Project description

parq-blockmodel logo parq-blockmodel

Run Tests PyPI Coverage Python Versions License Publish Docs Open Issues Open PRs

Overview

A Python package for efficient storage, manipulation, and analysis of mining block models using Parquet files. parq-blockmodel provides tools for reading, writing, indexing, and transforming large-scale block model datasets, leveraging the performance of Apache Arrow and Parquet for scalable geoscience data workflows.

Installation

Install the base package from PyPI:

pip install parq-blockmodel

Install the optional schema validation support when you want to validate block model attributes with Pandera schemas or load schema definitions from YAML:

pip install "parq-blockmodel[schema]"

Install the visualization extras when you want to use the Trame viewer:

pip install "parq-blockmodel[viz]"

Schema validation

ParquetBlockModel accepts an optional schema= argument on its main constructors. You can pass either a Pandera DataFrameSchema object or a path to a YAML schema file, then validate the resulting model in chunks:

from pathlib import Path

from parq_blockmodel import ParquetBlockModel

pbm = ParquetBlockModel.from_parquet(
    Path("path/to/blockmodel.parquet"),
    schema=Path("schemas/blockmodel.schema.yaml"),
)

pbm.validate()
pbm.validate(sample_chunks=1)  # quick spot-check for large models

See the User Guide for detailed documentation on calculated attributes, including custom lookups and functions.

Visualization

The block-model plotting path now delegates through parq_blockmodel.visualization, which keeps the rendering logic isolated from ParquetBlockModel itself.

from parq_blockmodel import ParquetBlockModel
from parq_blockmodel.visualization import BlockModelTrameApp, TrameBlockModelPlotEngine

pbm = ParquetBlockModel.from_parquet("orebody.parquet")
plotter = pbm.plot(scalar="grade", z_up_lock=True, z_up_hotkey="z")

# Optional terrain context for the PyVista engine:
# - elevation_raster adds a DEM surface
# - imagery_raster textures the DEM when both rasters align
plotter = pbm.plot(
    scalar="grade",
    elevation_raster="dem.tif",
    imagery_raster="imagery.tif",
)

trame_app_from_plot = pbm.plot(
    scalar="grade",
    engine=TrameBlockModelPlotEngine(),
    z_up_lock=True,
    z_up_hotkey="z",
)

app = BlockModelTrameApp(pbm, scalar="grade", z_up_lock=True, z_up_hotkey="z")

With z_up_lock=True, hold z for turntable-style orbit (yaw/pitch, no roll) with camera up aligned to +Z.

Geometry operations

parq-blockmodel supports three geometry flagging workflows:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parq_blockmodel-0.12.7.tar.gz (232.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parq_blockmodel-0.12.7-py3-none-any.whl (147.3 kB view details)

Uploaded Python 3

File details

Details for the file parq_blockmodel-0.12.7.tar.gz.

File metadata

  • Download URL: parq_blockmodel-0.12.7.tar.gz
  • Upload date:
  • Size: 232.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for parq_blockmodel-0.12.7.tar.gz
Algorithm Hash digest
SHA256 8180b60b219ef3484e19c89c554701873f83bfacfff19ad53b1f95f31665d5e8
MD5 e29699b7274c34ccca32a1a07e034d5a
BLAKE2b-256 9b8ac1795f4cb1c7b0f563ed6277fe6fbcdfc119932ad33e45e1150a3d040280

See more details on using hashes here.

File details

Details for the file parq_blockmodel-0.12.7-py3-none-any.whl.

File metadata

File hashes

Hashes for parq_blockmodel-0.12.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4611573e95eb637379b344a1991f66c854e4a5d57528b4e6084ba3b4a7af05c6
MD5 7f608501be284498fa4a2a878300289f
BLAKE2b-256 a4c5d9ed434fad8b04d8bc042fd7b5ec6f1a4dcf4e8a7a49e6984ed8aef63b2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page