
Overview¶
pyGeoPressure
is an open source Python package for pore pressure prediction using well log data and seismic velocity data.
Features¶
Overburden (or Lithostatic) Pressure Calculation
Eaton’s method and Parameter Optimization
Bowers’ method and Parameter Optimization
Multivariate method and Parameter Optimization
Contribute¶
Source Code: https://github.com/whimian/pyGeoPressure
Issue Tracker: https://github.com/whimian/pyGeoPressure/issues
Documentation Structure¶
Getting Started (thorough introduction and installation instructions)
Tutorials (walkthrough of main features using example survey)
How-to (topic guides)
References (inner workings)
Contents¶
Introduction¶
Pore pressure (geopressure) is of great importance in different stages of oil and gas (hydrocarbon) exploration and development. Predicted regional pressure data can help with:
well planning
Preventing hazards like kicks and blowouts.
building geomechanical model
anaylizing hydrocarbon distribution
Pore pressure prediction is to use geophyical and petrophysical properties (like velocity, resistivity) measured or calculated to evaluate pore pressure underground instead of measuring pressure directly which is expensive and can only be done after a well is drilled. Usually pore pressure prediction is performed with well logging data after exploration wells are drilled and cemented, and with seismic velocity data for regional pore pressure prediction.
pyGeoPressure
is an open source python package designed for pore pressure prediction
with both well log data and seismic velocity data.
Though lightweighted, pyGeoPressure
is able to perform whole workflow from data management to pressure prediction.
The main features of pyGeoPressure
are:
Overburden (or Lithostatic) Pressure Calculation (Tutorials: OBP calculation for well, OBP calculation for seismic)
Eaton’s method and Parameter Optimization (Tutorials: Eaton for well, Eaton for seismic)
Bowers’ method and Parameter Optimization (Tutorials: Bowers for well, Bowers for seismic)
Multivariate method and Parameter Optimization (Tutorials: Multivariate for well)
Aside from main prediction features, pyGeoPressrue
provides other functionalities to facilitate the workflow:
Survey definition
Data Management
Well log data processing
Generating figures
Installation¶
Denpendencies¶
pyGeoPressure
supports both Python 2.7 and Python 3.6 and some of mainly
dependent packages are:
NumPy
SciPy
matplotlib
Jupyter
segyio
Installing Python¶
The recommended way to intall Python is to use conda package manager from Anaconda Inc. You may download and install Miniconda from https://conda.io/miniconda which contains both Python and conda package manager.
Installing pyGeoPressure¶
pyGeoPressure
is recommended to be installed in a seperate python environment
which can be easily created with conda
. So first create a new environment with
conda
. The new environment should have pip
installed.
conda update conda
conda create -n ENV python=3.6 pip
or
conda update conda
conda create -n ENV python=2.7 pip
if using Python 2.7.
Install from pyPI
¶
pyGeoPressure
is on PyPI
, so run the following command to install
pyGeoPressure
from pypi
.
pip install pygeopressure
For Developers¶
Clone the github repo:
git clone https://github.com/whimian/pyGeoPressure.git
Setup the development environment with conda
:
conda env create --file test/test_env_2.yml
or
conda env create --file test/test_env_3.yml
The testing framework used is pytest
. To run all tests, just run the
following code at project directory:
pytest --cov
Overview¶
Note
The following tutorials are created with a set of jupyter notebooks, users may download these notebooks (Download) and the example survey (Download), and run these notebooks locally.
OBP calculation for well¶
OBP calculation include the following step:
Extrapolate density log to the surface
Calculate Overburden Pressure
Calculate Hydrostatic Pressrue (*)
[2]:
from __future__ import print_function, division, unicode_literals
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use(['seaborn-paper', 'seaborn-whitegrid'])
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
import numpy as np
import pygeopressure as ppp
1. Extrapolate density log to the surface¶
Create survey with the example survey CUG
:
[18]:
# set to the directory on your computer
SURVEY_FOLDER = "M:/CUG_depth"
survey = ppp.Survey(SURVEY_FOLDER)
Retrieve well CUG1
:
[4]:
well_cug1 = survey.wells['CUG1']
Get density log:
[5]:
den_log = well_cug1.get_log("Density")
View density log:
[6]:
fig_den, ax_den = plt.subplots()
ax_den.invert_yaxis()
den_log.plot(ax_den)
# set style
ax_den.set(ylim=(5000,0), aspect=(1.2/5000)*2)
fig_den.set_figheight(8)
fig_den.show()

Find optimized coefficients for Traugott equation:
[7]:
a, b = ppp.optimize_traugott(
den_log, 2000, 3000, kb=well_cug1.kelly_bushing, wd=well_cug1.water_depth)
View fitted density trend:
[8]:
fig_den, ax_den = plt.subplots()
ax_den.invert_yaxis()
# draw density log
den_log.plot(ax_den, label='Density')
# draw fitted density trend line
den_trend = ppp.traugott_trend(
np.array(den_log.depth), a, b,
kb=well_cug1.kelly_bushing, wd=well_cug1.water_depth)
ax_den.plot(den_trend, den_log.depth,
color='r', linestyle='--', zorder=2, label='Trend')
# set style
ax_den.set(ylim=(5000,0), aspect=(1.2/5000)*2)
ax_den.legend()
fig_den.set_figheight(8)
fig_den.show()

Since we will extrapolate density to mudline (sea bottom), density values of the inverval from mudline to kelly bushing will be NaN (See figure above).
Also, the actual variation of rock density underground doesnot have such high frequency as density logging data, so we need to perform some filtering and smoothing of the original signal.
Density log processing (filtering and smoothing):
[9]:
den_log_filter = ppp.upscale_log(den_log, freq=20)
den_log_filter_smooth = ppp.smooth_log(den_log_filter, window=1501)
View processed log data:
[10]:
fig_den, ax_den = plt.subplots()
ax_den.invert_yaxis()
# draw density log
den_log.plot(ax_den, label='Density')
# draw fitted density trend line
ax_den.plot(den_trend, den_log.depth,
color='r', linestyle='--', zorder=2, label='Trend')
# draw processed density log
ax_den.plot(den_log_filter_smooth.data, den_log_filter_smooth.depth,
color='g', zorder=3, label='Smoothed')
# set style
ax_den.set(ylim=(5000,0), aspect=(1.2/5000)*2)
ax_den.legend()
fig_den.set_figheight(8)
fig_den.show()

Extrapolate processed density log with fitted trend:
[11]:
extra_log = ppp.extrapolate_log_traugott(
den_log_filter_smooth, a, b,
kb=well_cug1.kelly_bushing, wd=well_cug1.water_depth)
View extraploted density log:
[12]:
fig_den, ax_den = plt.subplots()
ax_den.invert_yaxis()
# draw density log
den_log.plot(ax_den, label='Density')
# draw trend line
ax_den.plot(den_trend, den_log.depth,
color='r', linestyle='--', zorder=2, label='Trend')
# draw processed density log
ax_den.plot(den_log_filter_smooth.data, den_log_filter_smooth.depth,
color='g', zorder=3, label='Smoothed')
# draw extrapolated density
ax_den.plot(extra_log.data, extra_log.depth,
color='b', zorder=4, label='Extrapolated')
# set style
ax_den.set(ylim=(5000,0), aspect=(1.2/5000)*2)
fig_den.set_figheight(8)
fig_den.show()

The extrapolated log (blue line in the figure above) is used for calculation of Overburden Pressure.
2. Calculation of Overburden Pressure¶
[13]:
obp_log = ppp.obp_well(extra_log,
kb=well_cug1.kelly_bushing, wd=well_cug1.water_depth,
rho_w=1.01)
* Calculation of Hydrostatic Pressure¶
Since parameters used for hydrostatic pressrue calcualtion like kelly busshing and water depth are store in Well, so we add a shortcut for hydrostatic pressure calculation in Well.
[14]:
# hydro_log = ppp.hydrostatic_well(
# obp_log.depth, kb=well_cug1.kelly_bushing, wd=well_cug1.water_depth,
# rho_f=1., rho_w=1.)
hydro_log = well_cug1.hydro_log()
View calcualted overburden pressure:
[15]:
fig_obp, ax_obp = plt.subplots()
ax_obp.invert_yaxis()
hydro_log.plot(ax_obp, color='g', linestyle='--', label='Hydrostatic')
obp_log.plot(ax_obp, color='b', label='OBP')
# set style
ax_obp.set(ylim=(5000,0), aspect=(100/5000)*2)
ax_obp.legend()
fig_obp.set_figheight(8)
fig_obp.show()

