Map API Reference#

This page collects the main map modules. The full autogenerated API reference also includes ../api/map.

Core Data#

Core data extraction helpers for pycsamt.map.

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

Loading And Sessions#

Multi-line EDI ingestion for pycsamt.map.

A map-view survey is usually made of several profile lines, each stored as its own EDI folder. The renderers in pycsamt.map already understand the per-station line attribute, but the normalizer pycsamt.map._core.ensure_map_data() only consumes a single source. This module lifts the multi-line grouping logic out of the GUI layer so scripts and notebooks can build one combined MapData from many lines.

Accepted source forms#

mapping

{line_name: dir | iterable_of_edis} — explicit line layout.

sequence of directories

[dir_a, dir_b, ...] — one line per directory (named after it).

sequence of EDI-like items / files

Treated as a single "line".

single directory

Grouped according to detect (see load_lines()).

single file

A one-station line named after the file stem.

pycsamt.map.loader.load_lines(source, *, detect='folder', recursive=True, line_map=None, verbose=0)[source]#

Build one combined MapData from multiple lines.

Parameters:
  • source (Any) – Mapping, sequence, directory, or file (see module docstring). A MapData is returned unchanged.

  • detect ({"folder", "auto", "flat"}, default "folder") –

    Line-grouping rule applied only when source is a single directory:

    folder

    One line per immediate sub-folder holding EDI files (a flat folder becomes one line named after it).

    auto

    Group by the station-ID prefix, e.g. 22-001 -> L22.

    flat

    Treat the whole directory as a single line.

  • recursive (bool) – Recurse into sub-directories when discovering EDI files and when calling ensure_map_data().

  • line_map (dict[str, Iterable[str]] | None) – Optional line -> station names mapping forwarded to ensure_map_data() for sources without embedded line metadata.

  • verbose (int) – Verbosity forwarded to ensure_map_data().

Returns:

Stations from every line, re-indexed and tagged with their resolved line name; profiles are rebuilt per line.

Return type:

MapData

pycsamt.map.loader.resolve_line_groups(source, *, detect='folder', recursive=True)[source]#

Return a {line_name: source} mapping for source.

The values are passed straight to ensure_map_data(), so they may be directories, lists of file paths, or EDI-like iterables. This mirrors the groups store used by the GUI loader, making the two paths share one grouping contract.

Parameters:
Return type:

dict[str, Any]

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")
class pycsamt.map.view.MapView(data, *, theme='light', backend='plotly')[source]#

Bases: object

A code-first session bound to one (multi-line) survey.

Parameters:
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.

Parameters:
Return type:

MapView

classmethod from_lines(lines, *, theme='light', backend='plotly', **load_kwargs)[source]#

Build a view from an explicit {line: source} mapping.

Parameters:
Return type:

MapView

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(). Pass known_stations=existing_view.data.stations to geo-reference and group ModEM stations using a previously-loaded EDI survey. Pass fetch_elevation=False to skip the best-effort online elevation lookup (e.g. offline use, or large surveys where the extra round-trip isn’t wanted).

Parameters:
Return type:

MapView

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

Return the profile/line names in this survey.

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

Return the station IDs in this survey.

property n_stations: int[source]#

Return the number of stations across all lines.

property has_geo: bool[source]#

Whether stations carry finite map coordinates.

table()[source]#

Return survey stations as a pandas.DataFrame.

with_elevations(elev_map)[source]#

Return a copy with station elevations overridden by elev_map.

Parameters:

elev_map (dict[str, float])

Return type:

MapView

fetch_elevations(*, api_name='open_meteo')[source]#

Fetch station elevations online (see pycsamt.map.fetch_elevations()).

Parameters:

api_name (str)

Return type:

dict[str, float]

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()).

Parameters:
station(*, options=None, **overrides)[source]#

Build a 2-D station map figure.

Parameters:
Return type:

Any

profile(*, options=None, **overrides)[source]#

Build a profile-view figure.

Parameters:
Return type:

Any

pseudosection(*, options=None, **overrides)[source]#

Build a resistivity/phase pseudosection figure.

Parameters:
Return type:

Any

map3d(*, mode='fence', options=None, **overrides)[source]#

Build a 3-D fence/block/depth/surface figure.

Parameters:
Return type:

Any

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:

Any

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, .json and Plotly static images are supported (see pycsamt.map.export_figure()).

Parameters:
Return type:

Path

export_all(directory, *, fmt='html', views=('station', 'pseudosection', 'map3d'), **overrides)[source]#

Export several views into directory, keyed by view name.

Parameters:
Return type:

dict[str, Path]

launch(**kwargs)[source]#

Open this survey in the map-view platform.

Requires the optional Dash GUI extra (pycsamt.app.mapview).

Parameters:

kwargs (Any)

Return type:

None

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. None starts 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().

  • theme (str) – Used when building a MapView.

  • backend (str) – Used when building a MapView.

  • detect (str) – Used for path/folder inputs.

  • recursive (bool) – Used for path/folder inputs.

  • **load_kwargs (Any) – Extra options forwarded to MapView.from_folder or load_lines().

Return type:

None

pycsamt.map.view.launch_mapview(source=None, **kwargs)#

Alias for launch_app().

Parameters:
Return type:

None

pycsamt.map.view.open_app(source=None, **kwargs)#

Backward-compatible alias for launch_app().

Parameters:
Return type:

None

Renderers#

2-D station-map API for pyCSAMT surveys.

class pycsamt.map.station.StationMap(data, *, options=None, **ensure_kwargs)[source]#

Bases: object

Builder object for station-map figures.

Parameters:
with_overlay(overlay, **kwargs)[source]#

Return a copy with a different overlay.

Parameters:
Return type:

StationMap

with_options(**kwargs)[source]#

Return a copy with updated options.

Parameters:

kwargs (Any)

Return type:

StationMap

figure()[source]#

Build and return the station-map figure.

Return type:

Any

pycsamt.map.station.plot_station_map(data, *, options=None, **kwargs)[source]#

Build a 2-D station map.

Parameters:
Return type:

Any

pycsamt.map.station.build_station_map(data, options=None)[source]#

Build a Plotly 2-D station map.

Parameters:
Return type:

Any

Profile-view and pseudosection API for pyCSAMT surveys.

class pycsamt.map.profile.ProfileMap(data, *, options=None, **ensure_kwargs)[source]#

Bases: object

Builder object for profile maps.

Parameters:
with_options(**kwargs)[source]#

Return a copy with updated options.

Parameters:

kwargs (Any)

Return type:

ProfileMap

with_quantity(quantity)[source]#

Return a copy using another mapped quantity.

Parameters:

quantity (str)

Return type:

ProfileMap

with_component(component)[source]#

Return a copy using one impedance component.

Parameters:

component (str)

Return type:

ProfileMap

with_components(*components)[source]#

Return a copy using multiple components.

Parameters:

components (str)

Return type:

ProfileMap

figure()[source]#

Build and return the profile figure.

Return type:

Any

pseudosection()[source]#

Build and return the pseudosection figure.

Return type:

Any

pycsamt.map.profile.plot_profile_map(data, *, options=None, **kwargs)[source]#

Build a profile-view map.

Parameters:
Return type:

Any

pycsamt.map.profile.plot_pseudosection(data, *, options=None, **kwargs)[source]#

Build a resistivity or phase pseudosection.

Parameters:
Return type:

Any

pycsamt.map.profile.build_profile_map(data, options)[source]#

Build the concrete profile-view figure.

Parameters:
Return type:

Any

pycsamt.map.profile.build_pseudosection(data, options)[source]#

Build the concrete pseudosection figure.

Parameters:
Return type:

Any

3-D map API for fence, block, and depth-slice views.

class pycsamt.map.volume.Map3D(data, *, options=None, **ensure_kwargs)[source]#

Bases: object

Builder object for 3-D survey maps.

Parameters:
with_mode(mode)[source]#

Return a copy with another 3-D mode.

Parameters:

mode (str)

Return type:

Map3D

with_options(**kwargs)[source]#

Return a copy with updated options.

Parameters:

kwargs (Any)

Return type:

Map3D

with_quantity(quantity)[source]#

Return a copy using another mapped quantity.

Parameters:

quantity (str)

Return type:

Map3D

with_component(component)[source]#

Return a copy using another component.

Parameters:

component (str)

Return type:

Map3D

figure()[source]#

Build and return the 3-D map figure.

Return type:

Any

pycsamt.map.volume.VolumeMap#

alias of Map3D

pycsamt.map.volume.plot_3d_map(data, *, options=None, **kwargs)[source]#

Build a 3-D map.

Parameters:
Return type:

Any

pycsamt.map.volume.plot_volume_map(data, *, options=None, **kwargs)[source]#

Build a 3-D volume map.

Parameters:
Return type:

Any

pycsamt.map.volume.build_3d_map(data, options)[source]#

Build the concrete 3-D figure.

Parameters:
Return type:

Any

Options, Overlays, Export#

Configuration dataclasses for pycsamt.map.

class pycsamt.map.config.StationMapOptions(overlay='index', frequency=None, frequency_tolerance=None, component='xy', theme='light', backend='plotly', selected_id=None, line_filter=None, marker_size=10, basemap=None, cmap='plasma', value_range=None, log_color=False, opacity=0.92, show_labels=True, show_profiles=True, show_contours=False, contour_image=False, contour_mode='filled+lines', contour_levels=12, contour_opacity=0.55, contour_interp='cubic', contour_smooth=1.0, contour_grid_res=150, bearing=0.0, title='')[source]#

Bases: object

Options for 2-D station maps.

Parameters:
  • overlay (str)

  • frequency (float | None)

  • frequency_tolerance (float | None)

  • component (str)

  • theme (Literal['light', 'dark', 'publication'])

  • backend (Literal['plotly', 'matplotlib'])

  • selected_id (str | None)

  • line_filter (tuple[str, ...] | None)

  • marker_size (int)

  • basemap (str | None)

  • cmap (str)

  • value_range (tuple[float, float] | None)

  • log_color (bool)

  • opacity (float)

  • show_labels (bool)

  • show_profiles (bool)

  • show_contours (bool)

  • contour_image (bool)

  • contour_mode (str)

  • contour_levels (int)

  • contour_opacity (float)

  • contour_interp (str)

  • contour_smooth (float)

  • contour_grid_res (int)

  • bearing (float)

  • title (str)

overlay: str = 'index'#
frequency: float | None = None#
frequency_tolerance: float | None = None#
component: str = 'xy'#
theme: Literal['light', 'dark', 'publication'] = 'light'#
backend: Literal['plotly', 'matplotlib'] = 'plotly'#
selected_id: str | None = None#
line_filter: tuple[str, ...] | None = None#
marker_size: int = 10#
basemap: str | None = None#
cmap: str = 'plasma'#
value_range: tuple[float, float] | None = None#
log_color: bool = False#
opacity: float = 0.92#
show_labels: bool = True#
show_profiles: bool = True#
show_contours: bool = False#
contour_image: bool = False#
contour_mode: str = 'filled+lines'#
contour_levels: int = 12#
contour_opacity: float = 0.55#
contour_interp: str = 'cubic'#
contour_smooth: float = 1.0#
contour_grid_res: int = 150#
bearing: float = 0.0#
title: str = ''#
class pycsamt.map.config.ProfileMapOptions(quantity='rho', component='xy', components=('xy', 'yx'), theme='light', backend='plotly', period_range=None, phase_range=None, value_range=None, x_axis='station', log_rho=True, height_per_panel=260, show_errbar=False, cmap=None)[source]#

Bases: object

Options for pseudosection and profile-view maps.

