pycsamt.map.inversion#
Import geophysical inversion results into MapData.
A ModEM run inverts one 3-D resistivity volume for the whole survey —
individual lines are not separate model files, they are paths of
stations through that one volume. load_modem_lines() slices
that volume into one 2-D vertical curtain per survey line (see
pycsamt.models.modem.section) and returns a MapData
carrying real station coordinates plus the precomputed sections, so
the existing 3-D fence/depth builders in pycsamt.map.volume
render inversion-sourced lines exactly like EDI-sourced ones — same
real-geometry line placement, same UI.
Geo-referencing station coordinates#
Three sources are tried, in order, for each ModEM station:
known_stations— a previously-loaded EDIMapData’s stations, matched by station id. Recommended: works for any inversion backend and lets a matched station’s line/elevation override the (less complete) values recoverable from the ModEM files alone.The ModEM
.datfile’s ownGG_Lat/GG_Loncolumns (seepycsamt.models.modem.data.ModEmData.site_lonlat).Neither — the station keeps
latitude=longitude=Noneand the 3-D builder falls back to synthetic index-based line spacing for that line (seepycsamt.map.geometry).
Functions
|
Group ModEM station names into survey lines. |
|
Load a ModEM 3-D inversion result folder as a multi-line MapData. |
- pycsamt.map.inversion.group_modem_stations(station_names, *, known_stations=None)[source]#
Group ModEM station names into survey lines.
Prefers matching each name against known_stations (e.g. previously loaded EDI stations) and using their
linetag. Falls back to parsing the line token out of the station-name convention{survey}-{line}-{station}{suffix}(e.g.23-18-001A-> line18) — a heuristic, used only when a station has no match in known_stations.
- pycsamt.map.inversion.load_modem_lines(folder, *, known_stations=None, fetch_elevation=True, verbose=0)[source]#
Load a ModEM 3-D inversion result folder as a multi-line MapData.
- Parameters:
folder (path-like) – A ModEM output directory. The matching final-iteration
.rho/.datpair is auto-detected bypycsamt.models.modem.results.InversionResult.known_stations (iterable of StationRecord, optional) – Previously-loaded EDI stations (e.g.
existing_map_data.stations) used to geo-reference and group ModEM stations by real coordinates/line name — see the module docstring.fetch_elevation (bool, default True) – ModEM output carries no real elevation (unlike EDI, where it’s already in the file header, so “Drape topography” just works). When
True, any station still missing an elevation afterknown_stationsmatching gets a best-effort online lookup (Open-Meteo) so topography isn’t silently flat by default. Failures (offline, API error, …) are swallowed — elevation simply stays unset, same as passingFalse.verbose (int, default 0) – Verbosity forwarded to the ModEM readers.
- Returns:
sites=None(no EDI backing);stationscarries oneStationRecordper ModEM station with coordinates resolved where possible;metadata["sections"]carries the precomputed per-line(x, z, rho)curtains consumed directly bypycsamt.map.volume.- Return type: