pycsamt.api.interp#

Global visual controls for pycsamt.interp hydrogeophysical plots.

Centralises every colour, line-style, figure-geometry, and colourbar choice used by the five hydro-geophysical plot classes:

This module follows the same singleton + preset + context-manager pattern used by pycsamt.api.section, pycsamt.api.style, and pycsamt.api.station.

Quick start#

Apply a named preset globally:

from pycsamt.api import use_interp
use_interp("publication")           # all subsequent interp plots use it
use_interp("accessible")            # colorblind-safe palette

Temporarily override for one block:

from pycsamt.api.interp import PYCSAMT_INTERP
with PYCSAMT_INTERP.context("dark"):
    PlotHydroSection(result).plot()
    PlotTimeLapseSection(tl).plot()
# reverts automatically

Fine-tune one field:

from pycsamt.api import configure_interp
configure_interp(
    section__cmap_K="plasma",
    section__wt_color="white",
    profile__color_wt="royalblue",
)

Pass a style directly to one plot (overrides global state):

from pycsamt.api.interp import PYCSAMT_INTERP
fig = PlotHydroSection(result,
                       style=PYCSAMT_INTERP.publication).plot()

Functions

configure_interp(**kw)

Configure PYCSAMT_INTERP using dotted-path keys.

reset_interp()

Reset PYCSAMT_INTERP to package defaults.

resolve_figsize(user_figsize, style, kind)

Return the effective figure size.

resolve_profile_style(style)

Resolve a style argument to a HydroProfileStyle.

resolve_section_style(style)

Resolve a style argument to a HydroSectionStyle.

use_interp(preset)

Activate a named preset in PYCSAMT_INTERP.

Classes

HydroProfileStyle([color_wt, color_T, ...])

Visual parameters for 1-D hydrogeophysical profile plots.

HydroSectionStyle([cmap_K, cmap_Sw, ...])

Visual parameters for 2-D hydrogeophysical colour sections.

InterpStyle([section, profile, ...])

Complete visual bundle for one hydrogeophysical interpretation preset.

PyCSAMTInterp()

Package-wide visual control container for hydro-geophysical plots.

class pycsamt.api.interp.HydroSectionStyle(cmap_K='viridis', cmap_Sw='RdYlBu', cmap_phi='YlOrRd', cmap_timelapse='RdBu_r', cmap_spread='hot_r', cmap_p50='viridis', wt_color='deepskyblue', wt_lw=2.5, wt_ls='--', station_color='k', station_alpha=0.45, station_lw=0.4, cb_fraction=0.025, cb_pad=0.01, cb_fontsize=8, nan_color='0.88', cmap_crossplot='viridis', scatter_alpha=0.6, scatter_size=12.0, hs_alpha=0.12, model_curve_color='k', model_curve_ls='--', model_curve_lw=1.6, rho_curve_color='0.15', rho_fill_color='steelblue', rho_fill_alpha=0.12, zone_boundary_color='0.55', zone_boundary_ls='--', zone_label_fontsize=7)[source]#

Bases: object

Visual parameters for 2-D hydrogeophysical colour sections.

Governs PlotHydroSection, PlotTimeLapseSection, and both panels of PlotUncertaintySection.