Parameters:
quantity: str = 'rho'#
component: str = 'xy'#
components: tuple[str, ...] = ('xy', 'yx')#
theme: Literal['light', 'dark', 'publication'] = 'light'#
backend: Literal['plotly', 'matplotlib'] = 'plotly'#
period_range: tuple[float, float] | None = None#
phase_range: tuple[float, float] | None = None#
value_range: tuple[float, float] | None = None#
x_axis: Literal['station', 'distance'] = 'station'#
log_rho: bool = True#
height_per_panel: int = 260#
show_errbar: bool = False#
cmap: str | None = None#
class pycsamt.map.config.VolumeMapOptions(mode='fence', quantity='resistivity', component='xy', theme='light', cmap='RdYlBu_r', depth_range=None, period_range=None, rho_range=None, iso_range=None, value_range=None, log_color=True, opacity=0.85, show_contours=False, show_labels=True, n_slices=5, surface_count=12, line_spacing=1.0, azimuth=0.0, topography=True, show_terrain=True, terrain_opacity=0.7, show_stations=False, station_symbol='diamond', station_size=4, station_color='#1f2937', station_labels=False, aspectmode='data', x_unit='m', depth_unit='m', smooth_sections=True, section_res=100, title='')[source]#

Bases: object

Options for 3-D fence, block, and depth-slice maps.

Parameters:
mode: Literal['fence', 'block', 'depth', 'surface'] = 'fence'#
quantity: str = 'resistivity'#
component: str = 'xy'#
theme: Literal['light', 'dark', 'publication'] = 'light'#
cmap: str = 'RdYlBu_r'#
depth_range: tuple[float, float] | None = None#
period_range: tuple[float, float] | None = None#
rho_range: tuple[float, float] | None = None#
iso_range: tuple[float, float] | None = None#
value_range: tuple[float, float] | None = None#
log_color: bool = True#
opacity: float = 0.85#
show_contours: bool = False#
show_labels: bool = True#
n_slices: int = 5#
surface_count: int = 12#
line_spacing: float = 1.0#
azimuth: float = 0.0#
topography: bool = True#
show_terrain: bool = True#
terrain_opacity: float = 0.7#
show_stations: bool = False#
station_symbol: str = 'diamond'#
station_size: int = 4#
station_color: str = '#1f2937'#
station_labels: bool = False#
aspectmode: str = 'data'#
x_unit: str = 'm'#
depth_unit: str = 'm'#
smooth_sections: bool = True#
section_res: int = 100#
title: str = ''#
class pycsamt.map.config.ExportOptions(path, format=None, width=None, height=None, scale=2.0, include_plotlyjs='cdn')[source]#

Bases: object

Options used by figure export helpers.

Parameters:
path: str | Path#
format: str | None = None#
width: int | None = None#
height: int | None = None#
scale: float = 2.0#
include_plotlyjs: str | bool = 'cdn'#

Overlay helpers for station, profile, and 3-D maps.

class pycsamt.map.overlays.ContourOverlay(values, x, y, levels=12, cmap='viridis', opacity=0.65)[source]#

Bases: object

Description of an interpolated contour overlay.

Parameters:
values: ndarray#
x: ndarray#
y: ndarray#
levels: int = 12#
cmap: str = 'viridis'#
opacity: float = 0.65#
class pycsamt.map.overlays.TopographyOverlay(elevation, source='stations', opacity=0.7)[source]#

Bases: object

Topography aligned to map coordinates.

Parameters:
elevation: ndarray#
source: str = 'stations'#
opacity: float = 0.7#
class pycsamt.map.overlays.CRSConfig(source, target=4326, always_xy=True)[source]#

Bases: object

Coordinate transform settings.

Parameters:
source: int | str#
target: int | str = 4326#
always_xy: bool = True#
class pycsamt.map.overlays.BasemapConfig(style, center, zoom, bearing=0.0, layers=())[source]#

Bases: object

Plotly geographic map layout settings.

Parameters:
style: str#
center: dict[str, float]#
zoom: int#
bearing: float = 0.0#
layers: tuple = ()#
pycsamt.map.overlays.basemap_style_and_layers(style, *, dark=False)[source]#

Resolve a style name into a (base style, raster layers) pair.

ESRI styles are rendered as white-bg + a raster tile layer; native Plotly styles are returned as-is with no layers.

Parameters:
Return type:

tuple[str, list]

pycsamt.map.overlays.resolve_crs_info(mode='geo', *, zone=50, hemisphere='N', epsg=4326)[source]#

Return a human-readable CRS description.

Parameters:
Return type:

str

