depth_match

petrophys.preprocessing.quality.depth_match

Also available as petrophys.preprocessing.depth_match

depth_match(
well,
curve,
reference='GR',
*,
sign='positive',
max_shift=None,
local_shift=None,
window=None,
stiffness=0.5,
min_correlation=0.35,
min_gain=0.2,
local_gain=0.1,
top=None,
bottom=None,
)[source]

Match curve to reference in depth, the shift free to vary with depth.

In two passes, as Kerzner (1984) advises: the major shift first, then the detail. The bulk shift is the one whose windowed correlations have the highest median, so that many windows must agree, kept when that median is min_correlation or more and min_gain above the median as recorded. Around it, within local_shift, correlograms in short windows give candidate shifts at every depth, a window rewarded by how much better it correlates than at the bulk shift; dynamic programming keeps the consistent set. The result is a shift at every sample, for shift_curves().

Parameters:
  • well (Well) – Well carrying both curves (own or standard names: "DTC" finds DT).

  • curve (str) – Curve to move.

  • reference (str, default "GR") – Curve taken as on depth. Gamma ray is recorded on every logging pass so that passes can be tied to it.

  • sign ({"positive", "negative", None}, default "positive") – How curve follows the reference: in step ("positive"), mirrored ("negative": density against neutron, resistivity against gamma ray in clastics) or either, bed by bed (None).

  • max_shift (float, optional) – Largest bulk correction, in well depth units. Default 20 m (65.6 ft).

  • local_shift (float, optional) – How far the correction may vary around the bulk shift. Default 2 m (6.6 ft).

  • window (float, optional) – Length of the correlation window of the detail pass. Default 10 m (32.8 ft).

  • stiffness (float, default 0.5) – Cost of changing the shift by one sample from one window to the next, in units of correlation. Higher keeps the shift steadier (a bulk shift); lower lets it follow every wiggle.

  • min_correlation (float, default 0.35) – A correlogram maximum below this is not a candidate, and a bulk shift whose median windowed correlation is below it is not kept.

  • min_gain (float, default 0.2) – The bulk shift is kept when it raises the median windowed correlation by this much; otherwise the curves are taken as tied (bulk 0). On 621 density, neutron and sonic pairs of 221 wells the best shift raised it by less than 0.11 in 95 % of them.

  • local_gain (float, default 0.1) – A window counts towards a local shift by its correlation gain over the bulk shift beyond this margin: in a window of tens of samples a correlation varies by about this much from noise alone.

  • top (float, optional) – Depth window to match; the shift is 0 outside it.

  • bottom (float, optional) – Depth window to match; the shift is 0 outside it.

Return type:

DepthMatch

Examples

>>> import petrophys as pp
>>> from petrophys.preprocessing import depth_match, shift_curves
>>> hw3 = pp.read(pp.sample("HW-3"))
>>> match = depth_match(hw3, "RHOB", "NPHI", sign="negative")
>>> aligned = shift_curves(hw3, ["RHOB", "DTC"], match)