Parameters:
  • cmap_K (str) – Colourmap for the hydraulic-conductivity K section (default 'viridis').

  • cmap_Sw (str) – Colourmap for the water-saturation Sw section ('RdYlBu').

  • cmap_phi (str) – Colourmap for the porosity φ section ('YlOrRd').

  • cmap_timelapse (str) – Diverging colourmap for Δlog₁₀ρ and ΔSw time-lapse sections ('RdBu_r').

  • cmap_spread (str) – Colourmap for uncertainty spread (CV or P90–P10) panels ('hot_r' — dark = high uncertainty).

  • cmap_p50 (str) – Colourmap for the P50 estimate panel of PlotUncertaintySection.

  • wt_color (str / float / str) – Water-table overlay: colour, line width, line style.

  • wt_lw (str / float / str) – Water-table overlay: colour, line width, line style.

  • wt_ls (str / float / str) – Water-table overlay: colour, line width, line style.

  • station_color (str / float / float) – Station-tick axvline appearance.

  • station_alpha (str / float / float) – Station-tick axvline appearance.

  • station_lw (str / float / float) – Station-tick axvline appearance.

  • cb_fraction (float / float / int) – Colourbar geometry and tick label size.

  • cb_pad (float / float / int) – Colourbar geometry and tick label size.

  • cb_fontsize (float / float / int) – Colourbar geometry and tick label size.

  • nan_color (str)

  • cmap_crossplot (str)

  • scatter_alpha (float)

  • scatter_size (float)

  • hs_alpha (float)

  • model_curve_color (str)

  • model_curve_ls (str)

  • model_curve_lw (float)

  • rho_curve_color (str)

  • rho_fill_color (str)

  • rho_fill_alpha (float)

  • zone_boundary_color (str)

  • zone_boundary_ls (str)

  • zone_label_fontsize (int)

cmap_K: str = 'viridis'#
cmap_Sw: str = 'RdYlBu'#
cmap_phi: str = 'YlOrRd'#
cmap_timelapse: str = 'RdBu_r'#
cmap_spread: str = 'hot_r'#
cmap_p50: str = 'viridis'#
wt_color: str = 'deepskyblue'#
wt_lw: float = 2.5#
wt_ls: str = '--'#
station_color: str = 'k'#
station_alpha: float = 0.45#
station_lw: float = 0.4#
cb_fraction: float = 0.025#
cb_pad: float = 0.01#
cb_fontsize: int = 8#
nan_color: str = '0.88'#
cmap_crossplot: str = 'viridis'#
scatter_alpha: float = 0.6#
scatter_size: float = 12.0#
hs_alpha: float = 0.12#
model_curve_color: str = 'k'#
model_curve_ls: str = '--'#
model_curve_lw: float = 1.6#
rho_curve_color: str = '0.15'#
rho_fill_color: str = 'steelblue'#
rho_fill_alpha: float = 0.12#
zone_boundary_color: str = '0.55'#
zone_boundary_ls: str = '--'#
zone_label_fontsize: int = 7#
cmap_for(quantity)[source]#

Return the colourmap name for quantity.

Parameters:

quantity (str) – One of 'K', 'saturation', 'porosity', 'timelapse', 'spread', 'p50'.

Return type:

str

wt_kwargs(**overrides)[source]#

Keyword arguments for the water-table ax.plot call.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

station_kwargs(**overrides)[source]#

Keyword arguments for the station-tick ax.axvline calls.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

cb_kwargs(**overrides)[source]#

Keyword arguments forwarded to fig.colorbar.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

crossplot_scatter_kwargs(**overrides)[source]#

Kwargs for the ax.scatter call in a petrophysical cross-plot.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

hs_fill_kwargs(**overrides)[source]#

Kwargs for ax.fill_between of Hashin-Shtrikman bounds.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

model_curve_kwargs(**overrides)[source]#

Kwargs for the model-curve ax.plot call.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

rho_curve_kwargs(**overrides)[source]#

Kwargs for the ρ(z) depth-profile curve.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

zone_boundary_kwargs(**overrides)[source]#

Kwargs for geological zone boundary ax.axhline calls.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

copy(**kw)[source]#

Return a shallow copy with optional field overrides.

Parameters:

kw (Any)

Return type:

HydroSectionStyle

class pycsamt.api.interp.HydroProfileStyle(color_wt='steelblue', color_T='seagreen', envelope_alpha=0.25, p50_lw=2.0, scatter_size=14.0, ref_color='tomato', ref_ls='--', ref_lw=1.4, grid_alpha=0.3, grid_axis='y', station_color='0.6', station_alpha=0.5, station_lw=0.35, color_TR='darkorange', color_S='mediumpurple', tr_threshold=1000.0, s_threshold_moderate=1.0, s_threshold_good=5.0, hist_alpha=0.7, hist_edgecolor='white', hist_bins=30, kde_color='k', kde_lw=1.8)[source]#