pycsamt.map.overlays.normalize_epsg(epsg)[source]#

Return an EPSG authority string.

Parameters:

epsg (int | str)

Return type:

str

pycsamt.map.overlays.transform_xy(x, y, *, crs)[source]#

Transform coordinates between two CRS definitions.

Parameters:
Return type:

tuple[ndarray, ndarray]

pycsamt.map.overlays.reproject_xy_to_lonlat(x, y, *, epsg)[source]#

Reproject x, y from epsg to WGS84 lon/lat.

Parameters:
Return type:

tuple[ndarray, ndarray]

pycsamt.map.overlays.build_contour_overlay(x, y, values, *, levels=12, cmap='Viridis', opacity=0.65, grid_size=80, mode='lines')[source]#

Build an interpolated map contour overlay.

Returns a Plotly Contour trace on a regular grid.

Parameters:
Return type:

Any

pycsamt.map.overlays.build_geo_contour_image(lons, lats, values, *, cmap='jet', n_levels=12, opacity=0.6, mode='filled+lines', log_scale=False, grid_res=160, expand=0.06, interp='cubic', smooth_sigma=0.0)[source]#

Render a Surfer-style filled-contour PNG for a basemap image layer.

Interpolates sparse station values onto a regular lon/lat grid and rasterises filled (and/or line) contours to a transparent PNG. The result is meant to be added to a Plotly map as an image layer.

Returns:

{"image": "data:image/png;base64,...", "coordinates": [...], "vmin": float, "vmax": float} (coordinates are the TL, TR, BR, BL [lon, lat] corners), or None when it cannot be built.

Return type:

dict | None

Parameters:
pycsamt.map.overlays.interpolate_overlay_grid(x, y, values, *, grid_size=80, method='linear')[source]#

Interpolate scattered values to a regular grid.

Parameters:
Return type:

tuple[ndarray, ndarray, ndarray]

pycsamt.map.overlays.build_topography_overlay(x, y, elevation, *, opacity=0.7, colorscale='Earth')[source]#

Build a Plotly 3-D terrain mesh or surface.

Parameters:
Return type:

Any

pycsamt.map.overlays.build_station_label_overlay(x, y, labels, *, geo=False, name='Station labels', color='#111827')[source]#

Build a reusable station-label overlay trace.

Parameters:
Return type:

Any

pycsamt.map.overlays.build_profile_line_overlay(x, y, *, geo=False, name='Profile', color='#2563eb', width=2.0)[source]#

Build a reusable profile-line overlay trace.

Parameters:
Return type:

Any

pycsamt.map.overlays.build_basemap_layout(lon, lat, *, dark=False, style=None, bearing=0.0)[source]#

Return layout settings for geographic station maps.

Parameters:
Return type:

BasemapConfig

pycsamt.map.overlays.default_basemap(dark=False)[source]#

Return a default public tile style.

Parameters:

dark (bool)

Return type:

str

pycsamt.map.overlays.auto_map_zoom(lon, lat)[source]#

Estimate a reasonable Plotly map zoom.

Parameters:
Return type:

int

Figure export helpers for pycsamt.map.

pycsamt.map.export.write_html(fig, path, **kwargs)[source]#

Write a Plotly-like figure to HTML.

Parameters:
Return type:

Path

pycsamt.map.export.write_image(fig, path, **kwargs)[source]#

Write a Plotly-like image.

Parameters:
Return type:

Path

pycsamt.map.export.save_png(fig, path, **kwargs)[source]#

Save a Matplotlib-like or Plotly-like figure as PNG.

Parameters:
Return type:

Path

pycsamt.map.export.export_figure(fig, options)[source]#

Export fig according to options.

Parameters:
Return type:

Path

pycsamt.map.export.write_json(fig, path)[source]#

Write a Plotly-like figure specification as JSON.

Parameters:
Return type:

Path

pycsamt.map.export.write_dict(fig, path)[source]#

Write a figure dictionary as JSON text.

Parameters:
Return type:

Path

pycsamt.map.export.figure_to_dict(fig)[source]#

Return a serializable figure dictionary.

Parameters:

fig (Any)

Return type:

dict[str, Any]