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

loopstructural

Skill78 starsChanged 10 months agoMITView on GitHub

Build 3D geological models with implicit surfaces, faults, folds, and stratigraphic constraints from structural geology data. Use when the agent needs to: (1) Build 3D geological models from structural data, (2) Model fault networks and displacements, (3) Create folded geology representations, (4) Interpolate geological surfaces, (5) Export models to VTK for visualization, (6) Perform uncertainty analysis on geological models, (7) Evaluate model values on grids.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use LoopStructural when observations constrain continuous geological scalar fields.

    line 23
  2. Very specific:

    Use grid.save('model.vtk') or surface.save('strat.vtk') when export is requested.

    line 83
  3. Distinctive:

    Read interpolation and validation for numerical choices, and fault/fold requirements only when those structures are needed.

    line 105

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

Constrained implicit geological models

Use LoopStructural when observations constrain continuous geological scalar fields. A scalar value labels an interface; it is not automatically an age, measured depth or elevation. Record the coordinate CRS, shared XYZ units, positive-Z convention, feature order and meaning of each scalar level.

A constrained planar model

This synthetic example uses metre coordinates with a nonzero origin and an asymmetric box. Its scalar field is Z - 3030 + 0.1*(X - 1050) - 0.05*(Y - 2100) in metres. Scalar observations and gradient constraints anchor both level and orientation; a single point alone cannot define a geological surface.

from itertools import product
from LoopStructural import GeologicalModel
import numpy as np
import pandas as pd

origin = np.array([1000., 2000., 3000.])
maximum = np.array([1100., 2200., 3060.])
xyz = np.array(list(product([1010., 1050., 1090.], [2020., 2180.], [3010., 3050.])))
data = pd.DataFrame(xyz, columns=['X', 'Y', 'Z'])
data['feature_name'] = 'strat'
data['val'] = xyz[:, 2] - 3030 + .1 * (xyz[:, 0] - 1050) - .05 * (xyz[:, 1] - 2100)
data[['gx', 'gy', 'gz']] = [.1, -.05, 1.]
model = GeologicalModel(origin, maximum)
model.data = data
model.create_and_add_foliation('strat', interpolatortype='FDI', nelements=1000)
model.update()
query = np.array([[1020., 2040., 3020.], [1080., 2160., 3040.], [1050., 2100., 3030.]])
values = model.evaluate_feature_value('strat', query)

The expected values are approximately −10, +10 and 0. Pass world coordinates to model.evaluate_feature_value(..., scale=True) (the default). Direct feature evaluation has a different local-coordinate contract. GeologicalModel 1.8 accepts the two bounds positionally; do not assume origin= and maximum= constructor keywords from older examples still work.

Evaluate a VTK grid

Continue with the model above. regular_grid returns an N×3 array; disable shuffling and use Fortran ordering for VTK's x-fastest points. Write actual scalar values into point data before saving.

import pyvista as pv

shape = (9, 7, 5)
points = model.regular_grid(nsteps=shape, shuffle=False, order='F')
grid = pv.StructuredGrid()
grid.points = points
grid.dimensions = shape
grid.point_data['strat'] = model.evaluate_feature_value('strat', points)
surface = grid.contour([0.], scalars='strat')
if not np.isfinite(grid['strat']).all() or surface.n_cells == 0:
    raise ValueError('Model evaluation or requested isosurface is invalid')

Use grid.save('model.vtk') or surface.save('strat.vtk') when export is requested. A rendered surface is a discretized level set; check constraint residuals and mesh convergence before interpreting small structures.

CSV helper and conditional models

The model builder supports constrained FDI/PLI foliations and grid/isosurface export. It validates finite coordinates, complete constraints and positive 3D extents, and reports failed or empty exports with a nonzero exit status. Provide explicit bounds for planar or zero-span input geometry rather than inventing an extent.

python scripts/build_model.py constraints.csv --grid --output model.vtk \
  --origin 1000 2000 3000 --maximum 1100 2200 3060 --nsteps 9 7 5

Resolve the command relative to this installed skill directory. The helper requires X,Y,Z,feature_name, plus val and/or complete gx,gy,gz or nx,ny,nz constraints; each feature needs a scalar level anchor. Missing vector rows are all NaN, not zero vectors.

Read interpolation and validation for numerical choices, and fault/fold requirements only when those structures are needed. Faults, fold frames and uncertainty ensembles need explicit kinematics/data and a separate configured model; they are not created by a nominal CSV column or by this foliation helper.

Verification scope

LoopStructural 1.8.0 with loop-interpolation 0.0.2 was exercised with FDI and PLI planar models, world-coordinate evaluation, asymmetric grid ordering, isosurface and VTK readback, plus malformed-input/CLI failures. This validates the entrypoint and export path, not fault-network inversion, folded geology, uncertainty estimates or the geological adequacy of sparse field constraints.

Official model source, checked 2026-09-14 against the installed 1.8.0 API.

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.