Note
Click here to download the full example code
ERT field data with topography¶
Simple example of data measured over a slagdump demonstrating:
2D inversion with topography
geometric factor generation
topography effect
import pygimli as pg
from pygimli.physics.ert import ERTManager, createGeometricFactors
Get some example data with topography
data = pg.getExampleFile('ert/slagdump.ohm', load=True, verbose=True)
print(data)
Out:
/tmp/gimli-org/example-data/ert/slagdump.ohm
Data: Sensors: 38 data: 222, nonzero entries: ['a', 'b', 'm', 'n', 'r', 'valid']
The data file does not contain geometric factors (token field ‘k’), so we create them based on the given topography.
data['k'] = createGeometricFactors(data, numerical=True)
We initialize the ERTManager for further steps and eventually inversion.
ert = ERTManager(sr=False, useBert=True, verbose=True, debug=False)
It might be interesting to see the topography effect, i.e the ratio between the numerically computed geometry factor and the analytical formula
k0 = createGeometricFactors(data)
ert.showData(data, vals=k0/data['k'], label='Topography effect')

Out:
((<matplotlib.axes._subplots.AxesSubplot object at 0x7f4b6965d898>, <matplotlib.colorbar.Colorbar object at 0x7f4b6955f4e0>), None)
The data container has no apparent resistivities (token field ‘rhoa’) yet. We can let the Manager fix this later for us (as we now have the ‘k’ field), or we do it manually.
ert.checkData(data)
print(data)
Out:
Data: Sensors: 38 data: 222, nonzero entries: ['a', 'b', 'k', 'm', 'n', 'r', 'rhoa', 'valid']
The data container does not necessarily contain data errors data errors (token field ‘err’), requiring us to enter data errors. We can let the manager guess some defaults for us automaticly or set them manually
data['err'] = ert.estimateError(data, absoluteError=0.001, relativeError=0.03)
# or manually:
# data['err'] = data_errors # somehow
Now the data have all necessary fields (‘rhoa’, ‘err’ and ‘k’) so we can run the inversion. The inversion mesh will be created with some optional values for the parametric mesh generation.
mod = ert.invert(data, lam=10,
paraDX=0.3, paraMaxCellSize=10, paraDepth=20, quality=33.6)
Out:
fop: <pygimli.physics.ert.ertModelling.ERTModelling object at 0x7f4b6980a848>
Data transformation: <pygimli.core._pygimli_.RTransLogLU object at 0x7f4b6980a570>
Model transformation: <pygimli.core._pygimli_.RTransLog object at 0x7f4b6980a340>
min/max (data): 6.07/33.48
min/max (error): 3.00%/3.02%
min/max (start model): 10.65/10.65
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
inv.iter 2 ... chi² = 1.79 (dPhi = 81.55%) lam: 10.0
--------------------------------------------------------------------------------
inv.iter 3 ... chi² = 1.15 (dPhi = 13.02%) lam: 10.0
--------------------------------------------------------------------------------
inv.iter 4 ... chi² = 1.11 (dPhi = 0.68%) lam: 10.0
################################################################################
# Abort criteria reached: dPhi = 0.68 (< 2.0%) #
################################################################################
We can view the resulting model in the usual way.
ert.showResultAndFit()
# np.testing.assert_approx_equal(ert.inv.chi2(), 1.10883, significant=3)

Out:
<Figure size 640x480 with 6 Axes>
Or just plot the model only.
ert.showModel(mod)

Out:
(<matplotlib.axes._subplots.AxesSubplot object at 0x7f4b2dfa5d30>, <matplotlib.colorbar.Colorbar object at 0x7f4b6a986da0>)
Total running time of the script: ( 0 minutes 20.759 seconds)