# 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
```bash
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
)
Raw data
{
"_id": null,
"home_page": "https://github.com/Mining-Geologist/drill_eda",
"name": "DrillEda",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Mining Geologist",
"author_email": "geologytrainings@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6b/22/219696d876e4c52216e032c9c3b823eec945c723d6a5e4c00ed4aeaab697/DrillEda-0.1.4.tar.gz",
"platform": null,
"description": "# DrillEda\r\n\r\nDrillEda is a Python package for processing and visualizing drillhole data, particularly in the context of geological and mining exploration.\r\n\r\n## Features\r\n\r\n- Merge and process geological and assay data.\r\n- Combine lithologies and visualize the data using scatter plots, box plots, and histograms.\r\n- Validate and summarize data.\r\n- Compute descriptive statistics for specific lithologies.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install DrillEda\r\n\r\n\r\n\r\n## Example Usage \r\n\r\nimport pandas as pd\r\nfrom DrillEda import DrillEda\r\n\r\n# Load your data\r\nassay = pd.read_csv('assay.csv')\r\ngeology = pd.read_csv('lith.csv')\r\n\r\ngeology_columns = {\r\n 'holeid': 'ID',\r\n 'from': 'FROM',\r\n 'to': 'TO',\r\n 'rock': 'ROCK'\r\n}\r\n\r\nassay_columns = {\r\n 'holeid': 'ID',\r\n 'from': 'FROM',\r\n 'to': 'TO',\r\n 'assay_columns': ['RECOV', 'CU_pct', 'GRADE', 'AG_gpt', 'DENSITY','MO_ppm', 'AS_ppm', 'S_pct'] # Example assay columns\r\n}\r\n\r\n# Create an Eda object to store the dataframes\r\neda = DrillEda()\r\n\r\n# Check missing holes in both the geology and assay table, these holes are not included in the combined table\r\neda.validate_hole_ids(geology, assay, geology_columns, assay_columns)\r\n\r\n# Cobmine the Geology and the Assay Table\r\nprocessed_data = eda.process_data(\r\n geology, \r\n assay, \r\n geology_columns, \r\n assay_columns, \r\n 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 \r\n lithology_groups={('SAPR','SGNCRLSS'):'SSS'}\r\n)\r\n\r\nprint(geology)\r\nprint(assay)\r\n# Print the combined Geology-Assay Table \r\nprint(processed_data)\r\n# Print the new Geology table with the combined Lithologies\r\nNew_geology = eda.get_combined_geology()\r\nprint(New_geology)\r\n\r\n# Uses a numeric field (grade) and a cutoff values to list the possible Ore lithologies and possible waste lithologies based on the average grade\r\npossible_ore, possible_waste = eda.get_ore_waste_tables('GRADE', 1.0)\r\n# Print the list of the possible ore and possible waste lithologies and their average grades\r\nprint(possible_ore)\r\nprint(possible_waste)\r\n\r\n# Creates a Table with descriptive statistics of a specific lithology in the combined table\r\ndescriptive_stats = eda.get_descriptive_statistics('SSS')\r\nprint(descriptive_stats)\r\n# Two filters one Categorical and one numerical to be used for the plots\r\n\r\n# Categorical Filter using the column Rock to filter only two lithologies\r\ncatfilter = {'ROCK': ['E1','E2']}\r\n# Numercial Filter using the column GRADE and and a min and max value \r\nnumfilter = {'GRADE': [0.5, 2.0]}\r\n# Plot a Scatter Plot\r\n\r\neda.scatter('GRADE', # X axis \r\n 'CU_pct', # y Axis\r\n dot_size=5,\r\n dot_color='blue',\r\n font_size=14,\r\n catfilter=catfilter,\r\n numfilter=numfilter,\r\n num_x_ticks=10, num_y_ticks=10,\r\n plot_title=\"Scatter Plot of CU_pct vs GRADE\")\r\n\r\n\r\n# Call the visualize_histogram method\r\neda.histogram(\r\n numeric_column='GRADE',\r\n log_scale=True, # Set to True if you want the y-axis to be logarithmic\r\n bin_size=20, # Number of bins in the histogram\r\n cap_value=None, # Optionally cap the values\r\n bar_color=\"#3498db\", # Color of the bars\r\n catfilter=catfilter, \r\n numfilter=numfilter \r\n)\r\n\r\n\r\n# Call the visualize_boxplot method\r\neda.boxplot(\r\n numeric_column='GRADE', # X axis Numerical column\r\n categorical_column='ROCK', # Y axis Categorical column \r\n categories=['SSS', 'E1'], # Filter specific categories\r\n box_fill=True, # Fill the boxes with color\r\n circle_size=1, # Size of the outlier circles\r\n font_size=14, # Font size for labels and title\r\n plot_title=\"Box Plot of GRADE by ROCK\", # Title of the box plot\r\n log_scale_boxplot=True,# Set to True for log scale on the x-axis\r\n catfilter=catfilter, \r\n numfilter=numfilter \r\n)\r\n\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A package for exploratory data analysis of drillhole data.",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/Mining-Geologist/drill_eda"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4d72d00af1deaf07e3d001110918a02da09c4268ec0a697cdd84e8589213e710",
"md5": "df100200895da8195592cac9b9578713",
"sha256": "0c50f7e0c3a5026275624f2a26f9c480b9504f521f30bf51187ad1941e27b087"
},
"downloads": -1,
"filename": "DrillEda-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "df100200895da8195592cac9b9578713",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 6321,
"upload_time": "2024-09-01T19:30:14",
"upload_time_iso_8601": "2024-09-01T19:30:14.626311Z",
"url": "https://files.pythonhosted.org/packages/4d/72/d00af1deaf07e3d001110918a02da09c4268ec0a697cdd84e8589213e710/DrillEda-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6b22219696d876e4c52216e032c9c3b823eec945c723d6a5e4c00ed4aeaab697",
"md5": "0f53d668b8cd883052df71602ede9d2f",
"sha256": "c86d5f09379dcbbb6d178cdf69c2daa2cce8e434122659b47a96d13b533f3a9b"
},
"downloads": -1,
"filename": "DrillEda-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "0f53d668b8cd883052df71602ede9d2f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 6039,
"upload_time": "2024-09-01T19:30:16",
"upload_time_iso_8601": "2024-09-01T19:30:16.222908Z",
"url": "https://files.pythonhosted.org/packages/6b/22/219696d876e4c52216e032c9c3b823eec945c723d6a5e4c00ed4aeaab697/DrillEda-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-01 19:30:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Mining-Geologist",
"github_project": "drill_eda",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "drilleda"
}