PyHydroGeophysX.Geophy_modular package
Submodules
PyHydroGeophysX.Geophy_modular.ERT_to_WC module
Module for converting Electrical Resistivity Tomography (ERT) resistivity models to volumetric water content, incorporating structural information (geological layers) and quantifying uncertainty using Monte Carlo simulations.
This module provides the ERTtoWC class, which takes ERT resistivity data, a corresponding mesh, cell markers identifying different layers, and optional coverage information. It allows users to define petrophysical parameter distributions (saturated resistivity rhos, saturation exponent n, surface conductivity sigma_sur, and porosity φ) for each layer. The core functionality involves running Monte Carlo simulations to sample these parameters and convert resistivity to water content for each realization, thereby providing a distribution of possible water content values. Statistics (mean, std, percentiles) can then be calculated from these distributions. The module also includes utilities for plotting results and extracting time series.
- class PyHydroGeophysX.Geophy_modular.ERT_to_WC.ERTtoWC(mesh: pygimli.Mesh, resistivity_values: ndarray, cell_markers: ndarray, coverage: ndarray | None = None)[source]
Bases:
objectClass for converting ERT resistivity models to water content.
- extract_time_series(positions: List[Tuple[float, float]]) Tuple[ndarray, List[int]][source]
Extract time series at specific positions.
- plot_water_content(time_idx: int = 0, ax=None, cmap: str = 'jet', cmin: float = 0.0, cmax: float = 0.32, coverage_threshold: float | None = None)[source]
Plot water content for a specific time step.
- run_monte_carlo(n_realizations: int = 100, progress_bar: bool = True) Tuple[source]
Run Monte Carlo simulation for uncertainty quantification.
- Parameters:
n_realizations – Number of Monte Carlo realizations
progress_bar – Whether to show progress bar
- Returns:
Tuple of (water_content_all, saturation_all, params_used)
PyHydroGeophysX.Geophy_modular.seismic_processor module
Seismic data processing module for structure identification.
- PyHydroGeophysX.Geophy_modular.seismic_processor.extract_velocity_structure(mesh, velocity_data, threshold=1200, interval=4.0)[source]
Extract structure interface from velocity model at the specified threshold.
- Parameters:
mesh – PyGIMLi mesh
velocity_data – Velocity values for each cell
threshold – Velocity threshold defining interface (default: 1200)
interval – Horizontal sampling interval (default: 4.0)
- Returns:
Horizontal coordinates of interface points z_coords: Vertical coordinates of interface points interface_data: Dictionary with interface information
- Return type:
x_coords
- PyHydroGeophysX.Geophy_modular.seismic_processor.process_seismic_tomography(ttData, mesh=None, **kwargs)[source]
Process seismic tomography data and perform inversion.
- Parameters:
ttData – Travel time data container
mesh – Mesh for inversion (optional, created if None)
**kwargs – Additional parameters including: - lam: Regularization parameter (default: 50) - zWeight: Vertical regularization weight (default: 0.2) - vTop: Top velocity constraint (default: 500) - vBottom: Bottom velocity constraint (default: 5000) - quality: Mesh quality if creating new mesh (default: 31) - paraDepth: Maximum depth for parametric domain (default: 30) - verbose: Verbosity level (default: 1)
- Returns:
TravelTimeManager object with inversion results
- PyHydroGeophysX.Geophy_modular.seismic_processor.save_velocity_structure(filename, x_coords, z_coords, interface_data=None)[source]
Save velocity structure data to file.
- Parameters:
filename – Output filename
x_coords – X coordinates of interface
z_coords – Z coordinates of interface
interface_data – Additional data to save (optional)
- PyHydroGeophysX.Geophy_modular.seismic_processor.seismic_velocity_classifier(velocity_data, mesh, threshold=1200)[source]
Classify mesh cells based on velocity threshold.
- Parameters:
velocity_data – Velocity values for each cell
mesh – PyGIMLi mesh
threshold – Velocity threshold for classification (default: 1200)
- Returns:
below threshold, 2: above threshold)
- Return type:
Array of cell markers (1
PyHydroGeophysX.Geophy_modular.structure_integration module
Structure integration module for constrained geophysical inversion.
- PyHydroGeophysX.Geophy_modular.structure_integration.create_ert_mesh_with_structure(ertData, interface_data, **kwargs)[source]
Create ERT mesh with structure interface for constrained inversion.
- Parameters:
ertData – PyGIMLi ERT data container
interface_data – Interface data (can be a tuple of (x, z) or a dictionary with smooth_x, smooth_z)
**kwargs – Additional parameters including: - paraBoundary: Extra boundary size (default: 2) - quality: Mesh quality parameter (default: 28) - paraMaxCellSize: Maximum cell size (default: 30) - paraDepth: Maximum depth (default: 30.0)
- Returns:
Mesh with interface structure markers: Cell markers array regions: Dictionary with region definitions
- Return type:
meshafter
- PyHydroGeophysX.Geophy_modular.structure_integration.create_joint_inversion_mesh(ertData, ttData, velocity_threshold=1200, **kwargs)[source]
Create a mesh for joint ERT-seismic inversion by first inverting seismic data, extracting the velocity interface, and then creating a constrained ERT mesh.
- Parameters:
ertData – PyGIMLi ERT data container
ttData – PyGIMLi seismic travel time data container
velocity_threshold – Threshold for velocity interface (default: 1200)
**kwargs – Additional parameters including: - seismic_params: Dictionary of seismic inversion parameters - mesh_params: Dictionary of mesh generation parameters
- Returns:
Mesh suitable for constrained joint inversion seismic_manager: TravelTimeManager with seismic inversion results structure_data: Structure interface data
- Return type:
joint_mesh
- PyHydroGeophysX.Geophy_modular.structure_integration.integrate_velocity_interface(ertData, smooth_x, smooth_z, paraBoundary=2, quality=28, paraMaxCellSize=30, paraDepth=30.0)[source]
Integrate velocity interface into mesh for constrained ERT inversion.
- Parameters:
ertData – PyGIMLi ERT data container
smooth_x – X coordinates of velocity interface
smooth_z – Z coordinates of velocity interface
paraBoundary – Extra boundary size (default: 2)
quality – Mesh quality parameter (default: 28)
paraMaxCellSize – Maximum cell size (default: 30)
paraDepth – Maximum depth of the model (default: 30.0)
- Returns:
Cell markers array meshafter: Mesh with interface structure
- Return type:
markers
Module contents
Geophysical data processing module for watershed monitoring.
- class PyHydroGeophysX.Geophy_modular.ERTtoWC(mesh: pygimli.Mesh, resistivity_values: ndarray, cell_markers: ndarray, coverage: ndarray | None = None)[source]
Bases:
objectClass for converting ERT resistivity models to water content.
- extract_time_series(positions: List[Tuple[float, float]]) Tuple[ndarray, List[int]][source]
Extract time series at specific positions.
- plot_water_content(time_idx: int = 0, ax=None, cmap: str = 'jet', cmin: float = 0.0, cmax: float = 0.32, coverage_threshold: float | None = None)[source]
Plot water content for a specific time step.
- run_monte_carlo(n_realizations: int = 100, progress_bar: bool = True) Tuple[source]
Run Monte Carlo simulation for uncertainty quantification.
- Parameters:
n_realizations – Number of Monte Carlo realizations
progress_bar – Whether to show progress bar
- Returns:
Tuple of (water_content_all, saturation_all, params_used)
- PyHydroGeophysX.Geophy_modular.create_ert_mesh_with_structure(ertData, interface_data, **kwargs)[source]
Create ERT mesh with structure interface for constrained inversion.
- Parameters:
ertData – PyGIMLi ERT data container
interface_data – Interface data (can be a tuple of (x, z) or a dictionary with smooth_x, smooth_z)
**kwargs – Additional parameters including: - paraBoundary: Extra boundary size (default: 2) - quality: Mesh quality parameter (default: 28) - paraMaxCellSize: Maximum cell size (default: 30) - paraDepth: Maximum depth (default: 30.0)
- Returns:
Mesh with interface structure markers: Cell markers array regions: Dictionary with region definitions
- Return type:
meshafter
- PyHydroGeophysX.Geophy_modular.create_joint_inversion_mesh(ertData, ttData, velocity_threshold=1200, **kwargs)[source]
Create a mesh for joint ERT-seismic inversion by first inverting seismic data, extracting the velocity interface, and then creating a constrained ERT mesh.
- Parameters:
ertData – PyGIMLi ERT data container
ttData – PyGIMLi seismic travel time data container
velocity_threshold – Threshold for velocity interface (default: 1200)
**kwargs – Additional parameters including: - seismic_params: Dictionary of seismic inversion parameters - mesh_params: Dictionary of mesh generation parameters
- Returns:
Mesh suitable for constrained joint inversion seismic_manager: TravelTimeManager with seismic inversion results structure_data: Structure interface data
- Return type:
joint_mesh
- PyHydroGeophysX.Geophy_modular.extract_velocity_structure(mesh, velocity_data, threshold=1200, interval=4.0)[source]
Extract structure interface from velocity model at the specified threshold.
- Parameters:
mesh – PyGIMLi mesh
velocity_data – Velocity values for each cell
threshold – Velocity threshold defining interface (default: 1200)
interval – Horizontal sampling interval (default: 4.0)
- Returns:
Horizontal coordinates of interface points z_coords: Vertical coordinates of interface points interface_data: Dictionary with interface information
- Return type:
x_coords
- PyHydroGeophysX.Geophy_modular.integrate_velocity_interface(ertData, smooth_x, smooth_z, paraBoundary=2, quality=28, paraMaxCellSize=30, paraDepth=30.0)[source]
Integrate velocity interface into mesh for constrained ERT inversion.
- Parameters:
ertData – PyGIMLi ERT data container
smooth_x – X coordinates of velocity interface
smooth_z – Z coordinates of velocity interface
paraBoundary – Extra boundary size (default: 2)
quality – Mesh quality parameter (default: 28)
paraMaxCellSize – Maximum cell size (default: 30)
paraDepth – Maximum depth of the model (default: 30.0)
- Returns:
Cell markers array meshafter: Mesh with interface structure
- Return type:
markers
- PyHydroGeophysX.Geophy_modular.plot_time_series(time_steps: ndarray, time_series_data: ndarray, true_values: ndarray | None = None, labels: List[str] | None = None, colors: List[str] | None = None, output_file: str | None = None)[source]
Plot time series with uncertainty bands.
- PyHydroGeophysX.Geophy_modular.process_seismic_tomography(ttData, mesh=None, **kwargs)[source]
Process seismic tomography data and perform inversion.
- Parameters:
ttData – Travel time data container
mesh – Mesh for inversion (optional, created if None)
**kwargs – Additional parameters including: - lam: Regularization parameter (default: 50) - zWeight: Vertical regularization weight (default: 0.2) - vTop: Top velocity constraint (default: 500) - vBottom: Bottom velocity constraint (default: 5000) - quality: Mesh quality if creating new mesh (default: 31) - paraDepth: Maximum depth for parametric domain (default: 30) - verbose: Verbosity level (default: 1)
- Returns:
TravelTimeManager object with inversion results
- PyHydroGeophysX.Geophy_modular.seismic_velocity_classifier(velocity_data, mesh, threshold=1200)[source]
Classify mesh cells based on velocity threshold.
- Parameters:
velocity_data – Velocity values for each cell
mesh – PyGIMLi mesh
threshold – Velocity threshold for classification (default: 1200)
- Returns:
below threshold, 2: above threshold)
- Return type:
Array of cell markers (1