Site Tools#
The pycsamt.site package provides station-centric tools for working
with EDI sites and survey-line collections. It sits between low-level EDI
parsing and higher-level processing, inversion, plotting, and reporting.
Use this section when you need to:
wrap one EDI file as a single site object;
manage many sites as a survey collection;
inspect station names, coordinates, frequency axes, impedance arrays, phase, apparent resistivity, and tipper values;
select subsets of stations by name, index, frequency coverage, coordinates, chainage, or data quality;
edit station metadata, rotate tensors, subset frequencies, fill missing arrays, or recompute derived resistivity and phase;
normalize foreign or raw EDI files and rewrite them with pyCSAMT while preserving survey-line folder structure;
build survey-line profiles and chainages from coordinates;
export cleaned sites, write manifests, create zip packages, and generate human-readable site reports.
Guide Sections#
Work with SiteMixin, Site, Sites, to_sites, and
to_edis wrappers around EDI files and survey collections.
Parse coordinates, infer survey profiles, compute distances, bearings, chainage, elevation, and line geometry.
Filter stations by name, index, chainage, frequency coverage, coordinates, bounding box, and custom quality predicates.
Rotate tensors, rename stations, assign coordinates, subset frequencies, fill missing arrays, and recompute response products.
Rewrite EDI files with pyCSAMT, preserve line-folder structure, flatten outputs, show progress, and generate manifests.
Compute strike estimates, apparent resistivity at a frequency, phase slope, and tipper magnitude diagnostics.
Write cleaned sites, batch exports, zip packages, manifests, and human-readable site reports.
Use shared helpers for EDI detection, collection coercion, station names, coordinates, frequency matching, and angle conversion.
Typical Workflow#
The site layer is commonly used as an early survey preparation stage.
1from pycsamt.site import Sites
2from pycsamt.site.selection import by_freq, keep_finite_z
3from pycsamt.site.edit import rotate_all
4from pycsamt.site.profile import Profile
5from pycsamt.site.recompute import recompute_edis
6
7sites = Sites.from_path("data/edi")
8sites = keep_finite_z(sites)
9sites = by_freq(sites, fmin=1.0, fmax=1000.0)
10sites = rotate_all(sites, angle_deg=30.0)
11
12profile = Profile.from_sites(sites)
13print(profile.spacing_stats)
For a complete EDI rewrite workflow, use pycsamt.site.recompute.recompute_edis():
1result = recompute_edis(
2 "data/willy",
3 rotate_angle=30.0,
4 template="{source_stem}.edi",
5 overwrite=True,
6 progress=True,
7)
8
9print(result.output_root)