agentleFS
SteadfastAsArtSteadfastAsArt/geoscience-skills/pyrolite/SKILL.md

pyrolite

Skill67 starsChanged 10 months agoMITView on GitHub

Geochemistry data analysis and visualization for igneous, metamorphic, and sedimentary rocks. Use when the agent needs to: (1) Create ternary diagrams for compositional data, (2) Plot REE spider diagrams with normalization, (3) Build TAS or other classification diagrams, (4) Apply log-ratio transforms to compositional data, (5) Calculate CIPW norms, (6) Generate Harker variation diagrams, (7) Compute element ratios and anomalies.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Close compositions: before analysis (ensure sum to 100%)

    line 151

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

pyrolite - Geochemistry Analysis

Quick Reference

import pandas as pd
import matplotlib.pyplot as plt
from pyrolite.geochem.norm import get_reference_composition

df = pd.read_csv('samples.csv')
df.pyrochem   # Geochemistry methods
df.pyrocomp   # Compositional methods

# Normalize and plot REE
chondrite = get_reference_composition('Chondrite_McDonough1995')
ax = df.pyrochem.normalize_to(chondrite, units='ppm').pyroplot.REE(unity_line=True)

Key Modules

ModulePurpose
pyrolite.plotTernary, spider diagrams
pyrolite.geochem.normNormalization references
pyrolite.compCLR, ALR, ILR transforms
pyrolite.plot.templatesTAS, Pearce diagrams
pyrolite.mineral.normativeCIPW norm

Essential Operations

Ternary Diagram

ax = df[['SiO2', 'CaO', 'Na2O']].pyroplot.scatter(c='k', s=50)

TAS Diagram

from pyrolite.plot.templates import TAS
df['Na2O_K2O'] = df['Na2O'] + df['K2O']
ax = TAS()
ax.scatter(df['SiO2'], df['Na2O_K2O'], c='red', s=50)

REE Pattern

chondrite = get_reference_composition('Chondrite_McDonough1995')
ax = df.pyrochem.normalize_to(chondrite, units='ppm').pyroplot.REE(unity_line=True)

Trace Element Spider

pm = get_reference_composition('PM_McDonough1995')
ax = df.pyrochem.normalize_to(pm).pyroplot.spider(unity_line=True)

Compositional Transforms

df_closed = df.pyrocomp.renormalise(scale=100)  # Closure
df_clr = df.pyrocomp.CLR()   # Centered log-ratio
df_alr = df.pyrocomp.ALR()   # Additive log-ratio
df_ilr = df.pyrocomp.ILR()   # Isometric log-ratio

Element Ratios and Anomalies

df['La_Yb'] = df['La'] / df['Yb']                        # LREE/HREE
df['Eu_Eu*'] = df['Eu'] / (df['Sm'] * df['Gd']) ** 0.5   # Eu anomaly
lambdas = df.pyrochem.lambda_lnREE()                      # REE shape

CIPW Norm

from pyrolite.mineral.normative import CIPW_norm
norm = CIPW_norm(df)  # df must have major oxides in wt%

Harker Diagrams

fig, axes = plt.subplots(2, 3, figsize=(12, 8))
for ax, elem in zip(axes.flatten(), ['TiO2', 'Al2O3', 'FeO', 'MgO', 'CaO', 'Na2O']):
    ax.scatter(df['SiO2'], df[elem], c='blue', s=50)
    ax.set_xlabel('SiO2 (wt%)'); ax.set_ylabel(f'{elem} (wt%)')

Pearce Discrimination

from pyrolite.plot.templates import pearce_templates
ax = pearce_templates.YNb()
ax.scatter(df['Nb'], df['Y'], c='red', s=50)

Common Normalization References

ReferenceCodeUse For
ChondriteChondrite_McDonough1995REE patterns
Primitive MantlePM_McDonough1995Trace elements
N-MORBNMORB_SunMcDonough1989Ocean basalts
Upper CrustUCC_RudnickGao2003Crustal rocks

When to Use vs Alternatives

ToolBest ForLimitations
pyrolitePython-native geochemistry, pandas integration, compositional transformsFewer built-in classification templates than GCDkit
GCDkitComprehensive classification diagrams, R ecosystemR-based, not Python
PetroGraphQuick GUI-based classification and plottingNot scriptable, limited customization
Custom matplotlibFull control over plot appearanceNo built-in normalization or templates

Use pyrolite when you need geochemistry analysis integrated with pandas workflows, compositional log-ratio transforms, or REE normalization in Python.

Consider alternatives when you need extensive petrographic classification templates (use GCDkit), a quick GUI for classification (use PetroGraph), or only need simple scatter plots without normalization (use matplotlib directly).

Common Workflows

Geochemical classification and REE pattern analysis

  • Load sample data into pandas DataFrame
  • Close compositions with df.pyrocomp.renormalise(scale=100)
  • Plot TAS diagram with TAS() and overlay sample data
  • Normalize REE to chondrite with df.pyrochem.normalize_to()
  • Plot REE spider diagram with df.pyroplot.REE()
  • Calculate Eu anomaly and La/Yb ratio
  • Generate Harker variation diagrams for major elements
  • Export figures for publication

Tips

  1. Close compositions before analysis (ensure sum to 100%)
  2. Use log-ratios (CLR/ALR/ILR) for statistical analysis
  3. Choose appropriate normalization for spider diagrams
  4. Check for Eu anomaly (positive = cumulate, negative = fractionation)

References

  • Normalization References - Reference compositions and values
  • Classification Schemes - TAS, Pearce, AFM diagrams

Scripts

  • scripts/geochemistry_plots.py - Generate common plots

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.