2.30.7.4. pycsamt.map.view#
High-level MapView session façade for pyCSAMT maps.
MapView is the single object scripts, notebooks, and the map-view
platform share. It holds one combined MapData
(possibly spanning many lines) and renders every view through the
existing builders, so the GUI carries no plotting logic of its own.
Examples
>>> from pycsamt.map import MapView
>>> mv = MapView.from_folder("data/survey", detect="folder")
>>> mv.lines
('L18PLT', 'L22PLT')
>>> fig = mv.station(overlay="rho", frequency=1024)
>>> mv.export("out/station.html")
Classes
|
A code-first session bound to one (multi-line) survey. |
- class pycsamt.map.view.MapView(data, *, theme='light', backend='plotly')[source]
Bases:
objectA code-first session bound to one (multi-line) survey.
- classmethod from_folder(path, *, detect='folder', recursive=True, theme='light', backend='plotly', **load_kwargs)[source]
Build a view from a directory of one or more lines.
- classmethod from_lines(lines, *, theme='light', backend='plotly', **load_kwargs)[source]
Build a view from an explicit
{line: source}mapping.
- classmethod from_inversion_results(folder, *, known_stations=None, fetch_elevation=True, theme='light', backend='plotly', verbose=0)[source]
Build a view from a ModEM 3-D inversion result folder.
See
pycsamt.map.inversion.load_modem_lines(). Passknown_stations=existing_view.data.stationsto geo-reference and group ModEM stations using a previously-loaded EDI survey. Passfetch_elevation=Falseto skip the best-effort online elevation lookup (e.g. offline use, or large surveys where the extra round-trip isn’t wanted).
- classmethod from_pcsf(path, *, known_stations=None, fetch_elevation=True, theme='light', backend='plotly', mesh_z_samples=60)[source]
Build a view from a backend-neutral
.pcsf/.pcsm/.pcsm.gzfile.See
pycsamt.map.inversion.load_pcsf_lines(). Works with a file in either PCSF encoding (binary.pcsfor its lossless ASCII sibling,.pcsm/gzip-compressed.pcsm.gz— seepycsamt/format/SPEC.mdS9) with any of the four geometry kinds —grid2d,multiline, nativegrid3d(e.g. ModEM 3-D), ormesh_unstructured(e.g. MARE2DEM, sampled by point-location on its real triangulation, seemesh_z_samples) — passknown_stations=existing_view.data.stationsto geo-reference it against a previously-loaded EDI survey, the same asfrom_inversion_results().
- table()[source]
Return survey stations as a
pandas.DataFrame.
- with_elevations(elev_map)[source]
Return a copy with station elevations overridden by elev_map.
- fetch_elevations(*, api_name='open_meteo')[source]
Fetch station elevations online (see
pycsamt.map.fetch_elevations()).
- export_topography(path, *, fmt=None)[source]
Export this survey’s station id/elevation/coordinates.
Useful for an EDI-sourced view: a ModEM (or Occam2D/MARE2DEM) inversion result carries no real elevation of its own, so exporting it here produces a small, portable file that can be re-applied later — even in a session that never reloads these EDIs — via the “Upload file” elevation source (see
pycsamt.map.topo.export_elevations()).
- station(*, options=None, **overrides)[source]
Build a 2-D station map figure.
- Parameters:
options (StationMapOptions | None)
overrides (Any)
- Return type:
- profile(*, options=None, **overrides)[source]
Build a profile-view figure.
- Parameters:
options (ProfileMapOptions | None)
overrides (Any)
- Return type:
- pseudosection(*, options=None, **overrides)[source]
Build a resistivity/phase pseudosection figure.
- Parameters:
options (ProfileMapOptions | None)
overrides (Any)
- Return type:
- map3d(*, mode='fence', options=None, **overrides)[source]
Build a 3-D fence/block/depth/surface figure.
- Parameters:
mode (str)
options (VolumeMapOptions | None)
overrides (Any)
- Return type:
- figure(view='station', **overrides)[source]
Build a figure for view by name.
- Parameters:
view ({"station", "profile", "pseudosection", "map3d"}) – Which renderer to call.
**overrides – Forwarded to the matching renderer.
- Return type:
- export(path, *, view='station', fmt=None, scale=2.0, width=None, height=None, **overrides)[source]
Render view and write it to path.
The format is inferred from the suffix unless fmt is given;
.html,.png,.jsonand Plotly static images are supported (seepycsamt.map.export_figure()).
- export_all(directory, *, fmt='html', views=('station', 'pseudosection', 'map3d'), **overrides)[source]
Export several views into directory, keyed by view name.
- pycsamt.map.view.launch_app(source=None, *, host='127.0.0.1', port=8770, debug=False, open_browser=True, theme='light', backend='plotly', detect='folder', recursive=True, **load_kwargs)
Launch the interactive map-view app.
- Parameters:
source (Any) – Optional survey source.
Nonestarts the welcome screen. Otherwise accepts data, paths, sites, or mappings.host (str) – Forwarded to
pycsamt.app.mapview.launch().port (int) – Forwarded to
pycsamt.app.mapview.launch().debug (bool) – Forwarded to
pycsamt.app.mapview.launch().open_browser (bool) – Forwarded to
pycsamt.app.mapview.launch().detect (str) – Used for path/folder inputs.
recursive (bool) – Used for path/folder inputs.
**load_kwargs (Any) – Extra options forwarded to
MapView.from_folderorload_lines().
- Return type:
None
- pycsamt.map.view.launch_mapview(source=None, **kwargs)
Alias for
launch_app().
- pycsamt.map.view.open_app(source=None, **kwargs)
Backward-compatible alias for
launch_app().