pycsamt.map.topo#
Elevation / topography sources for pycsamt.map.
Station elevations carried in the EDI metadata are the default terrain
source for 3-D draping. This module lets callers override them from a
file (CSV / HDF5 / NPZ) or fetch them online from station coordinates,
so MapView and the platform can drape real
terrain rather than only the values embedded in the EDIs.
Functions
|
Return a copy of data with station elevations overridden. |
|
Export station id/elevation/coordinates to CSV or HDF5. |
|
Fetch station elevations online from their coordinates. |
|
Parse an uploaded elevation file into |
- pycsamt.map.topo.apply_elevations(data, elev_map)[source]#
Return a copy of data with station elevations overridden.
- pycsamt.map.topo.export_elevations(data, path, *, fmt=None)[source]#
Export station id/elevation/coordinates to CSV or HDF5.
EDI files carry real, field-surveyed elevation; a ModEM (or Occam2D/MARE2DEM) inversion result does not. Exporting a survey’s EDI-derived topography here produces a small, portable lookup table —
station+elevation(pluslatitude/longitude/linefor provenance) — thatparse_elevation_file()already knows how to read back in. That means it can be applied to an inversion-sourced view later via the “Upload file” elevation source, in a different session that never reloads the original EDIs, matching stations by id (with the same normalized fallback used byapply_elevations()).- Parameters:
data (MapData) – Survey to export (typically EDI-sourced, where
elevationis already populated).path (path-like) – Destination file.
fmtdefaults to the file’s own suffix (.csv/.h5/.hdf5); pass it explicitly to override.fmt ({"csv", "h5", "hdf5"}, optional)
- Returns:
The path written to.
- Return type:
- Raises:
ValueError – If no station in data has a known elevation, or fmt is unsupported.
- pycsamt.map.topo.fetch_elevations(data, *, api_name='open_meteo')[source]#
Fetch station elevations online from their coordinates.
Uses
pycsamt.gis.utils.get_elevation_from_api()(needs an internet connection andrequests).
- pycsamt.map.topo.parse_elevation_file(content, filename)[source]#
Parse an uploaded elevation file into
{station_id: elev}.Supports CSV, HDF5 (
.h5/.hdf5) and NPZ. The file must hold a station-id column/array (one ofstation,id,name,sta) and an elevation column/array (elevation,elev,z,alt,altitude,height). Returns{}on any parse failure rather than raising.