Save calculated Overburden Pressure:
[16]:
# well_cug1.add_log("Overbuden_Pressure")
optional, calculated overburden pressure has already been saved, so users don’t need to run these notebooks in specific order.
Eaton method with well log¶
Pore pressure prediction with Eaton’s method using well log data.
Steps:
Calculate Velocity Normal Compaction Trend
Optimize for Eaton’s exponent n
Predict pore pressure using Eaton’s method
[2]:
from __future__ import print_function, division, unicode_literals
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use(['seaborn-paper', 'seaborn-whitegrid'])
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
import numpy as np
import pygeopressure as ppp
1. Calculate Velocity Normal Compaction Trend¶
Create survey with the example survey CUG
:
[3]:
# set to the directory on your computer
SURVEY_FOLDER = "C:/Users/yuhao/Desktop/CUG_depth"
survey = ppp.Survey(SURVEY_FOLDER)
Retrieve well CUG1
:
[4]:
well_cug1 = survey.wells['CUG1']
Get velocity log:
[5]:
vel_log = well_cug1.get_log("Velocity")
View velocity log:
[6]:
fig_vel, ax_vel = plt.subplots()
ax_vel.invert_yaxis()
vel_log.plot(ax_vel)
well_cug1.plot_horizons(ax_vel)
# set fig style
ax_vel.set(ylim=(5000,0), aspect=(5000/4600)*2)
ax_vel.set_aspect(2)
fig_vel.set_figheight(8)

Optimize for NCT coefficients a, b:
well.params['horizon']['T20']
returns the depth of horizon T20.
[7]:
a, b = ppp.optimize_nct(
vel_log=well_cug1.get_log("Velocity"),
fit_start=well_cug1.params['horizon']["T16"],
fit_stop=well_cug1.params['horizon']["T20"])
And use a, b to calculate normal velocity trend
[8]:
from pygeopressure.velocity.extrapolate import normal_log
nct_log = normal_log(vel_log, a=a, b=b)
View fitted NCT:
[9]:
fig_vel, ax_vel = plt.subplots()
ax_vel.invert_yaxis()
# plot velocity
vel_log.plot(ax_vel, label='Velocity')
# plot horizon
well_cug1.plot_horizons(ax_vel)
# plot fitted nct
nct_log.plot(ax_vel, color='r', zorder=2, label='NCT')
# set fig style
ax_vel.set(ylim=(5000,0), aspect=(5000/4600)*2)
ax_vel.set_aspect(2)
ax_vel.legend()
fig_vel.set_figheight(8)

Save fitted nct:
[10]:
# well_cug1.params['nct'] = {"a": a, "b": b}
# well_cug1.save_params()
2. Optimize for Eaton’s exponent n¶
First, we need to preprocess velocity.
Velocity log processing (filtering and smoothing):
[11]:
vel_log_filter = ppp.upscale_log(vel_log, freq=20)
vel_log_filter_smooth = ppp.smooth_log(vel_log_filter, window=1501)
Veiw processed velocity:
[12]:
fig_vel, ax_vel = plt.subplots()
ax_vel.invert_yaxis()
# plot velocity
vel_log.plot(ax_vel, label='Velocity')
# plot horizon
well_cug1.plot_horizons(ax_vel)
# plot processed velocity
vel_log_filter_smooth.plot(ax_vel, color='g', zorder=2, label='Processed', linewidth=1)
# set fig style
ax_vel.set(ylim=(5000,0), aspect=(5000/4600)*2)
ax_vel.set_aspect(2)
ax_vel.legend()
fig_vel.set_figheight(8)

We will use the processed velocity data for pressure prediction.
Optimize Eaton’s exponential n
:
[13]:
n = ppp.optimize_eaton(
well=well_cug1,
vel_log=vel_log_filter_smooth,
obp_log="Overburden_Pressure",
a=a, b=b)
See the RMS error variation with n
:
[14]:
from pygeopressure.basic.plots import plot_eaton_error
fig_err, ax_err = plt.subplots()
plot_eaton_error(
ax=ax_err,
well=well_cug1,
vel_log=vel_log_filter_smooth,
obp_log="Overburden_Pressure",
a=a, b=b)

Save optimized n:
[15]:
# well_cug1.params['nct'] = {"a": a, "b": b}
# well_cug1.save_params()
3.Predict pore pressure using Eaton’s method¶
Calculate pore pressure using Eaton’s method requires velocity, Eaton’s exponential, normal velocity, hydrostatic pressure and overburden pressure.
Well.eaton()
will try to read saved data, users only need to specify them when they are different from the saved ones.
[16]:
pres_eaton_log = well_cug1.eaton(vel_log_filter_smooth, n=n)
View predicted pressure:
[17]:
fig_pres, ax_pres = plt.subplots()
ax_pres.invert_yaxis()
well_cug1.get_log("Overburden_Pressure").plot(ax_pres, 'g', label='Lithostatic')
ax_pres.plot(well_cug1.hydrostatic, well_cug1.depth, 'g', linestyle='--', label="Hydrostatic")
pres_eaton_log.plot(ax_pres, color='blue', label='Pressure_Eaton')
well_cug1.plot_horizons(ax_pres)
# set figure and axis size
ax_pres.set_aspect(2/50)
ax_pres.legend()
fig_pres.set_figheight(8)

Bowers method with well log¶
Pore pressure prediction with Bowers’ method using well log data.
Predicton of geopressure using Bowers’ model needs the following steps:
determine Bowers loading equation coefficients A and B
determine Bowers unloading equation coefficients \(V_{max}\) and U
Pressure Prediction
[2]:
from __future__ import print_function, division, unicode_literals
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use(['seaborn-paper', 'seaborn-whitegrid'])
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
import numpy as np
import pygeopressure as ppp
1. determine Bowers loading equation coefficients A and B¶
Create survey with the example survey CUG
:
[3]:
# set to the directory on your computer
SURVEY_FOLDER = "M:/CUG_depth"
survey = ppp.Survey(SURVEY_FOLDER)
Retrieve well CUG1
:
[4]:
well_cug1 = survey.wells['CUG1']
Get velocity log:
[5]:
vel_log = well_cug1.get_log("Velocity")
Preprocessing velocity data
[6]:
vel_log_filter = ppp.upscale_log(vel_log, freq=20)
vel_log_filter_smooth = ppp.smooth_log(vel_log_filter, window=1501)
View velocity and processed velocity
[7]:
fig_vel, ax_vel = plt.subplots()
ax_vel.invert_yaxis()
# plot velocity
vel_log.plot(ax_vel, label='Velocity')
# plot horizon
well_cug1.plot_horizons(ax_vel)
# plot processed velocity
vel_log_filter_smooth.plot(ax_vel, color='g', zorder=2, label='Processed', linewidth=1)
# set fig style
ax_vel.set(ylim=(5000,0), aspect=(4600/5000)*2)
ax_vel.legend()
fig_vel.set_figheight(8)

Optimize for Bowers’ loading equation coefficients A, B:
[8]:
a, b, err = ppp.optimize_bowers_virgin(
well=well_cug1,
vel_log=vel_log_filter_smooth,
obp_log='Overburden_Pressure',
upper='T12',
lower='T20',
pres_log='loading',
mode='both')
Plot optimized virgin curve:
[9]:
fig_bowers, ax_bowers = plt.subplots()
ppp.plot_bowers_vrigin(
ax=ax_bowers,
well=well_cug1,
a=a,
b=b,
vel_log=vel_log_filter_smooth,
obp_log='Overburden_Pressure',
upper='T12',
lower='T20',
pres_log='loading',
mode='both')

2. determine Bowers unloading equation coefficients \(V_{max}\) and U¶
After manually select paramter U, optimze for parameter U:
[10]:
u = ppp.optimize_bowers_unloading(
well=well_cug1,
vel_log=vel_log_filter_smooth,
obp_log='Overburden_Pressure',
a=a,
b=b,
vmax=4600,
pres_log='unloading')
Draw unloading curve and virgin curve together with optimized parameters:
[11]:
fig_bowers, ax_bowers = plt.subplots()
# draw virgin(loading) curve
ppp.plot_bowers_vrigin(
ax=ax_bowers,
well=well_cug1,
a=a,
b=b,
vel_log=vel_log_filter_smooth,
obp_log='Overburden_Pressure',
upper='T12',
lower='T20',
pres_log='loading',
mode='both')
# draw unloading curve
ppp.plot_bowers_unloading(
ax=ax_bowers,
a=a,
b=b,
vmax=4600,
u=u,
well=well_cug1,
vel_log=vel_log_filter_smooth,
obp_log='Overburden_Pressure',
pres_log='unloading')

3. Pressure Prediction with Bowers model¶
predict pressure with coefficients calculated above:
[12]:
pres_log = well_cug1.bowers(
vel_log=vel_log_filter_smooth, a=a, b=b, u=u)
View Bowers Pressure Results:
[13]:
fig_pres, ax_pres = plt.subplots()
ax_pres.invert_yaxis()
# plot hydrostatic
well_cug1.hydro_log().plot(ax_pres, linestyle='--', color='green', label='Hydrostatic')
# plot OBP
well_cug1.get_log("Overburden_Pressure").plot(ax_pres, color='green', label='Lithostatic')
# plot pressure
pres_log.plot(ax_pres, label='Bowers', color='blue')
# plot horizon
well_cug1.plot_horizons(ax_pres)
# set fig style
ax_pres.set(ylim=(5000,0), aspect=(100/5000)*2)
ax_pres.legend()
fig_pres.set_figheight(8)

