This transformer orchestrates extraction of transfer
functions from a Zonge AVG
object (or file path), finalizes the neutral payload
(TFBundle), and emits EDI
objects. The result is always an
EDICollection, even for
single-site inputs.
The pipeline is:
Parse TFs from the AVG using to_tensor. When Z is
not present, fall back to (rho,phase).
Finalize each bundle using
TransformerMixin:
validate the station name, order and de-duplicate
frequencies, and fill missing parts if enabled by the
global config.
Materialize EDIFile objects and
attach site metadata (e.g., coordinates) if available
from avg.topo.frame.
Reconstruct Z from apparent resistivity and phase.
If a bundle lacks Z but holds (rho,phase) and the
global config enables compute_z_from_res, this method
builds a complex tensor whose magnitude and angle satisfy
the standard MT relations:
|Z|=sqrt(μ0*ω*ρa)
phase is interpreted as milliradians and converted to
radians before forming Z=|Z|(cosφ+isinφ).
Parameters:
b (TFBundle) – Input bundle with rho and phase set.
Ensure phase units are consistent. Zonge workflows often
store milliradians; the implementation converts by dividing
by 1000. If units differ, override this method.
Populates Z fields (_freq, _z, _z_err). If
Z is missing but (rho,phase) are present, uses the
backend method to set resistivity and phase. If tipper data
exist, populates tipper arrays and derived attributes.
Convert a Jones J source to EDI or an EDI collection.
This transformer ingests a JFile
instance or a path to a .j file, extracts transfer
functions (Z, tipper, or fallback rho/phase),
finalizes a neutral payload
(TFBundle), and emits concrete
EDIFile objects. When given a
JCollection, it produces
an EDICollection.
The pipeline mirrors the AVG workflow:
Extract TF arrays and metadata from the J structure,
tolerating variant attribute names often found in legacy
files.
Finalize each bundle using the mixin logic: ensure a
valid station name, order and de-duplicate frequencies,
and fill missing TF parts if configured.
Emit EDI and optionally attach site coordinates if a
header-like structure is present on the J side.
Notes
Naming, frequency sorting, and de-duplication follow the
global configuration in pycsamt.core.config.
If only (rho,phase) are present, Z can be
reconstructed when allowed by
compute_z_from_res (via the mixin hook).
A Head or head object on JFile with attributes
lat, long, and elev is used to populate the EDI
>HEAD section when available.
Populates impedance arrays when present. If Z is absent
but (rho,phase) are available, the backend call is used
to set resistivity/phase onto the EDI structure. Tipper data
are also populated when provided.
>>> frompycsamt.core.transformersimportJtoEDI>>> # Single file>>> # edi = JtoEDI().transform(\"/data/site.j\")>>> # Collection>>> # out = JtoEDI().transform(j_collection)