About

MiningPy is intended to help mining engineers harness the full power of the Python ecosystem to solve routine mine planning problems. MiningPy was developed at IMC Mining. For any support or enquiries, please feel free to get in contact with the engineers at IMC Mining. This package includes tools to help with:

  • Block model manipulation:
    • Indexing (ijk)

    • Reblocking (geometric & attribute based)

    • Rotations

    • Calculating the model framework (origin, dimensions, rotation, extents, etc…)

    • Validating the block model (missing internal blocks, checking the model is regular, etc…)

    • Creating bench reserves

    • Aggregating blocks for scheduling

    • Haulage modelling & encoding to the block model

  • Interfacing with commercial mine planning packages, such as:
    • Maptek Vulcan

    • GEOVIA Whittle

    • COMET

    • Minemax Scheduler/Tempo

    • Datamine

  • Visualisation:
    • Previewing block models directly in Python for fast reviewing of work

    • Previewing designs (.dxf) directly in Python

    • Exporting block models in ParaView compatible format

Why MiningPy?

There are numerous geological packages that have been written in Python, such as GemPy, PyGSLIB, and GeostatsPy. However, none of these packages directly provide any tools to handle mining engineering specific problems. MiningPy aims to provide a simple API to mining engineers that extends existing data science tools like Pandas, without having to re-invent the wheel every time they need to interface with commercial mine planning software or manipulate mining data.

Installation

MiningPy is distributed using:

Conda

MiningPy can be installed using the Conda package manager. To install using conda, you need to add the conda-forge channel so that all dependencies are installed correctly:

conda config --add channels conda-forge

To install from conda-forge (after adding the conda-forge channel):

conda install miningpy

To install from Anaconda Cloud (after adding the conda-forge channel):

conda install -c miningpy miningpy

Pip

MiningPy can be installed using the Pip package manager:

pip install miningpy

Example

import pandas as pd
import miningpy

blockModelData = {
    'x': [5, 5, 15],
    'y': [5, 15, 25],
    'z': [5, 5, 5],
    'tonnage': [50, 100, 50],
}

blockModel = pd.DataFrame(blockModelData)
blockModel.plot3D(
    xyz_cols=('x', 'y', 'z'),
    dims=(5, 5, 5),  # block dimensions (5m * 5m * 5m)
    col='tonnage',  # block attribute to colour by
)

Documentation

Auto-generated documentation is hosted at Read The Docs.

You may also build the documentation yourself:

git clone https://bitbucket.org/incitron/miningpy/miningpy.git
cd miningpy/docs
make html

The documention can then be found in miningpy/docs/_build/html/index.html.

Supported Platforms & Testing

Platforms

MiningPy is only tested on Microsoft Windows 10.

Testing

The package is built and tested nightly using environments based on Virtualenv and Conda (with the current base Anaconda packages).

Azure DevOps hosts and runs and the testing pipelines.

MiningPy is tested to be compatible with the following versions of Python:

  • Python 3.9

  • Python 3.8

  • Python 3.7

Offical testing and support has been removed for the following versions of Python (although MiningPy might still work with them):

  • Python 3.6

VTK is a dependency of MiningPy and there are known issues with the current Linux version of VTK published on PyPi.

The package is also automatically deployed nightly to TestPyPi, to ensure that official package releases are stable. The versioning format used on TestPyPi is: version.version.version.yyyyMMddHHmm.

API Reference

The MiningPy API currently includes:

Author

The creator of MiningPy is a mining engineer that primarly works in long-term strategic mine planning at IMC Mining. For any support or enquiries, please feel free to get in contact with the engineers at IMC Mining.

License

MiningPy is licensed under the very liberal MIT-License.