2.29.3.3. pycsamt.topo.extract#

Extract elevation and chainage arrays from Sites / EDI collections.

These utilities are the bridge between pycsamt’s data model and the topography rendering pipeline. They operate on any object that contains EDI-like items with HEAD lat/lon/elev attributes — including Sites, plain lists of EDIFile, and EDIBatch objects.

Examples

>>> from pycsamt.topo.extract import extract_elevation, extract_chainage
>>> elev = extract_elevation(sites)  # (n_stations,)  m a.s.l.
>>> chain = extract_chainage(sites)  # (n_stations,)  km

Functions

extract_chainage(sites)

Compute along-profile cumulative distance (km) for each station.

extract_elevation(sites)

Extract per-station elevation (m a.s.l.) from a Sites or EDI collection.

extract_station_names(sites)

Return station name / ID strings in collection order.

has_elevation(sites)

Return True if any station carries a meaningful non-zero elevation.

pycsamt.topo.extract.extract_elevation(sites)[source]

Extract per-station elevation (m a.s.l.) from a Sites or EDI collection.

Reads the .elev (or .elevation / .alt) field from each station’s HEAD coordinate block. Returns a zero array and emits a UserWarning when no valid non-zero elevation is found.

Parameters:

sites (Sites, EDICollection, list[EDIFile], or single EDIFile) – Any object that contains station data with HEAD lat/lon/elev.

Returns:

Elevation in metres above sea level, one value per station in the order they appear in the collection.

Return type:

numpy.ndarray, shape (n_stations,)

pycsamt.topo.extract.extract_chainage(sites)[source]

Compute along-profile cumulative distance (km) for each station.

Uses a flat-Earth approximation: cumulative Euclidean distance in lat/lon space scaled to metres, converted to km. Stations are assumed to be in profile order.

Parameters:

sites (Sites, EDICollection, list[EDIFile])

Returns:

Cumulative chainage in km from the first station (starts at 0).

Return type:

numpy.ndarray, shape (n_stations,)

pycsamt.topo.extract.has_elevation(sites)[source]

Return True if any station carries a meaningful non-zero elevation.

Parameters:

sites (any station container)

Return type:

bool

pycsamt.topo.extract.extract_station_names(sites)[source]

Return station name / ID strings in collection order.

Parameters:

sites (any station container)

Return type:

list[str]