Bases: object

Visual parameters for 1-D hydrogeophysical profile plots.

Governs PlotWaterTableProfile and PlotUncertaintyProfile.

Parameters:
  • color_wt (str) – Colour for water-table bars/lines/envelopes ('steelblue').

  • color_T (str) – Colour for transmissivity bars/lines/envelopes ('seagreen').

  • envelope_alpha (float) – Fill-between transparency for P10–P90 bands (0–1).

  • p50_lw (float) – Line width for the P50 central estimate.

  • scatter_size (float) – Marker size for station-value scatter dots.

  • ref_color (str / str / float) – Reference-depth line style (axhline).

  • ref_ls (str / str / float) – Reference-depth line style (axhline).

  • ref_lw (str / str / float) – Reference-depth line style (axhline).

  • grid_alpha (float) – Background grid transparency.

  • grid_axis (str) – 'y', 'x', or 'both'.

  • station_color (str / float / float) – Station-tick axvline appearance.

  • station_alpha (str / float / float) – Station-tick axvline appearance.

  • station_lw (str / float / float) – Station-tick axvline appearance.

  • color_TR (str)

  • color_S (str)

  • tr_threshold (float)

  • s_threshold_moderate (float)

  • s_threshold_good (float)

  • hist_alpha (float)

  • hist_edgecolor (str)

  • hist_bins (int)

  • kde_color (str)

  • kde_lw (float)

color_wt: str = 'steelblue'#
color_T: str = 'seagreen'#
envelope_alpha: float = 0.25#
p50_lw: float = 2.0#
scatter_size: float = 14.0#
ref_color: str = 'tomato'#
ref_ls: str = '--'#
ref_lw: float = 1.4#
grid_alpha: float = 0.3#
grid_axis: str = 'y'#
station_color: str = '0.6'#
station_alpha: float = 0.5#
station_lw: float = 0.35#
color_TR: str = 'darkorange'#
color_S: str = 'mediumpurple'#
tr_threshold: float = 1000.0#
s_threshold_moderate: float = 1.0#
s_threshold_good: float = 5.0#
hist_alpha: float = 0.7#
hist_edgecolor: str = 'white'#
hist_bins: int = 30#
kde_color: str = 'k'#
kde_lw: float = 1.8#
envelope_kwargs(color, **overrides)[source]#

Keyword arguments for ax.fill_between (uncertainty band).

Parameters:
Return type:

dict[str, Any]

line_kwargs(color, **overrides)[source]#

Keyword arguments for ax.plot (P50 central line).

Parameters:
Return type:

dict[str, Any]

scatter_kwargs(color, **overrides)[source]#

Keyword arguments for ax.scatter.

Parameters:
Return type:

dict[str, Any]

ref_kwargs(**overrides)[source]#

Keyword arguments for the reference-depth ax.axhline call.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

station_kwargs(**overrides)[source]#

Keyword arguments for station-tick ax.axvline calls.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

grid_kwargs()[source]#

Keyword arguments for ax.grid.

Return type:

dict[str, Any]

bar_kwargs(color, **overrides)[source]#

Kwargs for Dar-Zarrouk bar charts.

Parameters:
Return type:

dict[str, Any]

hist_kwargs(color, **overrides)[source]#

Kwargs for ax.hist in uncertainty histograms.

Parameters:
Return type:

dict[str, Any]

kde_kwargs(**overrides)[source]#

Kwargs for the KDE curve ax.plot call.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

copy(**kw)[source]#

Return a shallow copy with optional field overrides.

Parameters:

kw (Any)

Return type:

HydroProfileStyle

class pycsamt.api.interp.InterpStyle(section=<factory>, profile=<factory>, figsize_section=(13.0, 5.0), figsize_profile=(13.0, 6.0), figsize_uncertainty=(13.0, 8.0), figsize_crossplot=(7.0, 5.5), figsize_depth_profile=(4.5, 9.0), figsize_aquifer_char=(13.0, 9.0), figsize_tl_panel=(3.5, 4.5))[source]#

