pycsamt.map._core#

Core data extraction helpers for pycsamt.map.

Functions

component_index(component)

Return tensor indices for an impedance component.

component_spec(component)

Return a parsed impedance component specification.

component_values(arr, component, *[, quantity])

Extract a 1-D value series for one component.

ensure_map_data(data, *[, recursive, ...])

Return normalized map data.

frequency_axis(data)

Return the first finite frequency axis found.

normalize_component(component)

Return the canonical map component name.

normalize_station_id(name)

Loosely-normalized station id for fuzzy matching.

profile_lines(data, **kwargs)

Return normalized profile lines for data.

pseudosection_table(data, *[, quantity, ...])

Return long-form profile data for pseudosections.

select_frequency(frequencies[, requested, ...])

Select the closest finite positive frequency.

skin_depth_at_frequency(data, *, frequency)

Return skin depth at the closest frequency.

station_dataframe(data)

Return station records as a DataFrame.

station_distance_km(data)

Return approximate station distance in km.

station_records(data, **kwargs)

Return normalized station records for data.

value_at_frequency(data, *, frequency[, ...])

Return station values at the closest frequency.

value_at_frequency_details(data, *, frequency)

Return values with selected-frequency metadata.

Classes

ComponentSpec(name[, indices, mode])

Parsed impedance component request.

FrequencySelection(requested, actual, index, ...)

Nearest-frequency selection metadata.

FrequencyValue(station, value, selection)

Station value and selected-frequency metadata.

MapData(sites[, stations, profiles, metadata])

Normalized survey data shared by map renderers.

ProfileLine(name[, stations])

A named sequence of stations in one profile.

StationRecord(id[, latitude, longitude, ...])

A normalized station row used by map renderers.

pycsamt.map._core.normalize_station_id(name)[source]#

Loosely-normalized station id for fuzzy matching.

Lowercases and strips everything but letters/digits, so minor formatting differences between sources — 23-18-001A vs 23_18_001a vs 23 18 001A — still match. Used as a fallback tier (never the only lookup) wherever a station from one source (EDI, ModEM, an uploaded elevation file, …) needs to be matched against another.

Parameters:

name (Any)

Return type:

str

class pycsamt.map._core.StationRecord(id, latitude=None, longitude=None, elevation=None, line=None, index=0, source=None)[source]#

Bases: object

A normalized station row used by map renderers.

Parameters:
id: str#
latitude: float | None = None#
longitude: float | None = None#
elevation: float | None = None#
line: str | None = None#
index: int = 0#
source: Any = None#
class pycsamt.map._core.ProfileLine(name, stations=())[source]#

Bases: object

A named sequence of stations in one profile.

Parameters:
name: str#
stations: tuple[StationRecord, ...] = ()#
class pycsamt.map._core.MapData(sites, stations=(), profiles=(), metadata=<factory>)[source]#

Bases: object

Normalized survey data shared by map renderers.

Parameters:
sites: Any#
stations: tuple[StationRecord, ...] = ()#
profiles: tuple[ProfileLine, ...] = ()#
metadata: dict[str, Any]#
property station_ids: tuple[str, ...][source]#

Return normalized station IDs.

property lines: tuple[str, ...][source]#

Return available profile/line names.

property has_geo: bool[source]#

Whether stations have finite map coordinates.

iter_edis()[source]#

Return EDI-like source objects.

Return type:

tuple[Any, …]

class pycsamt.map._core.ComponentSpec(name, indices=None, mode='tensor')[source]#

Bases: object

Parsed impedance component request.

Parameters:
name: str#
indices: tuple[int, int] | None = None#
mode: str = 'tensor'#
class pycsamt.map._core.FrequencySelection(requested, actual, index, delta, relative_delta, within_tolerance=True)[source]#

Bases: object

Nearest-frequency selection metadata.

Parameters:
requested: float | None#
actual: float#
index: int#
delta: float#
relative_delta: float#
within_tolerance: bool = True#
class pycsamt.map._core.FrequencyValue(station, value, selection)[source]#

Bases: object

Station value and selected-frequency metadata.

Parameters:
station: str#
value: float#
selection: FrequencySelection#
pycsamt.map._core.ensure_map_data(data, *, recursive=True, line_map=None, verbose=0)[source]#

Return normalized map data.

Parameters:
  • data (Any) – EDI path, directory, iterable, or Sites.

  • recursive (bool) – Passed to pycsamt.emtools._core.ensure_sites().

  • line_map (dict[str, Iterable[str]] | None) – Optional line -> station names mapping used when line metadata is not embedded in EDI objects.

  • verbose (int) – Verbosity passed to ensure_sites().

Return type:

MapData

pycsamt.map._core.station_records(data, **kwargs)[source]#

Return normalized station records for data.

Parameters:
Return type:

tuple[StationRecord, …]

pycsamt.map._core.profile_lines(data, **kwargs)[source]#

Return normalized profile lines for data.

Parameters:
Return type:

tuple[ProfileLine, …]

pycsamt.map._core.station_dataframe(data)[source]#

Return station records as a DataFrame.

Parameters:

data (MapData)

Return type:

DataFrame

pycsamt.map._core.normalize_component(component)[source]#

Return the canonical map component name.

Parameters:

component (str | None)

Return type:

str

pycsamt.map._core.component_spec(component)[source]#

Return a parsed impedance component specification.

Parameters:

component (str | None)

Return type:

ComponentSpec

pycsamt.map._core.component_index(component)[source]#

Return tensor indices for an impedance component.

Parameters:

component (str)

Return type:

tuple[int, int]

pycsamt.map._core.component_values(arr, component, *, quantity='rho')[source]#

Extract a 1-D value series for one component.

Parameters:
  • arr (Any)

  • component (str | None)

  • quantity (str)

Return type:

ndarray

pycsamt.map._core.frequency_axis(data)[source]#

Return the first finite frequency axis found.

Parameters:

data (MapData)

Return type:

ndarray

pycsamt.map._core.select_frequency(frequencies, requested=None, *, tolerance=None)[source]#

Select the closest finite positive frequency.

Parameters:
  • frequencies (Any)

  • requested (float | None)

  • tolerance (float | None)

Return type:

FrequencySelection | None

pycsamt.map._core.station_distance_km(data)[source]#

Return approximate station distance in km.

Parameters:

data (MapData)

Return type:

ndarray

pycsamt.map._core.value_at_frequency(data, *, frequency, quantity='rho', component='xy', tolerance=None)[source]#

Return station values at the closest frequency.

Parameters:
Return type:

dict[str, float]

pycsamt.map._core.value_at_frequency_details(data, *, frequency, quantity='rho', component='xy', tolerance=None)[source]#

Return values with selected-frequency metadata.

Parameters:
Return type:

dict[str, FrequencyValue]

pycsamt.map._core.skin_depth_at_frequency(data, *, frequency, component='xy', tolerance=None)[source]#

Return skin depth at the closest frequency.

Parameters:
Return type:

dict[str, float]

pycsamt.map._core.pseudosection_table(data, *, quantity='rho', component='xy')[source]#

Return long-form profile data for pseudosections.

Parameters:
Return type:

DataFrame