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

mtpy

Skill67 starsChanged 10 months agoMITView on GitHub

Read and validate magnetotelluric transfer functions with MTpy-v2. Use for EDI import, impedance uncertainty, apparent resistivity/phase, documented tensor rotations, response plots and preparation for modelling. External inversion solvers and raw time-series processing require separate tools and validation.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 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.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do not call xy and yx TE/TM until a justified 2D strike coordinate system has been established.

    line 44
  2. Distinctive:

    Read EDI conventions and missingness when handling empty values, variances or exports.

    line 47
  3. Very specific:

    Use the QC helper for direct-impedance EDI after confirming mV/km/nT, positive time convention and north/east/down:

    line 54

≈ “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

MTpy-v2: Transfer-Function Analysis

Install the mtpy-v2 distribution, which imports as mtpy. The older mtpy distribution has a different API; do not install both in one environment. The operations below were executed with MTpy-v2 2.1.4 and mt-metadata 1.0.10.

Read and establish conventions

from mtpy import MT

station = MT("station.edi")
station.read(get_elevation=False)  # constructor alone does not load the file
frequency_hz = station.frequency
z = station.Z.z                   # complex tensor, shape (frequency, 2, 2)
sigma_z = station.Z.z_error       # standard deviation, not EDI variance
rho = station.Z.resistivity       # ohm m
phase = station.Z.phase           # degrees, signed component phases

Confirm impedance units, time convention, axes, channel orientation, ZROT, horizontal CRS and elevation reference from acquisition metadata. An EDI UNITS field can describe distances rather than impedance. MT units are mV/km/nT; the corresponding E/H impedance in ohms is multiplied by mu0 * 1000. For MT units, apparent resistivity is 0.2 * abs(z)**2 / frequency_hz. Do not call xy and yx TE/TM until a justified 2D strike coordinate system has been established. A yx phase near -135 degrees can be valid under NED.

Read EDI conventions and missingness when handling empty values, variances or exports. mt-metadata can represent missing EDI values as zero, so inspect source masks before computing quality flags or rotating. Missing uncertainty is not an exact observation.

QC, rotation and export

Use the QC helper for direct-impedance EDI after confirming mV/km/nT, positive time convention and north/east/down:

python scripts/mt_analysis.py station.edi --output-dir results \
  --impedance-units mt --sign-convention + --plot

Resolve the script relative to this skill directory. It exports every frequency and all four components with missingness, uncertainty and diagnostic flags, plus a JSON provenance file. It reopens its CSV and refuses existing output files. The default 50% relative-error threshold is a recorded diagnostic choice; choose task-specific criteria before examining the desired interpretation.

An additional clockwise rotation is available as --rotation-deg 30; it requires complete tensors and variances. It adds to the original orientation, not an absolute strike estimate. The tested direct library equivalent is station.rotate(30, inplace=True); its default in-place form returns None. Marginal error propagation does not provide a full covariance model.

For complete data, write with station.write(fn="copy.edi"), then read back coordinates, rotation and tensors. The native EDI writer maps numeric zeros to its EMPTY sentinel; preserve the original and a separate mask-aware CSV when physical zeros or missing components matter. Read response plotting only when a figure is requested.

Interpretation and validation

Compare tensor components, uncertainty, phase behavior and frequency coverage before dimensionality analysis. Phase-tensor skew is a diagnostic affected by noise and sampling, not a universal pass/fail test for 3D geology. Do not apply automatic strike or static-shift corrections without independent justification. Preparing ModEM/Occam inputs is separate from executing an installed solver.

The repository's near-surface workflow checks a field-derived upstream EDI sample, independent tensor algebra, synthetic responses and output readback. It does not establish raw time-series estimation, field inversion or geological uniqueness. Consult the installed-version MTpy-v2 API for other formats and survey collections; do not substitute older v1 method names.

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.