pygeopressure.basic package

Submodules

pygeopressure.basic.horizon module

class Horizon for accessing horizon

Created on Fri July 20 2017

class pygeopressure.basic.horizon.Horizon(data_file)[source]

Bases: object

Horizon using excel file as input

Parameters

data_file (str) – path to excel data file

get_cdp(cdp)[source]

Get value for a CDP point on the horizon.

Parameters

cdp (tuple of int (inline, crossline))

pygeopressure.basic.indexes module

class for survey index definition

created on Jun 10th 2017

class pygeopressure.basic.indexes.CdpIndex(cdp)[source]

Bases: pygeopressure.basic.indexes.SurveyIndex

class pygeopressure.basic.indexes.CrlineIndex(value)[source]

Bases: pygeopressure.basic.indexes.SurveyIndex

class pygeopressure.basic.indexes.DepthIndex(value)[source]

Bases: pygeopressure.basic.indexes.SurveyIndex

class pygeopressure.basic.indexes.InlineIndex(value)[source]

Bases: pygeopressure.basic.indexes.SurveyIndex

class pygeopressure.basic.indexes.SurveyIndex(value)[source]

Bases: object

pygeopressure.basic.las module

an interface for interacting with Las file

Created on Thu May 10 2018

class pygeopressure.basic.las.LasData(las_file)[source]

Bases: object

Class for reading LAS and pseudo-LAS file data

null_values could be set to more values in order to deal with messy files

property data_frame
property file_type
find_logs()[source]
property logs
read_las()[source]
read_pseudo_las()[source]
property units

pygeopressure.basic.log_tools module

well log processing tools

Created on Sep 19 2018

pygeopressure.basic.log_tools.despike(curve, curve_sm, max_clip)[source]
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.interpolate_log(log)[source]

Log curve interpolation

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.rolling_window(a, window)[source]
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.log_tools.upscale_log(log, freq=20)[source]

downscale a well log with a lowpass butterworth filter

pygeopressure.basic.log_tools.write_peudo_las(file_name, logs)[source]

Write multiple logs to a pseudo las file.

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

float

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

float

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

check_error(obp_log, vel_log, pres_log)[source]
error_sigma()[source]
fit()[source]
plot()[source]
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.plots.plot_eaton_error(ax, well, vel_log, obp_log, a, b, pres_log='loading')[source]
pygeopressure.basic.plots.plot_multivariate(axes, well, vel_log, por_log, vsh_log, obp_log, upper, lower, a0, a1, a2, a3, B)[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

cdp(cdp)[source]

data of a cdp

crline(crline)[source]

data of a crossline section

crlines()[source]

Iterator for crline numbers

Yields

int – cross-line number

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

depth(depth)[source]

data of a depth slice

depths()[source]

Iterator for z coordinate

Yields

float – depth value

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(inline)[source]

data of a inline section

inline_crlines()[source]

Iterator for both inline and crline numbers

Yields

tuple of int – (inline number, crossline number)

inlines()[source]

Iterator for inline numbers

Yields

int – inline 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

update(index, data)[source]

Update data with ndarray

Parameters
  • index (InlineIndex)

  • data (2-d ndarray) – data for updating Inline

valid_cdp(cdp_num)[source]

Return valid CDP numbers nearest to cdp_num

pygeopressure.basic.survey module

Class for defining a seismic survey

Created on Fri Dec 11 20:24:38 2015

exception pygeopressure.basic.survey.DuplicateSurveyNameExeption[source]

Bases: Exception

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.

seis_json

associated seismic data information file.

Type

str

well_json

associated well data information file.

Type

str

wells

dictionary holding all Well objects.

Type

dict

seisCube

SeisCube object holding seismic data.

Type

SeisCube

inl_crl

well position in reference to seismic survey setting (inl/crl)

Type

dict

add_well(well)

add a well to survey

get_seis(well_name, attr, radius=0)[source]

get seismic data in the vicinity of a given well

get_seis(seis_name, well_name, radius=0)[source]

Get seismic trace data nearest to the well location.

get_sparse_list(seis_name, depth, log_name)[source]
sparse_mesh(seis_name, depth, log_name)[source]
pygeopressure.basic.survey.create_survey_directory(root_dir, survey_name)[source]

Create survey folder structure

Parameters
  • root_dir (str) – Root directory for storing surveys

  • survey_nam (str)

pygeopressure.basic.survey.get_data_files(dir_path)[source]

get all dot file with given path

dir_path: Path

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

static angle(x, y)[source]

Return angle from 0 to pi

x : tuple y : tuple

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)

coord_2_line(coordinate)[source]
draw_survey_line(ax)[source]
four_corner_on_canvas(canvas_width, canvas_height, scale_factor=0.8)[source]

get the coordinaiton of four corners of survey area on canvas

line_2_coord(inline, crline)[source]

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

exception pygeopressure.basic.threepoints.Not_threepoints_v2_Exception(message=None)[source]

Bases: Exception

class pygeopressure.basic.threepoints.ThreePoints(json_file=None)[source]

Bases: object

inline, crossline and z coordinates of three points in survey

pygeopressure.basic.utils module

some utilities

pygeopressure.basic.utils.methdispatch(func)[source]
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.utils.rmse(measure, predict)[source]

Relative Root-Mean-Square Error

with RMS(y - y*) as nominator, and RMS(y) as denominator

pygeopressure.basic.utils.split_sequence(sequence, length)[source]

Split a sequence into fragments with certain length

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

wiggle(values)[source]

Plot a trace in VAWT(Variable Area Wiggle Trace)

wiggles()[source]

2-D Wiggle Trace Variable Amplitude Plot

pygeopressure.basic.vawt.img(data, extent, ax, cm='seismic', ptype='seis')[source]
pygeopressure.basic.vawt.opendtect_seismic_colormap()[source]
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

Log

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

Log

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

Log

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

Log

get_pressure_normal()[source]

return pressure points within normally pressured zone.

Returns

Log object containing normally pressured measurements

Return type

Log

hydro_log()[source]
Returns

Hydrostatic Pressure

Return type

Log

property hydrostatic

Hydrostatic Pressure

Returns

Return type

numpy.ndarray

property lithostatic

Overburden Pressure (Lithostatic)

Returns

Return type

numpy.ndarray

property logs

logs stored in this well

Returns

Return type

list

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

plot_horizons(ax, color_dict=None)[source]

Plot horizons stored in well

rename_log(log_name, new_log_name)[source]
Parameters
  • log_name (str) – log name to be replaced

  • new_log_name (str)

save_params()[source]

Save edited parameters to well information file

save_well_logs()[source]

Save current well logs to file

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

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

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

classmethod from_scratch(depth, data, name=None, units=None, descr=None, prop_type=None)[source]
get_data(depth)[source]

get data at certain depth

get_depth_idx(d)[source]

return index of depth

get_resampled(rate)[source]

return resampled 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

to_las(file_name)[source]

Save as pseudo-las file

property top

top depth of this log

pygeopressure.basic.well_storage module

an interface to a hdf5 storage file

Created on Thu May 10 2018

class pygeopressure.basic.well_storage.WellStorage(hdf5_file=None)[source]

Bases: object

interface to hdf5 file storing well logs

this class is designed to accept only LasData.data_frame as input data

add_well(well_name, well_data_frame)[source]
get_well_data(well_name)[source]
logs_into_well(well_name, logs_data_frame)[source]
remove_well(well_name)[source]
update_well(well_name, well_data_frame)[source]
property wells

Module contents