Multivairate Model¶
[2]:
from __future__ import print_function, division, unicode_literals
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use(['seaborn-paper', 'seaborn-whitegrid'])
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
import numpy as np
import pygeopressure as ppp
1. Calculate optimized multivariate model coefficients¶
Create survey with the example survey CUG
:
[3]:
# set to the directory on your computer
SURVEY_FOLDER = "M:/CUG_depth"
survey = ppp.Survey(SURVEY_FOLDER)
Retrieve well CUG1
:
[4]:
well_cug1 = survey.wells['CUG1']
Get Velocity, Shale volume and Porosity logs:
[5]:
vel_log = well_cug1.get_log("Velocity")
por_log = well_cug1.get_log("Porosity")
vsh_log = well_cug1.get_log("Shale_Volume")
obp_log = well_cug1.get_log("Overburden_Pressure")
Calculate optimized multivariate model parameters:
[6]:
a0, a1, a2, a3 = ppp.optimize_multivaraite(
well=well_cug1,
obp_log=obp_log,
vel_log=vel_log,
por_log=por_log,
vsh_log=vsh_log,
B=well_cug1.params['bowers']['B'],
upper=1500, lower=3500)
View velocity, porosity, shale volume and effecive pressure used for optimization, and Velocity predicted by the optimized model (blue line):
[7]:
fig, axes = plt.subplots(ncols=4, nrows=1, sharey=True)
axes[0].invert_yaxis()
ppp.plot_multivariate(
axes,
well_cug1,
vel_log, por_log, vsh_log, obp_log, 1500, 3500, a0, a1, a2, a3,
well_cug1.params['bowers']['B'])

2. Pressure Prediction with multivaraite model¶
Multivaraite pressure prediction:
[8]:
pres_log = well_cug1.multivariate(vel_log, por_log, vsh_log)
Post-process predicted pressure:
[9]:
pres_log_filter = ppp.upscale_log(pres_log, freq=20)
pres_log_filter_smooth = ppp.smooth_log(pres_log_filter, window=1501)
View predicted pressure:
[10]:
fig_pres, ax_pres = plt.subplots()
ax_pres.invert_yaxis()
well_cug1.hydro_log().plot(ax_pres, color='green', linestyle='--',
zorder=2, label='hydrostatic')
well_cug1.get_log("Overburden_Pressure").plot(ax_pres, color='g',
label='lithostatic')
pres_log.plot(ax_pres, label='mutlivaraite', zorder=1)
pres_log_filter_smooth.plot(ax_pres, label='smoothed', zorder=5, color='b')
ax_pres.set(xlim=[0,100], ylim=[5000,0], aspect=(100/5000)*2)
ax_pres.legend()
fig_pres.set(figheight=8)
fig_pres.show()

Overburden Pressure Calculation (Seismic)¶
Overburden Pressure Calculation involves:
estimation of density data
calculation of OBP
[ ]:
from __future__ import print_function, division, unicode_literals
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use(['seaborn-paper', 'seaborn-whitegrid'])
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
import numpy as np
import pygeopressure as ppp
1. Estimation of density data¶
Create survey with the example survey CUG
:
[2]:
# set to the directory on your computer
SURVEY_FOLDER = "C:/Users/yuhao/Desktop/CUG_depth"
survey = ppp.Survey(Path(SURVEY_FOLDER))
Retrieve Velocity data:
[3]:
vel_cube = survey.seismics['velocity']
View Velocity cube section:
[4]:
fig_vel, ax_vel = plt.subplots()
im = vel_cube.plot(ppp.InlineIndex(7400), ax_vel, kind='img', cm='gist_rainbow')
fig_vel.colorbar(im)
fig_vel.set(figwidth=8)
[4]:
[None]

Caculate density using Gardner equation from velocity:
[5]:
den_cube = ppp.gardner_seis("den_from_vel", vel_cube)
View 2D section of computed density cube:
[11]:
fig_den, ax_den = plt.subplots()
im = den_cube.plot(ppp.InlineIndex(7400), ax_den, kind='img', cm='gist_earth')
fig_den.colorbar(im)
fig_den.set(figwidth=8)
[11]:
[None]

2. Calculation of Overburden Pressure¶
[9]:
obp_cube = ppp.obp_seis("obp_new", den_cube)
View calculated OBP section:
Here use a colormap defined in OpenDtect.
[12]:
from pygeopressure.basic.vawt import opendtect_seismic_colormap
fig_obp, ax_obp = plt.subplots()
im = obp_cube.plot(ppp.InlineIndex(7400), ax_obp, kind='img', cm=opendtect_seismic_colormap())
fig_obp.colorbar(im)
fig_obp.set(figwidth=8)
[12]:
[None]

Eaton Method with Seismic Velocity Data¶
[2]:
from __future__ import print_function, division, unicode_literals
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use(['seaborn-paper', 'seaborn-whitegrid'])
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
import numpy as np
import pygeopressure as ppp
Create survey CUG
:
[3]:
# set to the directory on your computer
SURVEY_FOLDER = "M:/CUG_depth"
survey = ppp.Survey(SURVEY_FOLDER)
Retrieve well CUG1
:
[4]:
well_cug1 = survey.wells['CUG1']
Get a
, b
from well CUG1
:
[5]:
a = well_cug1.params['nct']["a"]
b = well_cug1.params['nct']["b"]
Get n
from well CUG1
:
[6]:
n = well_cug1.params['n']
Retrieve seismic data:
[7]:
vel_cube = survey.seismics['velocity']
obp_cube = survey.seismics['obp_new']
View velocity section:
[8]:
fig_vel, ax_vel = plt.subplots()
im = vel_cube.plot(
ppp.InlineIndex(8000), ax_vel, kind='img', cm='gist_rainbow')
fig_vel.colorbar(im)
fig_vel.set(figwidth=8)
[8]:
[None]

Pressure Prediction with Eaton method:
[9]:
eaton_cube = ppp.eaton_seis(
"eaton_new", obp_cube, vel_cube, n=3,
upper=survey.horizons['T16'], lower=survey.horizons['T20'])
eaton_seis
function will automatically optimize the coefficients of Normal Compaction Trend, a
and b
.
View calculated pressure:
[10]:
from pygeopressure.basic.vawt import opendtect_seismic_colormap
fig_pres, ax_pres = plt.subplots()
im = eaton_cube.plot(
ppp.InlineIndex(8000), ax_pres,
kind='img', cm=opendtect_seismic_colormap())
fig_pres.colorbar(im)
fig_pres.set(figwidth=8)
[10]:
[None]

Bowers method with seismic velocity¶
Pore pressure prediction with Bowers’ method using well log data.
[3]:
from __future__ import print_function, division, unicode_literals
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use(['seaborn-paper', 'seaborn-whitegrid'])
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
import numpy as np
import pygeopressure as ppp
Create survey CUG
:
[5]:
# set to the directory on your computer
SURVEY_FOLDER = "M:/CUG_depth"
survey = ppp.Survey(SURVEY_FOLDER)
Retrieve well CUG1
:
[6]:
well_cug1 = survey.wells['CUG1']
Get Bowers coefficients A
, B
from well CUG1
:
[7]:
a = well_cug1.params['bowers']["A"]
b = well_cug1.params['bowers']['B']
Retrieve seismic data:
[8]:
vel_cube = survey.seismics['velocity']
obp_cube = survey.seismics['obp_new']
View velocity section:
[9]:
fig_vel, ax_vel = plt.subplots()
im = vel_cube.plot(
ppp.InlineIndex(8000), ax_vel, kind='img', cm='gist_rainbow')
fig_vel.colorbar(im)
fig_vel.set(figwidth=8)
[9]:
[None]

[10]:
fig, ax = plt.subplots()
im = obp_cube.plot(ppp.InlineIndex(7400), ax, kind='img')
fig.colorbar(im)
fig.set(figwidth=8)
[10]:
[None]

Pressure Prediction with Bowers method:
[11]:
bowers_cube = ppp.bowers_seis(
"bowers_new", obp_cube, vel_cube,
upper=survey.horizons['T16'], lower=survey.horizons['T20'],
mode='optimize')
View predicted pressure section:
[12]:
from pygeopressure.basic.vawt import opendtect_seismic_colormap
fig_pres, ax_pres = plt.subplots()
im = bowers_cube.plot(
ppp.InlineIndex(8000), ax_pres,
kind='img', cm=opendtect_seismic_colormap())
fig_pres.colorbar(im)
fig_pres.set(figwidth=8)
[12]:
[None]

