pycsamt.site.recompute#
Functions
|
Recompute one EDI object. |
|
Convenience function for |
Classes
|
Per-station outcome for an EDI recomputation workflow. |
|
Result returned by |
|
Recompute and rewrite EDI files using pyCSAMT conventions. |
- class pycsamt.site.recompute.EDIRecomputeRecord(source, output, line, station, status, message='')[source]#
Bases:
objectPer-station outcome for an EDI recomputation workflow.
- Variables:
source (pathlib.Path or None) – Source EDI path when known.
output (pathlib.Path or None) – Written EDI path when
write=Trueand the station was written successfully.line (str or None) – Line/group name inferred from the source directory.
station (str) – Station name after recomputation and optional renaming.
status (str) –
"ok"for success or"failed"when processing continued after an error.message (str, default "") – Optional diagnostic message.
- Parameters:
- class pycsamt.site.recompute.EDIRecomputeResult(sites, records, output_root=None, items=<factory>)[source]#
Bases:
objectResult returned by
EDIRecomputer.- Variables:
sites (pycsamt.site.base.Sites) – Recomputed EDI objects wrapped as sites.
records (list of EDIRecomputeRecord) – Per-station processing and writing outcomes.
output_root (pathlib.Path or None) – Root directory used for exported EDI files.
- Parameters:
- records: list[EDIRecomputeRecord]#
- property failed: list[EDIRecomputeRecord][source]#
Return failed records.
- class pycsamt.site.recompute.EDIRecomputer(output_root=None, output_name='recomputed_edis', preserve_line_dirs=True, template='{station}.edi', overwrite=False, write=True, manifest_csv=True, rotate_angle=None, rotate_components=<factory>, fmin=None, fmax=None, keep_freq=None, fill_missing_values=None, recompute_resphase=True, rename_policy=None, datatype=None, synthesize_spectra=False, recursive=True, strict=False, on_dup='replace', copy=True, progress=False, verbose=0, progress_callback=None)[source]#
Bases:
objectRecompute and rewrite EDI files using pyCSAMT conventions.
This class is a workflow layer over the lower-level site helpers. It accepts EDI objects, EDI collections, files, line folders, or survey folders, applies a sequence of optional normalizations, and can write pyCSAMT-generated EDI files to a new output tree.
- Parameters:
output_root (str or pathlib.Path, optional) – Root directory for recomputed EDI files. If omitted, a
recomputed_edisdirectory is created next to a selected line folder, or inside a selected survey folder.output_name (str, default "recomputed_edis") – Directory name used when
output_rootis not provided.preserve_line_dirs (bool, default True) – If
True, write each inferred line into its own subdirectory underoutput_root. IfFalse, write all recomputed EDI files directly underoutput_root.template (str, default "{station}.edi") – Filename template. Available keys are
station,index,line, andsource_stem.overwrite (bool, default False) – Allow replacing existing output files.
write (bool, default True) – If
False, only return recomputed in-memory objects.manifest_csv (bool or str or pathlib.Path, default True) – Write a CSV manifest.
Truewrites<output_root>/manifest.csv. A path writes there.rotate_angle (float, optional) – Rotation angle in degrees. If omitted, no rotation is applied.
rotate_components (iterable of str, default ("Z", "Tip")) – Components to rotate. Accepts values such as
"Z","impedance","Tip", and"tipper".fmin (float, optional) – Frequency range to keep before recomputation.
fmax (float, optional) – Frequency range to keep before recomputation.
keep_freq (iterable of int, optional) – Explicit frequency indices or mask passed to
pycsamt.site.edit.select_freq().fill_missing_values ({"zero", "nan"}, optional) – Missing-value policy passed to
pycsamt.site.edit.fill_missing().recompute_resphase (bool, default True) – Recompute apparent resistivity and phase from impedance.
rename_policy (callable, optional) – Function mapping the current station name to a new name.
datatype (str, optional) – EDI writer datatype override, for example
"mt"or"emap".synthesize_spectra (bool, default False) – Ask the pyCSAMT EDI writer to synthesize spectra when possible and missing.
recursive (bool, default True) – Recurse while discovering EDI files inside line folders.
strict (bool, default False) – Raise on read/process/write errors instead of recording failed manifest rows.
on_dup ({"replace", "keep"}, default "replace") – Duplicate station policy during loading.
copy (bool, default True) – Recompute copies of loaded EDI objects. Keep this enabled when the original objects should remain unchanged.
progress (bool or {"auto"}, default False) – Show progress while recomputing.
verbose (int, default 0) – Verbosity for loading, processing, and writing.
progress_callback (Callable[[int, int, str, str, str], None] | None)
- pycsamt.site.recompute.recompute_edi(edi, *, rotate_angle=None, rotate_components=('Z', 'Tip'), fmin=None, fmax=None, keep_freq=None, fill_missing_values=None, recompute_resphase=True, rename_policy=None, copy=True)[source]#
Recompute one EDI object.
The operation is copy-returning by default. It can rotate transfer functions, subset frequencies, fill missing values, recompute apparent resistivity/phase, and rename station ids.
- pycsamt.site.recompute.recompute_edis(source, **kwargs)[source]#
Convenience function for
EDIRecomputer.Examples
>>> result = recompute_edis("WILLY_DATA", rotate_angle=30.0) >>> result.paths [...]
- Parameters:
- Return type: