Skip to main content

A package for exploratory data analysis of drillhole data.

Project description

DrillEda

DrillEda is a Python package for processing and visualizing drillhole data, particularly in the context of geological and mining exploration.

Features

  • Merge and process geological and assay data.
  • Combine lithologies and visualize the data using scatter plots, box plots, and histograms.
  • Validate and summarize data.
  • Compute descriptive statistics for specific lithologies.

Installation

pip install DrillEda



## Example Usage 

import pandas as pd
from DrillEda import DrillEda

# Load your data
assay = pd.read_csv('assay.csv')
geology = pd.read_csv('lith.csv')

geology_columns = {
    'holeid': 'ID',
    'from': 'FROM',
    'to': 'TO',
    'rock': 'ROCK'
}

assay_columns = {
    'holeid': 'ID',
    'from': 'FROM',
    'to': 'TO',
    'assay_columns': ['RECOV', 'CU_pct', 'GRADE', 'AG_gpt', 'DENSITY','MO_ppm', 'AS_ppm', 'S_pct']  # Example assay columns
}

# Create an Eda object to store the dataframes
eda = DrillEda()

# Check missing holes in both the geology and assay table, these holes are not included in the combined table
eda.validate_hole_ids(geology, assay, geology_columns, assay_columns)

# Cobmine the Geology and the Assay Table
processed_data = eda.process_data(
    geology, 
    assay, 
    geology_columns, 
    assay_columns, 
    combine_lithologies=True, # if it is set to true it will group the lithologies in the lithology_groups if False it is going to use the orginal geology table 
    lithology_groups={('SAPR','SGNCRLSS'):'SSS'}
)

print(geology)
print(assay)
# Print the combined Geology-Assay Table 
print(processed_data)
# Print the new Geology table with the combined Lithologies
New_geology = eda.get_combined_geology()
print(New_geology)

# Uses a numeric field (grade) and a cutoff values to list the possible Ore lithologies and possible waste lithologies based on the average grade
possible_ore, possible_waste = eda.get_ore_waste_tables('GRADE', 1.0)
# Print the list of the possible ore and possible waste lithologies and their average grades
print(possible_ore)
print(possible_waste)

# Creates a Table with descriptive statistics of a specific lithology in the combined table
descriptive_stats = eda.get_descriptive_statistics('SSS')
print(descriptive_stats)
# Two filters one Categorical and one numerical to be used for the plots

# Categorical Filter using the column Rock to filter only two lithologies
catfilter = {'ROCK': ['E1','E2']}
# Numercial Filter using the column GRADE and and a min and max value 
numfilter = {'GRADE': [0.5, 2.0]}
# Plot a Scatter Plot

eda.scatter('GRADE', # X axis 
            'CU_pct', # y Axis
            dot_size=5,
            dot_color='blue',
            font_size=14,
            catfilter=catfilter,
            numfilter=numfilter,
            num_x_ticks=10, num_y_ticks=10,
            plot_title="Scatter Plot of CU_pct vs GRADE")


# Call the visualize_histogram method
eda.histogram(
    numeric_column='GRADE',
    log_scale=True,        # Set to True if you want the y-axis to be logarithmic
    bin_size=20,            # Number of bins in the histogram
    cap_value=None,         # Optionally cap the values
    bar_color="#3498db",    # Color of the bars
    catfilter=catfilter, 
    numfilter=numfilter     
)


# Call the visualize_boxplot method
eda.boxplot(
    numeric_column='GRADE', # X axis Numerical column
    categorical_column='ROCK', # Y axis Categorical column 
    categories=['SSS', 'E1'],  # Filter specific categories
    box_fill=True,            # Fill the boxes with color
    circle_size=1,            # Size of the outlier circles
    font_size=14,             # Font size for labels and title
    plot_title="Box Plot of GRADE by ROCK",  # Title of the box plot
    log_scale_boxplot=True,# Set to True for log scale on the x-axis
    catfilter=catfilter, 
    numfilter=numfilter 
)

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

DrillEda-0.1.4.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

DrillEda-0.1.4-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file DrillEda-0.1.4.tar.gz.

File metadata

  • Download URL: DrillEda-0.1.4.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for DrillEda-0.1.4.tar.gz
Algorithm Hash digest
SHA256 c86d5f09379dcbbb6d178cdf69c2daa2cce8e434122659b47a96d13b533f3a9b
MD5 0f53d668b8cd883052df71602ede9d2f
BLAKE2b-256 6b22219696d876e4c52216e032c9c3b823eec945c723d6a5e4c00ed4aeaab697

See more details on using hashes here.

File details

Details for the file DrillEda-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: DrillEda-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for DrillEda-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0c50f7e0c3a5026275624f2a26f9c480b9504f521f30bf51187ad1941e27b087
MD5 df100200895da8195592cac9b9578713
BLAKE2b-256 4d72d00af1deaf07e3d001110918a02da09c4268ec0a697cdd84e8589213e710

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