pycsamt.utils.io#

pycsamt.utils.io

I/O utility functions for PyCSAMT v2.0.

Functions

parse_stn_profile(file_path[, delimiter])

Parse a station profile file (.stn) containing columns such as station position (dot), easting, northing, elevation.

stn_separation(easting, northing[, interpolate])

Compute station separations (distance between successive points).

pycsamt.utils.io.stn_separation(easting, northing, interpolate=False)[source]#

Compute station separations (distance between successive points).

Parameters:
  • easting (array_like) – Easting coordinates (m).

  • northing (array_like) – Northing coordinates (m).

  • interpolate (bool, optional) – If True, returns an array of length N matching the number of electrodes by extrapolating the first separation. If False, returns length N-1 (number of dipoles). Default is False.

Returns:

  • separations (np.ndarray) – Distances between successive points.

  • mean_sep (float) – Mean separation value.

Return type:

tuple[ndarray, float]

pycsamt.utils.io.parse_stn_profile(file_path, delimiter=None)[source]#

Parse a station profile file (.stn) containing columns such as station position (dot), easting, northing, elevation.

Parameters:
  • file_path (str) – Path to the station profile file.

  • delimiter (str, optional) – Field delimiter. If None, whitespace splitting is used.

Returns:

result – Dictionary with keys: - ‘position’: station position (float) - ‘easting’: easting coordinate (float) - ‘northing’: northing coordinate (float) - ‘elevation’: elevation (float)

Return type:

Dict[str, np.ndarray]

Raises:

PycsamtError – If file cannot be read or parsed.