Survey Setup¶
A geophysical survey is a data set measured and recorded with reference to a particular area of the Earth’s surface 1. Survey is the basic management unit for projects in pyGeoPressure. It holds both survey geometry and references to seismic and well data associated with the survey area.
In pyGeoPressure
, a Survey
object is initialized with a survey folder:
import pygeopressure as ppp
survey = ppp.Survey('path/to/survey/folder')
So to setup a survey is to build the survey folder.
Survey Folder Structure¶
In pyGeoPressure, all information and data are stored in a survey folder with the following structure:
+---EXAMPLE_SURVEY
| .survey
| |
| +---Seismics
| | velocity.seis
| | density.seis
| | pressure.seis
| |
| +---Surfaces
| | T20.hor
| | T16.hor
| |
| \---Wellinfo
| .CUG1
| .CUG2
| well_data.h5
|
Within the survey directory named EXAMPLE_SURVEY
, there are three
sub-folders Seismics
, Surfaces
and Wellinfo
. At the root of the
survey folder is a survey definition file .survey
. The definition file defines
the geometry of the survey, the folder structure defines its association with the data.
.survey
¶
First and foremost, there is a .survey
file, which stores geometry definition of the
whole geophysical survey and auxiliary information.
Geometry Definition¶
Survey Geometry defines:
Survey Area extent
Inline/Crossline Coordinates, along which the survey are conducted.
X/Y Coordinates, real world Coordinates
Relations between them
In pyGeoPressure, survey geometry is defined using a method I personally dubbed “Three points” method. Given the inline/crossline number and X/Y coordinates of three points on the survey grid, we are able to solve the linear equaions for transformation between inline/crossline coordination and X/Y coordination.
Information in .survey
file of the example survey are
{
"name": "CUG_depth",
"point_A": [6400, 4100, 701319, 3274887],
"point_B": [6400, 4180, 702185, 3274387],
"point_C": [6440, 4180, 702685, 3275253],
"inline_range": [6400, 7000, 20],
"crline_range": [4100, 6020, 40],
"z_range": [0, 5000, 4, "m"]
}
Of the three points selected, point A and point B share the same inline, and point B and point C share the same crossline.
In addition to coordinations of three points, the extent and step of inline, crossline ,z coordinates and unit of z are also needed to fully define the extent of the survey.
Seismics¶
Within Seismics
folder, each file written in JSON with extention .seis
represents a seismic data cube.
These files contain file path to the actual SEG-Y file storing seismic data,
and the type of property (Property_Type
) and wether data is in depth scale
or not (inDepth
). So the Seismics
folder doesn’t need to store
large SEG-Y files, it just holds references to them.
In-line/cross-line range and Z range are also written in these files.
Surfaces¶
Surfaces like seimic horizons are stored in Surfaces
folder. Surface
files ending with .hor
are tsv files storing inline number, crossline number
and depth values defining the geometry of a 3D geologic surface.
Wellinfo¶
Well information is stored in Wellinfo
. Each file with file name with
extention .well
is a well information file, it stores well position information
like coordination, kelly bushing and interpretation information like interpretated
layers, fitted coefficients. It also holds a pointer to where the log curve data is
stored. By default, well log curve data are stored in well_data.h5
, but
users can point to other storage files.
Create New Survey¶
A helper function create_survey_directory
can facilitate users to build survey folder structure:
import pygeopressure as ppp
ppp.create_survey_directory(ROOTDIR, SURVEY_NAME)
It will create a survey folder named SURVEY_NAME
in ROOTDIR
with three sub-folders for each kind of data and a .survey
file.
Add Well¶
Adding a new well is acheived by add a .well
file to Wellinfo
folder in
survey directory(see Survey Setup).
A minimal .well
should contain the following information:
1. “well_name”
2. “loc” - X/Y coordination of the well
3. “KB” - kelly bushing elevation
4. “WD” - water depth
5. “TD” - total depth of the wellbore
6. “hdf_file” - storage file path, if only the file name is provided, pyGeoPressure will assume it is in the Wellinfo
folder.
{
"well_name": "CUG1",
"loc": [
707838,
3274780
],
"KB": 23,
"WD": 85,
"TD": 5000,
"hdf_file": "well_data.h5"
}
More information can be stored in well information file. Please check out the CUG1.well
in the example surey.
Import Well Log Curve Data from file¶
First, say we have a new well CUG3
. After writing the CUG3.well
file, and save it to Wellinfo
folder. We initialize the survey.
[2]:
survey = ppp.Survey(Path(SURVEY_FOLDER))
'No well named cug3'
A meassage shows “no well named cug3
”, it’s because there is no data stored in well_data.h5
file. (In pyGeoPressure
, well log data is stored in hdf5 file.)
But we can still get its information:
[38]:
survey.wells
[38]:
{u'CUG1': <pygeopressure.basic.well.Well at 0x11031588>,
u'CUG3': <pygeopressure.basic.well.Well at 0x10a0a8d0>}
[5]:
cug3 = survey.wells['CUG3']
We provides two methods for importing well log curve data:
0. Read las/pseudo-las file¶
First, we need to read data from file. pyGeoPressure
provides a class LasData
for reading las file and pseudo-las file.
[7]:
las_data = ppp.LasData(las_file="C:/Users/yuhao/Desktop/CUG_depth/log_curves.las")
get las file type with:
[11]:
las_data.file_type
[11]:
'pseudo-las'
Read pseudo-las file with:
[12]:
las_data.read_pseudo_las()
1. at runtime¶
At runtime, well log curve data are stored in pandas dataframe. Each Well
object has a dataframe
attribute. To import well log curve to Well
, users can directly set a new dataframe read by LasData
to Well.dataframe
.
[14]:
cug3 = survey.wells['CUG3']
Set the data_frame of LasData
to Well
:
[19]:
cug3.data_frame = las_data.data_frame
[20]:
cug3.logs
[20]:
[u'Shale_Volume',
u'Density',
u'Density_filter20_sm1500',
u'Velocity',
u'Velocity_filter20_sm1500',
u'Overburden_Pressure',
u'Porosity']
Or part of the read dataframe:
[25]:
cug3.data_frame = las_data.data_frame[['Depth(m)', 'Shale_Volume(Fraction)', 'Density(G/C3)']]
[26]:
cug3.logs
[26]:
[u'Shale_Volume', u'Density']
After importing logs, users should call ``save_well_logs()`` to save them to storage file.
2. edit .hd5
file¶
In pyGeoPressure
, well log curve data is stored in hdf5 files (I call it storage file) on disk. To import well log curves, users can directly manage hdf5 file.
pyGeoPressure
provides class WellStorage
to manage hdf5 files.
[27]:
storage = ppp.WellStorage(hdf5_file='C:/Users/yuhao/Desktop/CUG_depth/Wellinfo/well_data.h5')
[28]:
storage.add_well(well_name='cug3', well_data_frame=las_data.data_frame)
[29]:
storage.wells
[29]:
['cug1', 'cug2', 'cug3']
When we reinitialize the survey, we will see that the data has been imported into Well CUG3
.
[34]:
survey = ppp.Survey(Path(SURVEY_FOLDER))
[35]:
cug3 = survey.wells['CUG3']
[36]:
cug3.logs
[36]:
[u'Shale_Volume',
u'Density',
u'Density_filter20_sm1500',
u'Velocity',
u'Velocity_filter20_sm1500',
u'Overburden_Pressure',
u'Porosity']
Adding Seismic Cube and Surface¶
Add Seismic Cube¶
Seismic cube is added by creating a new .seis
file in Seismics
folder.
The content of velocity.seis file in our example survey are:
{
"path": "velocity.sgy",
"inline_range": [200, 650, 2],
"z_range": [400, 1100, 4],
"crline_range": [700, 1200, 2],
"inDepth": true,
"Property_Type": "Velocity"
}
Note that if path is relative, pygeopressure will look for segy file in the Seismics folder.
Add Horizon¶
Horizons can added by placing the horizon data file with extention .hor
in Surfaces
folder.
Horizon files are tsv(Tab Seperated Value) files with three columns each stores inline, crossline and Z value.
It header should be:
inline crline z
Data Types¶
Three basic Data types in pyGeoPressure
are Well
for well,
Log
for well log and SeiSEGY
for seismic data.
Well¶
-
class
pygeopressure.basic.well.
Well
(json_file, hdf_path=None)[source] A class representing a well with information and log curve data.
Initializer:¶
-
Well.
__init__
(json_file, hdf_path=None)[source] - Parameters
json_file (str) – path to parameter file
hdf_path (str, optional) – path to hdf5 file used to override the one written in json_file
Properties¶
-
Well.
depth
() depth values of the well
- Returns
- Return type
numpy.ndarray
-
Well.
logs
() logs stored in this well
- Returns
- Return type
-
Well.
unit_dict
() properties and their units
-
Well.
hydrostatic
() Hydrostatic Pressure
- Returns
- Return type
numpy.ndarray
-
Well.
lithostatic
() Overburden Pressure (Lithostatic)
- Returns
- Return type
numpy.ndarray
-
Well.
normal_velocity
() Normal Velocity calculated using NCT stored in well
- Returns
- Return type
numpy.ndarray
log curve data manipulation¶
-
Well.
get_log
(logs, ref=None)[source] Retreive one or several logs in well
- Parameters
logs (str or list str) – names of logs to be retrieved
ref ({‘sea’, ‘kb’}) – depth reference, ‘sea’ references to sea level, ‘kb’ references to Kelly Bushing
- Returns
one or a list of Log objects
- Return type
-
Well.
add_log
(log, name=None, unit=None)[source] Add new Log to current well
- Parameters
log (Log) – log to be added
name (str, optional) – name for the newly added log, None, use log.name
unit (str, optional) – unit for the newly added log, None, use log.unit
-
Well.
drop_log
(log_name)[source] delete a Log in current Well
- Parameters
log_name (str) – name of the log to be deleted
-
Well.
rename_log
(log_name, new_log_name)[source] - Parameters
log_name (str) – log name to be replaced
new_log_name (str)
-
Well.
update_log
(log_name, log)[source] Update well log already in current well with a new Log
- Parameters
log_name (str) – name of the log to be replaced in current well
log (Log) – Log to replace
-
Well.
to_las
(file_path, logs_to_export=None, full_las=False, null_value=1e+30)[source] Export logs to LAS or pseudo-LAS file
- Parameters
file_path (str) – output file path
logs_to_export (list of str) – Log names to be exported, None export all logs
full_las (bool) – True, export LAS header; False export only data hence psuedo-LAS
null_value (scalar) – Null Value representation in output file.
-
Well.
save_well_logs
()[source] Save current well logs to file
Get Meassured pyGeoPressure¶
-
Well.
get_pressure
(pres_key, ref=None, hydrodynamic=0, coef=False)[source] Get Pressure Values or Pressure Coefficients
- Parameters
pres_key (str) – Pressure data name
ref ({‘sea’, ‘kb’}) – depth reference, ‘sea’ references to sea level, ‘kb’ references to Kelly Bushing
hydrodynamic (float) – return Pressure at depth deeper than this value
coef (bool) – True - get pressure coefficient else get pressure value
- Returns
Log object containing Pressure or Pressure coefficients
- Return type
Pressure Prediction¶
-
Well.
eaton
(vel_log, obp_log=None, n=None, a=None, b=None)[source] Predict pore pressure using Eaton method
- Parameters
vel_log (Log) – velocity log
obp_log (Log) – overburden pressure log
n (scalar) – Eaton exponent
- Returns
a Log object containing calculated pressure.
- Return type
-
Well.
bowers
(vel_log, obp_log=None, a=None, b=None, u=1, vmax=4600, start_depth=None, buf=20, end_depth=None, end_buffer=10)[source] Predict pore pressure using Eaton method
- Parameters
vel_log (Log) – velocity log
obp_log (Log) – overburden pressure log
a, b, u (float) – bowers model coefficients
- Returns
a Log object containing calculated pressure.
- Return type
-
Well.
multivariate
(vel_log, por_log, vsh_log, obp_log=None, a0=None, a1=None, a2=None, a3=None, b=None)[source]
Log¶
-
class
pygeopressure.basic.well_log.
Log
(file_name=None, log_name='unk')[source] class for well log data
Initializer:¶
-
Log.
__init__
(file_name=None, log_name='unk')[source] - Parameters
file_name (str) – pseudo las file path
log_name (str) – log name to create
Alternative initializer:
-
classmethod
Log.
from_scratch
(depth, data, name=None, units=None, descr=None, prop_type=None)[source]
Data interfaces:¶
-
Log.
depth
() depth data of the log
-
Log.
data
() property data of the log
-
Log.
start
() start depth of available property data
-
Log.
stop
() end depth of available property data
-
Log.
start_idx
() start index of available property data
-
Log.
stop_idx
() end index of available property data
-
Log.
top
() top depth of this log
-
Log.
bottom
() bottom depth of this log
SeiSEGY¶
-
class
pygeopressure.basic.seisegy.
SeiSEGY
(segy_file, like=None)[source]
Initializers:¶
The default initializer takes a segy file path:
-
SeiSEGY.
__init__
(segy_file, like=None)[source] - Parameters
segy_file (str) – segy file path
like (str, optional) – created segy file has the same dimesions as like.
The alternative initilizer from_json
takes a info file in json.
-
classmethod
SeiSEGY.
from_json
(json_file, segy_file=None)[source] Initialize SeiSEGY from an json file containing information
- Parameters
json_file (str) – json file path
segy_file (str) – segy file path for overriding information in json file.
Iterators:¶
-
SeiSEGY.
inlines
()[source] Iterator for inline numbers
- Yields
int – inline number
-
SeiSEGY.
crlines
()[source] Iterator for crline numbers
- Yields
int – cross-line number
-
SeiSEGY.
inline_crlines
()[source] Iterator for both inline and crline numbers
- Yields
tuple of int – (inline number, crossline number)
-
SeiSEGY.
depths
()[source] Iterator for z coordinate
- Yields
float – depth value
Data interface:¶
-
SeiSEGY.
data
(indexes)[source] Retrieve Data according to the index provided.
- Parameters
indexes ({InlineIndex, CrlineIndex, DepthIndex, CdpIndex}) – index of data to retrieve
- Returns
- Return type
numpy.ndarray
Plots Data Sections:¶
-
SeiSEGY.
plot
(index, ax, kind='vawt', cm='seismic', ptype='seis')[source] Plot seismic section according to index provided.
- Parameters
index ({InlineIndex, CrlineIndex, DepthIndex, CdpIndex}) – index of data to plot
ax (matplotlib.axes._subplots.AxesSubplot) – axis to plot on
kind ({‘vawt’, ‘img’}) – ‘vawt’ for variable area wiggle trace plot ‘img’ for variable density plot
cm (str) – colormap for plotting
ptype (str, optional) – property type
- Returns
- Return type
matplotlib.image.AxesImage
API¶
pygeopressure package¶
Subpackages¶
pygeopressure.basic package¶
Submodules¶
pygeopressure.basic.indexes module¶
class for survey index definition
created on Jun 10th 2017
pygeopressure.basic.las module¶
an interface for interacting with Las file
Created on Thu May 10 2018
pygeopressure.basic.log_tools module¶
well log processing tools
Created on Sep 19 2018
-
pygeopressure.basic.log_tools.
extrapolate_log_traugott
(den_log, a, b, kb=0, wd=0)[source]¶ Extrapolate density log using Traugott equation
-
pygeopressure.basic.log_tools.
local_average
(log, rad=10)[source]¶ upscale data using local averaging
- Parameters
data (Log()) – log data to be upscaled
rad (int) – local radius, data within this radius will be represented by a single value
- Returns
new_log – upscaled log data
- Return type
Log()
-
pygeopressure.basic.log_tools.
shale
(log, vsh_log, thresh=0.35)[source]¶ Discern shale intervals
- logLog
log to discern
- vsh_logLog
shale volume log
- threshscalar
percentage threshold, 0 < thresh < 1
-
pygeopressure.basic.log_tools.
smooth_log
(log, window=1500)[source]¶ - Parameters
log (Log object) – log to smooth
window (scalar) – window size of the median filter
- Returns
smoothed log – smoothed log
- Return type
Log object
-
pygeopressure.basic.log_tools.
truncate_log
(log, top, bottom)[source]¶ Remove unreliable values in the top and bottom section of well log
- Parameters
log (Log object)
top, bottom (scalar) – depth value
- Returns
trunc_log
- Return type
Log object
pygeopressure.basic.optimizer module¶
optimizer for different models
Created on Sep 16 2018
-
pygeopressure.basic.optimizer.
optimize_bowers_trace
(depth_tr, vel_tr, obp_tr, hydro_tr, depth_upper, depth_lower)[source]¶
-
pygeopressure.basic.optimizer.
optimize_bowers_unloading
(well, vel_log, obp_log, a, b, vmax, pres_log='unloading')[source]¶ Optimize for Bowers Unloading curve parameter U
- Parameters
well (Well)
vel_log (Log or str) – Log object or well log name stored in well
obp_log (Log or str) – Log object or well log name stored in well
vmax (float) – vmax in bowers unloading curve
pres_log (Log or str) – Log object storing measured pressure value or Pressure name stored in well
- Returns
u (float) – unloading curve cofficient U
error (float) – Relative RMS error
-
pygeopressure.basic.optimizer.
optimize_bowers_virgin
(well, vel_log, obp_log, upper, lower, pres_log='loading', mode='nc', nnc=5)[source]¶ Optimizer for Bowers loading curve
- Parameters
well (Well)
vel_log (Log or str) – Log object or well log name stored in well
obp_log (Log or str) – Log object or well log name stored in well
upper (float or str) – upper bound of nct, depth value or horizon name
lower (float or str) – lower bound of nct, depth value or horizon name
pres_log (Log or str) – Log object storing measured pressure value or Pressure name stored in well
mode ({‘nc’, ‘pres’, ‘both’}) – which pressure to use for optimization, - ‘nc’ : points on NCT - ‘pres’ : points in pres_log - ‘both’ : both of them
nnc (int) – number of points to pick on NCT
- Returns
a, b (tuple of floats) – optimized bowers loading curve coefficients
rms_err (float) – root mean square error of pressure
-
pygeopressure.basic.optimizer.
optimize_eaton
(well, vel_log, obp_log, a, b, pres_log='loading')[source]¶ Optimizer for Eaton model
- Parameters
well (Well)
vel_log (Log or str) – Log object or well log name stored in well
obp_log (Log or str) – Log object or well log name stored in well
a, b (float) – coefficients of NCT
pres_log (Log or str) – Log object storing measured pressure value or Pressure name stored in well
- Returns
n (float) – optimized eaton exponential
min_eer (float) – minimum error abtained by optimized n
rms_err (array) – array of rms error of different n around minmum
-
pygeopressure.basic.optimizer.
optimize_multivaraite
(well, obp_log, vel_log, por_log, vsh_log, B, upper, lower)[source]¶
-
pygeopressure.basic.optimizer.
optimize_nct
(vel_log, fit_start, fit_stop)[source]¶ Fit velocity NCT
- Parameters
vel_log (Log) – Velocity log
fit_start, fit_stop (float) – start and end depth for fitting
- Returns
a, b – NCT coefficients
- Return type
-
pygeopressure.basic.optimizer.
optimize_nct_trace
(depth, vel, fit_start, fit_stop, pick=True)[source]¶
-
pygeopressure.basic.optimizer.
optimize_traugott
(den_log, fit_start, fit_stop, kb=0, wd=0)[source]¶ Fit density variation against depth with Traugott equation
- Parameters
den_log (Log) – Density log
fit_start, fit_stop (float) – start and end depth for fitting
kb (float) – kelly bushing height in meters
wd (float) – water depth in meters
- Returns
a, b – Traugott equation coefficients
- Return type
pygeopressure.basic.plots module¶
a Well class utilizing pandas DataFrame and hdf5 storage
Created on May 27 2018
-
class
pygeopressure.basic.plots.
LoadingPlot
(ax, obp_logs, vel_logs, pres_logs, well_names)[source]¶ Bases:
object
- Parameters
json_file (str) – path to parameter file
-
pygeopressure.basic.plots.
plot_bowers_unloading
(ax, a, b, u, vmax, well, vel_log, obp_log, pres_log='unloading')[source]¶ plot bowers unloading plot
-
pygeopressure.basic.plots.
plot_bowers_vrigin
(ax, a, b, well, vel_log, obp_log, upper, lower, pres_log='loading', mode='nc', nnc=5)[source]¶
pygeopressure.basic.seisegy module¶
class for interfacing with segy file.
Created on Feb. 7th 2018
-
class
pygeopressure.basic.seisegy.
SeiSEGY
(segy_file, like=None)[source]¶ Bases:
object
-
data
(indexes)[source]¶ Retrieve Data according to the index provided.
- Parameters
indexes ({InlineIndex, CrlineIndex, DepthIndex, CdpIndex}) – index of data to retrieve
- Returns
- Return type
numpy.ndarray
-
classmethod
from_json
(json_file, segy_file=None)[source]¶ Initialize SeiSEGY from an json file containing information
- Parameters
json_file (str) – json file path
segy_file (str) – segy file path for overriding information in json file.
-
inline_crlines
()[source]¶ Iterator for both inline and crline numbers
- Yields
tuple of int – (inline number, crossline number)
-
plot
(index, ax, kind='vawt', cm='seismic', ptype='seis')[source]¶ Plot seismic section according to index provided.
- Parameters
index ({InlineIndex, CrlineIndex, DepthIndex, CdpIndex}) – index of data to plot
ax (matplotlib.axes._subplots.AxesSubplot) – axis to plot on
kind ({‘vawt’, ‘img’}) – ‘vawt’ for variable area wiggle trace plot ‘img’ for variable density plot
cm (str) – colormap for plotting
ptype (str, optional) – property type
- Returns
- Return type
matplotlib.image.AxesImage
-
pygeopressure.basic.survey module¶
Class for defining a seismic survey
Created on Fri Dec 11 20:24:38 2015
-
class
pygeopressure.basic.survey.
Survey
(survey_dir)[source]¶ Bases:
pygeopressure.basic.survey_setting.SurveySetting
Survey object for combining seismic data and well log data.
- Parameters
survey_dir (str) – survey directory.
-
seisCube
¶ SeisCube object holding seismic data.
- Type
SeisCube
-
add_well
(well)¶ add a well to survey
pygeopressure.basic.survey_setting module¶
A survey setting class
Created on Sat Jan 20 2018
-
class
pygeopressure.basic.survey_setting.
SurveySetting
(threepoints)[source]¶ Bases:
object
class to hold survey settings and compute additional coordination property
-
azimuth_and_invertedAxis
()[source]¶ Determine azimuth (Crossline axis direction from Coordination North) and Inline axis is positive to the right (invertedAxis=False) or to the left (invertedAxis=True)
-
pygeopressure.basic.threepoints module¶
Created on Feb. 14th 2018
-
exception
pygeopressure.basic.threepoints.
Invalid_threepoints_Exception
(message=None)[source]¶ Bases:
Exception
-
exception
pygeopressure.basic.threepoints.
Not_threepoints_v1_Exception
(message=None)[source]¶ Bases:
Exception
pygeopressure.basic.utils module¶
some utilities
-
pygeopressure.basic.utils.
nmse
(measure, predict)[source]¶ Normalized Root-Mean-Square Error
with RMS(y - y*) as nominator, and MEAN(y) as denominator
-
pygeopressure.basic.utils.
pick_sparse
(a_array, n)[source]¶ Pick n equally spaced samples from array
- Parameters
a_array (1-d ndarray)
n (int) – number of samples to pick
pygeopressure.basic.vawt module¶
Created on Thu Apr 26 2017
-
class
pygeopressure.basic.vawt.
Wiggles
(data, wiggleInterval=10, overlap=1, posFill='black', negFill=None, lineColor='black', rescale=True, extent=None, ax=None)[source]¶ Bases:
object
-
pygeopressure.basic.vawt.
wiggle
(values, origin=0, posFill='black', negFill=None, lineColor='black', resampleRatio=10, rescale=False, zmin=0, zmax=None, ax=None)[source]¶ Plot a trace in VAWT(Variable Area Wiggle Trace)
- Parameters
x (input data (1D numpy array))
origin ((default, 0) value to fill above or below (float))
posFill ((default, black)) – color to fill positive wiggles with (string or None)
negFill ((default, None)) – color to fill negative wiggles with (string or None)
lineColor ((default, black)) – color of wiggle trace (string or None)
resampleRatio ((default, 10)) – factor to resample traces by before plotting (1 = raw data) (float)
rescale ((default, False)) – If True, rescale “x” to be between -1 and 1
zmin ((default, 0)) – The minimum z to use for plotting
zmax ((default, len(x))) – The maximum z to use for plotting
ax ((default, current axis)) – The matplotlib axis to plot onto
- Returns
- Return type
Plot
-
pygeopressure.basic.vawt.
wiggles
(data, wiggleInterval=10, overlap=5, posFill='black', negFill=None, lineColor='black', rescale=True, extent=None, ax=None)[source]¶ 2-D Wiggle Trace Variable Amplitude Plot
- Parameters
x (input data (2D numpy array))
wiggleInterval ((default, 10) Plot ‘wiggles’ every wiggleInterval traces)
overlap ((default, 0.7) amount to overlap ‘wiggles’ by (1.0 = scaled) – to wiggleInterval)
posFill ((default, black) color to fill positive wiggles with (string) – or None)
negFill ((default, None) color to fill negative wiggles with (string) – or None)
lineColor ((default, black) color of wiggle trace (string or None))
resampleRatio ((default, 10) factor to resample traces by before) – plotting (1 = raw data) (float)
extent ((default, (0, nx, 0, ny)) The extent to use for the plot.) – A 4-tuple of (xmin, xmax, ymin, ymax)
ax ((default, current axis) The matplotlib axis to plot onto.)
Output – a matplotlib plot on the current axes
pygeopressure.basic.well module¶
a Well class utilizing pandas DataFrame and hdf5 storage
Created on Tue Dec 27 2016
-
class
pygeopressure.basic.well.
Well
(json_file, hdf_path=None)[source]¶ Bases:
object
A class representing a well with information and log curve data.
-
add_log
(log, name=None, unit=None)[source]¶ Add new Log to current well
- Parameters
log (Log) – log to be added
name (str, optional) – name for the newly added log, None, use log.name
unit (str, optional) – unit for the newly added log, None, use log.unit
-
bowers
(vel_log, obp_log=None, a=None, b=None, u=1, vmax=4600, start_depth=None, buf=20, end_depth=None, end_buffer=10)[source]¶ Predict pore pressure using Eaton method
- Parameters
vel_log (Log) – velocity log
obp_log (Log) – overburden pressure log
a, b, u (float) – bowers model coefficients
- Returns
a Log object containing calculated pressure.
- Return type
-
property
depth
¶ depth values of the well
- Returns
- Return type
numpy.ndarray
-
drop_log
(log_name)[source]¶ delete a Log in current Well
- Parameters
log_name (str) – name of the log to be deleted
-
eaton
(vel_log, obp_log=None, n=None, a=None, b=None)[source]¶ Predict pore pressure using Eaton method
- Parameters
vel_log (Log) – velocity log
obp_log (Log) – overburden pressure log
n (scalar) – Eaton exponent
- Returns
a Log object containing calculated pressure.
- Return type
-
get_log
(logs, ref=None)[source]¶ Retreive one or several logs in well
- Parameters
logs (str or list str) – names of logs to be retrieved
ref ({‘sea’, ‘kb’}) – depth reference, ‘sea’ references to sea level, ‘kb’ references to Kelly Bushing
- Returns
one or a list of Log objects
- Return type
-
get_pressure
(pres_key, ref=None, hydrodynamic=0, coef=False)[source]¶ Get Pressure Values or Pressure Coefficients
- Parameters
pres_key (str) – Pressure data name
ref ({‘sea’, ‘kb’}) – depth reference, ‘sea’ references to sea level, ‘kb’ references to Kelly Bushing
hydrodynamic (float) – return Pressure at depth deeper than this value
coef (bool) – True - get pressure coefficient else get pressure value
- Returns
Log object containing Pressure or Pressure coefficients
- Return type
-
get_pressure_normal
()[source]¶ return pressure points within normally pressured zone.
- Returns
Log object containing normally pressured measurements
- Return type
-
property
hydrostatic
¶ Hydrostatic Pressure
- Returns
- Return type
numpy.ndarray
-
property
lithostatic
¶ Overburden Pressure (Lithostatic)
- Returns
- Return type
numpy.ndarray
-
multivariate
(vel_log, por_log, vsh_log, obp_log=None, a0=None, a1=None, a2=None, a3=None, b=None)[source]¶
-
property
normal_velocity
¶ Normal Velocity calculated using NCT stored in well
- Returns
- Return type
numpy.ndarray
-
rename_log
(log_name, new_log_name)[source]¶ - Parameters
log_name (str) – log name to be replaced
new_log_name (str)
-
to_las
(file_path, logs_to_export=None, full_las=False, null_value=1e+30)[source]¶ Export logs to LAS or pseudo-LAS file
- Parameters
file_path (str) – output file path
logs_to_export (list of str) – Log names to be exported, None export all logs
full_las (bool) – True, export LAS header; False export only data hence psuedo-LAS
null_value (scalar) – Null Value representation in output file.
-
property
unit_dict
¶ properties and their units
-
pygeopressure.basic.well_log module¶
class Log for well log data
Created on Fri Apr 18 2017
-
class
pygeopressure.basic.well_log.
Log
(file_name=None, log_name='unk')[source]¶ Bases:
object
class for well log data
-
property
bottom
¶ bottom depth of this log
-
property
data
¶ property data of the log
-
property
depth
¶ depth data of the log
-
plot
(ax=None, color='gray', linewidth=0.5, linestyle='-', label=None, zorder=1)[source]¶ Plot log curve
- Parameters
ax (matplotlib.axes._subplots.AxesSubplot) – axis object to plot on, a new axis will be created if not provided
- Returns
- Return type
matplotlib.axes._subplots.AxesSubplot
-
property
start
¶ start depth of available property data
-
property
start_idx
¶ start index of available property data
-
property
stop
¶ end depth of available property data
-
property
stop_idx
¶ end index of available property data
-
property
top
¶ top depth of this log
-
property
pygeopressure.basic.well_storage module¶
an interface to a hdf5 storage file
Created on Thu May 10 2018
Module contents¶
pygeopressure.pressure package¶
Submodules¶
pygeopressure.pressure.bowers module¶
Routines to calculate pore pressure
-
pygeopressure.pressure.bowers.
bowers
(v, obp, u, start_idx, a, b, vmax, end_idx=None)[source]¶ Compute pressure using Bowers equation.
- Parameters
v (1-d ndarray) – velocity array whose unit is m/s.
obp (1-d ndarray) – Overburden pressure whose unit is Pa.
v0 (float, optional) – the velocity of unconsolidated regolith whose unit is m/s.
a (float, optional) – coefficient a
b (float, optional) – coefficient b
Notes
\[P = S - \left[\frac{(V-V_{0})}{a}\right]^{\frac{1}{b}}\]- 3
Bowers, G. L. (1994). Pore pressure estimation from velocity data: accounting from overpressure mechanisms besides undercompaction: Proceedings of the IADC/SPE drilling conference, Dallas, 1994, (IADC/SPE), 1994, pp 515–530. In International Journal of Rock Mechanics and Mining Sciences & Geomechanics Abstracts (Vol. 31, p. 276). Pergamon.
-
pygeopressure.pressure.bowers.
bowers_varu
(v, obp, u, start_idx, a, b, vmax, buf=20, end_idx=None, end_buffer=10)[source]¶ Bowers Method with buffer zone above unloading zone
- Parameters
v (1-d ndarray) – velocity array whose unit is m/s.
obp (1-d ndarray) – Overburden pressure whose unit is Pa.
u (float) – coefficient u
start_idx (int) – index of start of fluid expansion
a (float, optional) – coefficient a
b (float, optional) – coefficient b
vmax (float)
buf (int, optional) – len of buffer interval, buf should be smaller than start_idx
end_idx (int) – end of fluid expasion
end_buffer (int) – len of end buffer interval
-
pygeopressure.pressure.bowers.
invert_unloading
(v, a, b, u, v_max)[source]¶ invert of Unloading curve in Bowers’s method.
pygeopressure.pressure.bowers_seis module¶
Routines for Bowers’ pore pressure prediction with seismic velocity
-
pygeopressure.pressure.bowers_seis.
bowers_optimize
(bowers_cube, obp_cube, vel_cube, upper_hor, lower_hor)[source]¶ Bowers prediction with automatic coefficient optimization
pygeopressure.pressure.eaton module¶
Routines for eaton pressure prediction
Created on Sep 20 2018
-
pygeopressure.pressure.eaton.
eaton
(v, vn, hydrostatic, lithostatic, n=3)[source]¶ Compute pore pressure using Eaton equation.
- Parameters
v (1-d ndarray) – velocity array whose unit is m/s.
vn (1-d ndarray) – normal velocity array whose unit is m/s.
hydrostatic (1-d ndarray) – hydrostatic pressure in mPa
lithostatic (1-d ndarray) – Overburden pressure whose unit is mPa.
v0 (float, optional) – the velocity of unconsolidated regolith whose unit is ft/s.
n (float, optional) – eaton exponent
- Returns
- Return type
ndarray
Notes
\[P = S - {\sigma}_{n}\left(\frac{V}{V_{n}}\right)^{n}\]- 4
Eaton, B. A., & others. (1975). The equation for geopressure prediction from well logs. In Fall Meeting of the Society of Petroleum Engineers of AIME. Society of Petroleum Engineers.
pygeopressure.pressure.eaton_seis module¶
Routines for eaton seismic pressure prediction
Created on Sep 24 2018
pygeopressure.pressure.hydrostatic module¶
Function to calculate hydrostatic pressure
Created on Fri Nov 11 2016
-
pygeopressure.pressure.hydrostatic.
hydrostatic_pressure
(depth, kelly_bushing=0, depth_w=0, rho_f=1.0, rho_w=1.0)[source]¶ - Parameters
depth (scalar or 1-d ndarray) – measured depth, unit: meter
rho_f (scalar) – density of pore fluid, g/cm3
kelly_bushing (scalar) – kelly bushing elevation, in meter
depth_w (scalar) – sea water depth
rho_w (scalar) – sea water density
- Returns
pressure – unit: mPa
- Return type
scalar or 1-d ndarray
pygeopressure.pressure.multivariate module¶
Routines for multivariate pressure prediction
Created on Sep 20 2018
-
pygeopressure.pressure.multivariate.
effective_stress_multivariate
(vel, phi, vsh, a_0, a_1, a_2, a_3, B, U, vmax, start_idx, end_idx=None)[source]¶
-
pygeopressure.pressure.multivariate.
effective_stress_multivariate_varu
(vel, phi, vsh, a_0, a_1, a_2, a_3, B, U, vmax, start_idx, buf=20, end_idx=None, end_buffer=10)[source]¶
-
pygeopressure.pressure.multivariate.
invert_multivariate_unloading
(vel, phi, vsh, a_0, a_1, a_2, a_3, B, U, vmax)[source]¶ Calculate effective stress using multivariate unloading curve
-
pygeopressure.pressure.multivariate.
invert_multivariate_virgin
(vel, phi, vsh, a_0, a_1, a_2, a_3, B)[source]¶ Calculate effective stress using multivariate virgin curve
- Parameters
vel (1-d ndarray) – velocity array whose unit is m/s.
phi (1-d ndarray) – porosity array
vsh (1-d ndarray) – shale volume
a_0, a_1, a_2, a_3 (scalar) – coefficients
- Returns
sigma
- Return type
1-d ndarray
-
pygeopressure.pressure.multivariate.
multivariate_unloading
(sigma, phi, vsh, a_0, a_1, a_2, a_3, B, U, vmax)[source]¶ Calculate velocity using multivariate unloading curve
-
pygeopressure.pressure.multivariate.
multivariate_virgin
(sigma, phi, vsh, a_0, a_1, a_2, a_3, B)[source]¶ Calculate velocity using multivariate virgin curve
- Parameters
sigma (1-d ndarray) – effective pressure
phi (1-d ndarray) – effective porosity
vsh (1-d ndarray) – shale volume
a_0, a_1, a_2, a_3 (float) – coefficients of equation
B (float) – effective pressure exponential
- Returns
out – velocity array
- Return type
1-d ndarray
Notes
\[V = a_0 + a_1\phi + a_2{V}_{sh} + a_3 {\sigma}^{B}\]- 5
Sayers, C., Smit, T., van Eden, C., Wervelman, R., Bachmann, B., Fitts, T., et al. (2003). Use of reflection tomography to predict pore pressure in overpressured reservoir sands. In submitted for presentation at the SEG 2003 annual meeting.
pygeopressure.pressure.obp module¶
Functions related to density and Overburden Pressrue Calculation
-
pygeopressure.pressure.obp.
gardner
(v, c=0.31, d=0.25)[source]¶ Estimate density with velocity
- Parameters
v (1-d ndarray) – interval velocity array
c (float, optional) – coefficient a
d (float, optional) – coefficient d
- Returns
out – density array
- Return type
1-d ndarray
Notes
\[\rho = c{V}^{d}\]typical values for a and b in GOM coast are a=0.31, b=0.25 1.
- 1
G. Gardner, L. Gardner, and A. Gregory, “Formation velocity and density - the diagnostic basics for stratigraphic traps,” Geophysics, vol. 39, no. 6, pp. 770-780, 1974.
-
pygeopressure.pressure.obp.
gardner_seis
(output_name, vel_cube, c=0.31, d=0.25)[source]¶ - Parameters
output_name (str) – output file name without extention
- Returns
- Return type
-
pygeopressure.pressure.obp.
obp_trace
(rho, step)[source]¶ Compute Overburden Pressure for a trace
- Parameters
rho (1-d array) – density in g/cc
- Returns
out – overburden pressure in mPa
- Return type
1-d ndarray
-
pygeopressure.pressure.obp.
obp_well
(den_log, kb=41, wd=82, rho_w=1.01)[source]¶ Compute Overburden Pressure for a Log
- Parameters
den_log (Log) – density log (extrapolated)
kb (scalar) – kelly bushing elevation in meter
wd (scalar) – from sea level to sea bottom (a.k.a mudline) in meter
rho_w (scalar) – density of sea water - depending on the salinity of sea water (1.01-1.05g/cm3)
- Returns
out – Log containing overburden pressure in mPa
- Return type
-
pygeopressure.pressure.obp.
overburden_pressure
(depth, rho, kelly_bushing=41, depth_w=82, rho_w=1.01)[source]¶ Calculate Overburden Pressure
- Parameters
depth (1-d ndarray)
rho (1-d ndarray) – density in g/cm3
kelly_bushing (scalar) – kelly bushing elevation in meter
depth_w (scalar) – from sea level to sea bottom (a.k.a mudline) in meter
rho_w (scalar) – density of sea water - depending on the salinity of sea water (1.01-1.05g/cm3)
- Returns
obp – overburden pressure in mPa
- Return type
1-d ndarray
-
pygeopressure.pressure.obp.
traugott
(z, a, b)[source]¶ estimate density with depth
- Parameters
depth (1-d ndarray)
a, b (scalar)
Notes
\[\overline{\rho (h)}=16.3+{h/3125}^{0.6}\]gives the average sediment density in pounds per gallon (ppg) mud weight equivalent between the sea floor and depth h (in feet) below the sea floor.
So, density variation with depth takes the form 2:
\[\rho(z) = {\rho}_{0} + a{z}^{b}\]- 2
Traugott, Martin. “Pore/fracture pressure determinations in deep water.” World Oil 218.8 (1997): 68-70.
pygeopressure.pressure.utils module¶
some utilities regarding pressure calculation
Module contents¶
pygeopressure.velocity package¶
Submodules¶
pygeopressure.velocity.conversion module¶
Routines performing velocity type conversion
-
pygeopressure.velocity.conversion.
avg2int
(twt, v_avg)[source]¶ - Parameters
twt (1-d ndarray)
v_avg (1-d ndarray)
- Returns
v_int
- Return type
1-d ndarray
-
pygeopressure.velocity.conversion.
int2avg
(twt, v_int)[source]¶ - Parameters
twt (1-d ndarray)
v_int (1-d ndarray)
- Returns
v_avg
- Return type
1-d ndarray
Notes
\[V_{int}[i](t_{i} - t_{i-1}) = V_{avg}[i] t_{i} - \ V_{avg}[i-1] t_{i-1}\]
-
pygeopressure.velocity.conversion.
int2rms
(twt, v_int)[source]¶ - Parameters
twt (1-d ndarray)
v_int (1-d ndarray)
- Returns
v_rms
- Return type
1-d ndarray
-
pygeopressure.velocity.conversion.
rms2int
(twt, v_rms)[source]¶ Convert rms velocity to interval velocity
- Parameters
twt (1-d ndarray) – input two-way-time array, in ms
rms (1-d nadarray) – rms velocity array, in m/s
- Returns
v_int – interval velocity array with the same length of twt and rms
- Return type
1-d ndarray
Notes
This routine uses Dix equation to comput inverval velocity.
\[V_{int}[i]^2 = \frac{V_{rms}[i]^2 t_{i} - V_{rms}[i-1]^2 \ t_{i-1}}{t_{i}-t_{i-1}}\]twt and rms should be of the same length of more than 2.
Examples
>>> a = np.arange(10) >>> twt = np.arange(10) >>> rms2int(twt, a) array([ 0. , 1. , 2.64575131, 4.35889894, 6.08276253, 7.81024968, 9.53939201, 11.26942767, 13. , 14.73091986])
-
pygeopressure.velocity.conversion.
twt2depth
(twt, v_avg, prop_2_convert, stepDepth=4, startDepth=None, endDepth=None)[source]¶ - Parameters
twt (1-d ndarray)
v_avg (1-d ndarray)
prop_2_convert (1-d ndarray)
stepDepth (scalar)
startDpeth (optional) (scalar)
endDepth (optional) (scalar)
- Returns
newDepth (1-d ndarray) – new depth array
new_prop_2_convert (1-d ndarray) – average velocity in depth domain
pygeopressure.velocity.extrapolate module¶
Functions relating velocity trend extrapolation
-
pygeopressure.velocity.extrapolate.
normal
(x, a, b)[source]¶ Extrapolate velocity using normal trend.
- Parameters
x (1-d ndarray) – depth to convert
a, b (scalar) – coefficents
- Returns
out – esitmated velocity
- Return type
1-d ndarray
Notes
\[\log d{t}_{Normal}=a-bz\]is transformed to
\[v={e}^{bz-a}\]Note that the exponential relation is unphysical especially in depth bellow the interval within which the equation is calibrated.
References
- 1
C. Hottmann, R. Johnson, and others, “Estimation of formation pressures from log-derived shale properties,” Journal of Petroleum Technology, vol. 17, no. 6, pp. 717-722, 1965.
-
pygeopressure.velocity.extrapolate.
normal_dt
(x, a, b)[source]¶ normal trend of transit time
- Parameters
x (1-d ndarray) – depth to convert
-
pygeopressure.velocity.extrapolate.
normal_log
(vel_log, a, b)[source]¶ - Returns
normal velocity log
- Return type
-
pygeopressure.velocity.extrapolate.
slotnick
(x, k)[source]¶ Relation between velocity and depth
- Parameters
x (1-d ndarray) – Depth to convert
k (scalar) – velocity gradient
Notes
typical values of velocity gradient k falls in the range 0.6-1.0s-1
References
- 1
M. Slotnick, “On seismic computations, with applications, I,” Geophysics, vol. 1, no. 1, pp. 9-22, 1936.
pygeopressure.velocity.interpolation module¶
2-d interpolation routines
pygeopressure.velocity.smoothing module¶
2-d smoothing
-
pygeopressure.velocity.smoothing.
smooth
(x, window_len=11, window='hanning')[source]¶ Smooth the data using a window with requested size.
This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies of the signal (with the window size) in both ends so that transient parts are minimized in the begining and end part of the output signal.
- Parameters
x (ndarray) – the input signal
window_len (scalar) – the dimension of the smoothing window; should be an odd integer.
window (scalar) – the type of window from ‘flat’, ‘hanning’, ‘hamming’, ‘bartlett’, ‘blackman’ flat window will produce a moving average smoothing.
- Returns
y – the smoothed signal
- Return type
ndarray
Examples
>>> t=linspace(-2,2,0.1) >>> x=sin(t)+randn(len(t))*0.1 >>> y=smooth(x)
See also
numpy.hanning()
,numpy.hamming()
,numpy.bartlett()
,numpy.blackman()
,numpy.convolve()
TODO()
the window parameter could be the window itself if an array instead of a string
Notes
length(output) != length(input), to correct this: return y[(window_len/2-1):-(window_len/2)] instead of just y.