infer_pressure_contacts

petrophys.interpretation.saturation.height.infer_pressure_contacts

infer_pressure_contacts(
depth,
pressure,
*,
use=None,
depth_unit='m',
pressure_unit='bar',
depth_reference='TVDSS',
max_branches=3,
min_points=3,
min_depth_span=None,
pressure_noise=None,
fluid_density_ranges=None,
score_margin=6.0,
)[source]

Infer candidate gradients, fluid types and contacts without fluid codes.

Supply equilibrated formation-pressure picks on a positive-down TVD datum, from one prospective connected reservoir with a common pressure reference. use is an optional Boolean QC mask, never a fluid-interval mask. Nonfinite measurements are retained as unused in the row-aligned result.

Sort by depth, enumerate contiguous one/two/three-branch partitions and fit each branch by Huber IRLS. Minimize 2*Huber_loss + (3*k-1)*log(n): the penalty counts two line parameters per branch and k-1 split positions. The winning segmentation is chosen BEFORE density interpretation; the algorithm does not force the lowest branch to be water.

Convert dP/dTVD to fluid density and enumerate allowed gas/oil/water orders. Default screening ranges (g/cm3) are gas .02-.50, oil .45-1.05 and water .90-1.30. These overlapping, configurable heuristics are not universal fluid properties. Supply reservoir-condition PVT ranges where available; a subset of fluid names can express known phase presence/absence.

At least min_points distinct depths and min_depth_span per branch are required (defaults: 3 and 1 metre equivalent). pressure_noise is a positive assumed pressure error scale in the input unit (default .05 bar equivalent, NOT an instrument accuracy claim). It controls robust fitting, model selection, suspect flags and conditional sensitivity intervals.

Close scores across branch counts (difference < score_margin), overlapping phase hypotheses or weak gradient separation return ambiguity. Nonphysical gradients or intersections outside the station gap beyond their conditional sensitivity return inconsistency, possibly indicating separate compartments. Single gradients never produce FWL. Sampling/depletion/supercharging can mimic contacts; this is a reviewable interpretation, not proof of fluid identity or reservoir connectivity. No report contacts are accepted.