Bases: object

Complete visual bundle for one hydrogeophysical interpretation preset.

Parameters:
  • section (HydroSectionStyle) – Controls all 2-D colour-section plots.

  • profile (HydroProfileStyle) – Controls all 1-D profile plots.

  • figsize_section (tuple) – Default figure size (width, height) for single-panel 2-D sections.

  • figsize_profile (tuple) – Default figure size for 2-panel 1-D profile plots.

  • figsize_uncertainty (tuple) – Default figure size for 2-panel uncertainty sections.

  • figsize_crossplot (tuple[float, float])

  • figsize_depth_profile (tuple[float, float])

  • figsize_aquifer_char (tuple[float, float])

  • figsize_tl_panel (tuple[float, float])

section: HydroSectionStyle#
profile: HydroProfileStyle#
figsize_section: tuple[float, float] = (13.0, 5.0)#
figsize_profile: tuple[float, float] = (13.0, 6.0)#
figsize_uncertainty: tuple[float, float] = (13.0, 8.0)#
figsize_crossplot: tuple[float, float] = (7.0, 5.5)#
figsize_depth_profile: tuple[float, float] = (4.5, 9.0)#
figsize_aquifer_char: tuple[float, float] = (13.0, 9.0)#
figsize_tl_panel: tuple[float, float] = (3.5, 4.5)#
copy(**kw)[source]#

Return a deep copy with optional top-level field overrides.

Parameters:

kw (Any)

Return type:

InterpStyle

class pycsamt.api.interp.PyCSAMTInterp[source]#

Bases: object

Package-wide visual control container for hydro-geophysical plots.

Holds one InterpStyle per named preset. The default preset is what plot classes use when no explicit style= argument is given.

Examples

>>> from pycsamt.api.interp import PYCSAMT_INTERP
>>> PYCSAMT_INTERP.use("publication")
>>> # now all subsequent interp plots use the publication style
>>> with PYCSAMT_INTERP.context("dark"):
...     fig = PlotHydroSection(result).plot()
>>> # reverts
style_for(preset)[source]#

Return the InterpStyle for preset.

Parameters:

preset (str) – One of 'default', 'publication', 'dark', 'accessible'.

Return type:

InterpStyle

use(preset)[source]#

Copy a named preset into the default slot.

After this call, all plot classes that read from PYCSAMT_INTERP will use the chosen preset’s styles.

Parameters:

preset (str) – Name of the preset to activate.

Return type:

None

configure(**kw)[source]#

Configure the default style using sub__field dotted paths.

Examples

>>> PYCSAMT_INTERP.configure(
...     section__cmap_K="plasma",
...     section__wt_color="white",
...     profile__color_wt="royalblue",
...     figsize_section=(10, 4),
... )
Parameters:

kw (Any)

Return type:

None

reset()[source]#

Reset all presets to package defaults.

Return type:

None

context(preset=None, **kw)[source]#

Temporarily override the default style, then restore it.

Parameters:
  • preset (str, optional) – Named preset to activate for the duration of the block.

  • **kw – Additional dotted-path overrides applied after the preset (same semantics as configure()).

Return type:

Generator[PyCSAMTInterp, None, None]

Examples

>>> with PYCSAMT_INTERP.context("publication",
...                             section__wt_lw=0.8):
...     fig = PlotHydroSection(result).plot()
summary()[source]#

Return a human-readable summary of all presets.

Return type:

str

pycsamt.api.interp.configure_interp(**kw)[source]#

Configure PYCSAMT_INTERP using dotted-path keys.

Equivalent to PYCSAMT_INTERP.configure(**kw).

Parameters:

kw (Any)

Return type:

None

pycsamt.api.interp.reset_interp()[source]#

Reset PYCSAMT_INTERP to package defaults.

Return type:

None

pycsamt.api.interp.use_interp(preset)[source]#

Activate a named preset in PYCSAMT_INTERP.

Parameters:

preset (str) – One of 'default', 'publication', 'dark', 'accessible'.

Return type:

None