Professional Documents
Culture Documents
Pyres: A Python Wrapper For Electrical Resistivity Modeling With R2
Pyres: A Python Wrapper For Electrical Resistivity Modeling With R2
Abstract
A Python package, pyres, was written to handle common as well as specialized input and output
tasks for the R2 electrical resistivity (ER) modeling program. Input steps including handling field
data, creating quadrilateral or triangular meshes, and data filtering allow repeatable and flexible
ER modeling within a programming environment. pyres includes non-trivial routines and
functions for locating and constraining specific known or separately-parameterized regions in
both quadrilateral and triangular meshes. Three basic examples of how to run forward and
inverse models with pyres are provided. The importance of testing mesh convergence and model
sensitivity are also addressed with higher-level examples that show how pyres can facilitate
future research-grade ER analyses.
forward or inverse model with pyres, R2 must be installed on The basic workflow for pyres follows the standard
the system, and the R2 directory must be inserted into the workflow for running R2 without Python. To run a forward
operating system’s ‘path’ either through an environmental model in R2, the finite element mesh must be defined with
variable or as part of the Python script. The most recent either node spacing information or from a pre-made mesh file,
version of R2 (R2 v3.1) was used to develop pyres, and along with the electrode combinations and their locations, an
updates to pyres are planned to allow compatibility with earth model that provides the ER structure that is to be
future releases. investigated, and numerous model options built into R2. For
339
J. Geophys. Eng. 15 (2018) 338 K M Befus
340
J. Geophys. Eng. 15 (2018) 338 K M Befus
341
J. Geophys. Eng. 15 (2018) 338 K M Befus
investigated. Alternatively, irregular quadrilateral meshes (and is included in pyres: pyres_utils.oldenburg_li_doi), other
with non-uniform column and row spaces could be tested parameters in the forward and inverse modeling steps can also
using a more constrained mesh discretization (e.g., a R2 ‘type influence the resulting synthetic data or tomogram, including the
5’ mesh). electrode configuration, noise in the measurements, and the
model parameters (Day-Lewis et al 2005). The pyres package
3.4. Sensitivity test facilitates developing extensive parameter sweeps by looping
over parameter ranges and combinations of interest, ultimately
Sensitivity tests are designed to explore how parameters running the ER model for each parameter combination. Simi-
within either inverse or forward models control the resulting larly, for planning ER surveys, the resolvability of resistive or
ER tomogram. The depth of investigation (DOI) analysis after conductive targets can be explored using deterministic or sta-
Oldenburg and Li (1999) is an example of a well-established tistical distributions of the target dimensions, line location, and
sensitivity test in the ER community using different starting depth along with varying electrode spacing.
models for the inversion to estimate how well the data con- A simple example was conducted using the error var-
strain the inverted tomogram (i.e., the sensitivity of the iance model weighting parameters, a and b, to demonstrate
result to the starting ER model). The DOI is calculated as the utility of pyres for testing the sensitivity of inverted
(Oldenburg and Li 1999): models to parameter contributions. The error variance model,
ER (x , z)1 - ER (x , z)2 var(R) is defined by (Binley 2016):
DOI = , (2 )
m1r - m 2r
var (R) = a2 + b2R 2 (3 )
where ER(x, z)i refers to the inverted ER models and mir are the
constant reference models with i=1, 2 representing two mod- with R the measured resistance values. Thus, a defines the
els. While the DOI analysis is useful and convenient to calculate offset error of the data in the units of R [Ω], and b is the
342
J. Geophys. Eng. 15 (2018) 338 K M Befus
343
J. Geophys. Eng. 15 (2018) 338 K M Befus
inversions with extremely large error parameters (a=10 Ω zone overlying saturated sediment (Befus et al 2014). Addi-
and b=0.5) resulted in rms values for the starting model tionally, towards the beginning or left side of the tomogram,
(constant half space of 100 Ω m) that could represent a the resistive layer thins and nearly the entire tomogram
solution to the inverse problem, which R2 treats as a ‘fatal’ becomes increasingly conductive for all of the inversions
error. (figure 6(a)), though the magnitude of these changes depends
Comparing the inverted ER tomograms qualitatively and on the a and b values. This decrease in ER also matches the
quantitatively can establish which error variance parameter expected hydrogeologic setting, where the low line distances
combination(s) to select for interpreting inversions and aid in approach a beach with an expected saltwater–freshwater
deciding which features in the tomogram describe the true interface in the shallow subsurface (Befus et al 2014). These
subsurface ER structure. Nearly all of the inverted tomograms three broadly shared features of the inversions suggest the
show a thin resistive layer overlying more conductive mat- subsurface can at least be separated into three distinct zones,
erial (figure 6(a)), which has been interpreted as a thin vadose the boundaries of which depend upon the choice of a and b as
344
J. Geophys. Eng. 15 (2018) 338 K M Befus
well as cut-off ER values. However, many additional features forward and inverse outputs. These tests can then supply the
could be interpreted within these broadly defined zones. For quantitative foundation for assessing uncertainty in ER
example, the wedge-like low ER values on the left side of the models, not restricted to those inverted using R2, and inform
tomogram becomes increasingly distinct once a<10−2.5 Ω their interpretation to enhance the reliability and accuracy of
and could be interpreted as a sharp freshwater–saltwater ER surveys in solving scientific and engineering problems. In
interface, whereas tomograms with a>10−2.5 Ω would the future, pyres may also include routines for managing data
suggest a more diffuse interface. Beneath the shallow resistive for the related three-dimensional ER modeling software R3t,
layer, the sporadic lobes of higher resistivity represent another and additional utilities for pre- and post-processing ER data
example of finer scale features that could be interpreted as the may be developed and added to pyres via community
inversion solves for a coarser model with lower a values. contributions.
These features may indeed have a physical cause, such as free
convection (Stevens et al 2009, Van Dam et al 2009) or
evidence of other freshwater–saltwater mixing, but they could Acknowledgments
also be artifacts of the inversion resulting from overfitting the
345
J. Geophys. Eng. 15 (2018) 338 K M Befus
Pidlisecky A, Haber E and Knight R 2007 RESINVM3D: a 3D Stevens J D, Sharp J M, Simmons C T and Fenstemaker T R 2009
resistivity inversion package Geophysics 72 H1–10 Evidence of free convection in groundwater: field-based
Pidlisecky A and Knight R 2008 FW2_5D: a MATLAB 2.5-D measurements beneath wind-tidal flats J. Hydrol. 375 394–409
electrical resistivity modeling code Comput. Geosci. 34 Van Dam R L, Simmons C T, Hyndman D W and Wood W W 2009
1645–54 Natural free convection in porous media: first field
Rücker C, Günther T and Spitzer K 2006 Three-dimensional documentation in groundwater Geophys. Res. Lett. 36 1–5
modelling and inversion of dc resistivity data incorporating Ward A S, Schmadel N M, Wondzell S M, Harman C,
topography: I. Modelling Geophys. J. Int. 166 495–505 Gooseff M N and Singha K 2016 Hydrogeomorphic controls
Sawyer A H, Zhu J, Currens J C, Atcher C and Binley A 2015 Time- on hyporheic and riparian transport in two headwater mountain
lapse electrical resistivity imaging of solute transport in a karst streams during base flow recession Water Resour. Res. 52
conduit Hydrol. Process. 29 4968–76 1479–97
346