Workflows

With a well read and its geology attached (Your own data), one call interprets it. pp.interpret runs every step the available curves and settings allow, and records why the others were skipped. The last section, Review an interpretation, checks the answer before you use it.

Interpret a well

import pandas as pd
import petrophys as pp

well = pp.read(pp.sample("30_6-5"), formations=pp.sample("formations_30_6-5"))
result = pp.interpret(well, rw=0.07, rw_meas_temp="230 degF")  # Rw 0.07 ohm.m at 230 degF
result.status
'interpreted'
_images/fc5728e033935bc84e196e072a5014656e2f2f02a5c2aeee7435725e10918f49.png

Read the trace

Each step records its method, inputs, outputs, parameters and decisions. to_dataframe() gives one row per step; here are three key steps with their decisions.

trace = result.to_dataframe().set_index("Step")
trace.loc[["temperature", "rw", "saturation"], ["Method", "Decisions"]]
Method Decisions
Step
temperature linear_gradient_from_BHT Temperature profile anchored to BHT metadata/input | Gradient = 1.6354 F/100ft (29.81 C/km) | Temp range: 77.5 - 258.8 F
rw user_provided_temperature_profile_corrected Rw corrected from 0.0700 ohm.m @ 230F along the temperature profile
saturation archie+simandoux Saturation equations: Archie + Simandoux | SW = 1 at 3794 samples whose porosity is below 0.01 v/v, about what porosity tools resolve: without pore space no hydrocarbon is held, and a shaly-sand equation would otherwise read an Sw from its clay term alone | Saturation equation chosen at each depth from the clay volume and lithology (sw_model='auto') | Simandoux selected for shaly samples at routing salinity 30,489 ppm (>= 20,000 ppm) | Samples per equation: Archie 10472, Simandoux 11704 | Dual Water needs a supplied Rwb, which is not estimated: 1468 shaly carbonate samples used the Simandoux equation (set rwb to use Dual Water) | Archie coefficients from lithology (the lithology curve LITHOLOGY_GEOLINK) | Rw range = 0.0624 to 0.1967, Rcl = 2.906 ohm.m | SXO from invaded-zone Archie where RXO/RSHA/RESS and RMF were finite; SXO = SW^(1/5) elsewhere (invaded-zone Archie at 22079 samples, SW^(1/5) at 92 samples) | Sw range: 0.018 - 1.000

Skipped steps keep their reason:

result.specific_steps_skipped
{'spectral_gamma': 'Not run by the interpretation workflow; use petrophys.interpretation.geochemistry.interpret_spectral_gamma directly',
 'elemental_spectroscopy': 'Not run by the interpretation workflow; use petrophys.interpretation.geochemistry.interpret_elemental_spectroscopy directly',
 'hc_correction': 'apply_hc_correction=False (hydrocarbon correction is opt-in)',
 'porosity_refinement': 'Not run by the interpretation workflow; porosity is computed once in the porosity step'}

print_trace() prints the full record, and to_json() saves it.

The trace covers the whole well. group_records() splits it as a context package does, each formation into groups of one lithology, and gives every group its own record: the saturation routing and its reasons, Archie coefficients per lithology, Rw at temperature, Rcl, the SXO route and the cutoffs of its lithology family. These are the notes of the group’s context files:

for group in result.group_records():
    print(group["formation"], group["group"], group["top"], group["bottom"])
    print(group["notes"]["saturation"])

documents=True adds the group’s six context documents in full.

The steps

The pipeline runs in this order. Use these names in skip_steps.

from petrophys.workflow import workflow_steps

pd.DataFrame(workflow_steps())
name description
0 normalization Canonical curve aliases and units; implausible-value screening
1 temperature Formation temperature profile from BHT or a gradient
2 bad_hole Washout and density-correction quality flags
3 spectral_gamma Not run by pp.interpret; call petrophys.interpretation.geochemistry.interpret_spectral_gamma directly
4 elemental_spectroscopy Not run by pp.interpret; call petrophys.interpretation.geochemistry.interpret_elemental_spectroscopy directly
5 vclay Clay volume (VCL) from gamma ray, SP and neutron-density
6 rcl Clay resistivity from shale intervals
7 rmf Mud-filtrate resistivity at formation temperature
8 hc_correction Neutron-density hydrocarbon correction (opt-in)
9 porosity Density, neutron, sonic, total (PHIT) and effective (PHIE) porosity
10 lithology Mineral volumes: clastic multi-mineral or carbonate solve
11 porosity_refinement Not run by pp.interpret; porosity is computed once, in the porosity step
12 core_correction Porosity and permeability calibrated to core data
13 rw Formation water resistivity at formation temperature
14 invasion Invasion profile from shallow and deep resistivity
15 saturation Water (SW) and flushed-zone (SXO) saturation
16 permeability Core-calibrated or empirical permeability (PERM)
17 rock_quality Reservoir quality index (RQI), flow zone indicator (FZI)
18 bvw Bulk volume water
19 mhi Moveable hydrocarbon index
20 net_pay Net rock, net reservoir and net pay flags

Settings

Settings are DynamicWorkflowConfig fields, passed as keywords or as one config object. Invalid values fail before anything runs, with the accepted values:

try:
    pp.interpret(well, rw=0.07, rw_meas_temp="230 degF", sw_model="archy", hc_type="gass")
except ValueError as error:
    print(error)
Invalid DynamicWorkflowConfig:
  - hc_type='gass' is not valid; use one of: oil, gas (did you mean 'gas'?)
  - sw_model='archy' is not valid; use one of: auto, archie, north_sea, nigeria_schlumberger, simandoux, modified_simandoux, indonesia, dual_water, waxman_smits

The most-used settings, from config_schema(). Interpretation settings lists them all.

from petrophys.workflow import config_schema

settings = pd.DataFrame(config_schema()).set_index("name")
settings.loc[["rw", "rw_meas_temp", "bht", "lithology_domain", "matrix_type", "gr_min",
              "gr_max", "sw_model", "vcl_cutoff", "phie_cutoff", "sw_cutoff", "skip_steps"],
             ["default", "description"]]
default description
name
rw None Formation water resistivity Rw, ohm.m, at rw_meas_temp.
rw_meas_temp None Temperature of rw, e.g. "230 degF" or "110 degC". When omitted, rw is taken at the median formation temperature, as recorded in the trace; either way the RW curve follows the temperature profile from that point. Set without rw under "current", it is the measurement temperature of the LAS header RW, in place of the header RWT; with neither rw nor a header RW it is not used, with a warning.
bht None Bottom-hole temperature, e.g. "230 degF" or "110 degC". Defaults to the LAS header BHT. It is taken as the static formation temperature at TD, with no correction for mud circulation (such as a Horner plot). Set, the temperature profile follows it rather than an input TEMP log (kept as TEMP_LOG).
lithology_domain None Broad interpretation domain: "clastic" (the default when unset), "carbonate", "evaporite" or "auto". This selects the mineral-solving family and cutoff defaults; it is distinct from per-depth lithology. "evaporite" runs the clastic mineral solve (anhydrite among its minerals) with an automatic matrix that no family limits, and clastic cutoffs; evaporite samples are left out of net pay. A matrix left unset follows the domain, also when the domain is changed on a copy of the config. A rock name ("dolomite", "chalk", "anhydrite" ...) sets its family as the domain and, when matrix_type is unset, the rock as the matrix where it has matrix properties.
matrix_type None "auto" (resolved from lithology evidence) or a mineral name such as "sandstone", "limestone" or "dolomite"; see petrophys.model.constants.MatrixProperties.names. Default: "sandstone" in the clastic domain, otherwise "auto" within lithology_domain. It gives the matrix endpoints of the porosity logs where no lithology group is known, and the clean line of VCL_ND. On a well with a lithology log or lithology intervals the group of each depth sets the matrix there, so matrix_type changes the porosity of few samples; rho_ma, nphi_ma and dt_ma hold at every depth.
gr_min None Clean-rock gamma-ray endpoint, API, used as given. None picks P5 of the log, lowered to 20 API when higher (a guard against a nearly flat GR, reported in the trace as gr_min_used, with a warning when the pick is above 30 API).
gr_max None Shale gamma-ray endpoint, API, used as given. None picks P95 of the log, raised to 100 API when lower.
sw_model auto "auto" (routed per sample by clay content) or one of "archie", "simandoux" (Sw in the clay term, Bardon-Pied), "modified_simandoux" (sand term over 1 - Vcl), "indonesia", "dual_water", "waxman_smits", "north_sea", "nigeria_schlumberger".
vcl_cutoff None Maximum clay volume for net rock, v/v. Unset, each sample takes the standard of its lithology family (STANDARD_CUTOFFS: 0.40 clastic, 0.30 carbonate); the "geolink" profile uses 0.3. Each cutoff takes one value, or one per family, e.g. {"clastic": 0.35, "carbonate": 0.2} (a lithology name stands for its family; "*" for the others); a family left out takes the LAS header's value, else its standard. Unless sw_routing_vcl_cutoff is set, saturation switches to a shaly-sand model above this clay volume, or above 0.3 when it is unset. The same clay volume bounds the reservoir flag that picks the SWIRR_APP samples (built when swirr is unset and the well has no SWIRR curve or NMR Swirr), so vcl_cutoff also changes SW, PERM, RQI and FZI, not only net pay.
phie_cutoff None Minimum effective porosity for net reservoir, v/v. Unset: 0.08 clastic, 0.045 carbonate. It is also the least porosity of the reservoir flag that picks the SWIRR_APP samples (unset: 0.08 in every lithology under "current"), built when swirr is unset and the well has no SWIRR curve or NMR Swirr, so it changes PERM, RQI and FZI, not only net pay.
sw_cutoff None Maximum water saturation for net pay, v/v. Unset: 0.60 clastic, 0.70 carbonate; 0.7 under the "geolink" profile.
skip_steps [] Workflow steps to skip, e.g. ["permeability"]; see WorkflowStep for the names. A skipped step writes none of its curves, and the steps that read them are not skipped with it: one that finds its inputs missing is skipped with the reason, and one that runs without them fails. Skipping "rw" leaves saturation without an Rw: the saturation step fails and the run's status is "failed", so skip the steps that depend on a skipped step as well.

Net-pay cutoffs left unset take the standard of each sample’s lithology family: clastic VCL < 0.40, PHIE > 0.08 and SW < 0.60; carbonate VCL < 0.30, PHIE > 0.045 and SW < 0.70. Evaporite, coal, halite recognized on the logs and bad-hole samples are never net reservoir or net pay. The cutoffs actually used shows where to read both in the trace, and Where the pay sits why a whole-well total can include marginal pay in shallow sections: read net pay per formation or over the reservoir interval.

Calculation profiles

calculation_profile selects an interpretation configuration. "current" is the default; "geolink" provides the GeoLink evaluation configuration. Explicitly supplied settings take precedence over profile defaults. result.summary()["settings_used"] records the settings you supplied and the calculation_profile; values the profile itself applies, such as its net-pay cutoffs, show as None there and are recorded in the step decisions of the trace.

A dataset context_profile (geolink, geolink_train, costa or danish) goes further: it supplies the preparation, interpretation, calibration and grouping rules of a published context package (Reproducing the benchmark packages). An MCP server can pin the calculation profile for every call (LLM agents (MCP)).

Settings, header values and input curves

Every setting has a default, and a value you set is used as given. The order is: a setting you set, then a LAS header value, then the default (for the “geolink” profile, its own default). This holds for every route: pp.interpret(well, **settings), pp.interpret(well, config), run_dynamic_workflow, the batch processor, the zoned runner and pp.export_context(workflow_config=...). A setting you pass counts as set even when it equals the default (rho_cl=2.45 keeps 2.45 against a header RBSH), also on a copy made with dataclasses.replace. Archie a, m, n and the net-pay cutoffs left unset follow each sample’s lithology (Archie) or lithology family (cutoffs). A single value, yours or the LAS header’s (M, SW_CUTOFF, …), holds for every sample. Set one per lithology and each sample takes its own; a lithology you leave out takes the header’s value if there is one (M_Z1 inside its zone), else its default, and "*" gives your value for every lithology not listed:

result = pp.interpret(well, m={"sandstone": 1.8, "carbonate": 2.3},
                      sw_cutoff={"clastic": 0.5, "carbonate": 0.65})

Archie keys are lithologies of the Archie table (sandstone, limestone, dolomite, shale, silt, aliases such as sand) or a family (clastic, carbonate) for every lithology in it; cutoff keys are families, a lithology name standing for its family. The trace lists the values each lithology got (archie_coefficients in the saturation step, cutoffs_by_family in the net-pay step).

Settings can differ by depth: pass zones, a list of intervals each with its settings, or a table or CSV/Excel file with top, bottom and one column per setting (an empty cell sets nothing; name and depth_unit are optional):

result = pp.interpret(well, rw=0.07, rw_meas_temp="230 degF", zones=[
    {"name": "overburden", "top": 176, "bottom": 1908, "rw": 0.5, "rw_meas_temp": "60 degF"},
    {"name": "Brent Group", "top": 2841, "bottom": 2958, "m": 1.9},
])

Each zone’s settings are run over the whole well and its depths merged in, so a zone changes what its settings change and nothing else: the picks taken from the data (GR baselines, irreducible water saturation, the core model) stay those of the whole well. result.zone_results holds one run per distinct set of zone settings (its zone_names name the zones it computed), and result.warnings their messages. Zones may not overlap; whole-run settings such as calculation_profile, skip_steps and the lithology inputs cannot differ by zone; a zone outside the logged depths is noted and not used. A zone can also be just a name and its depths, your own segmentation of the well (reservoir zones, flow units, facies). Such a zone changes nothing in the interpretation; it names the interval. One sheet can hold the zones of several wells, with a well column:

well

zone

top

bottom

m

HW-3

Upper reservoir

7600

7800

HW-3

Lower reservoir

7800

8020

2.1

HW-4

Main

8050

8330

result = pp.interpret("HW-3.las", zones="zones.xlsx")   # the HW-3 rows apply
result.zone_summary()                                    # one row per zone: gross, net, pay averages
pp.export_context("wells/", "context/", layout="package", zones="zones.xlsx")

zone_summary has the columns of formation_summary. In the context export the zones take the place of the formations: each zone is split into lithology groups, or is one group with split_by_lithology=False, written to <category>/<well>/<zone>/. Its documents carry zone_info and zone_name, and the lithology distribution of the group. A well with no row in the table is grouped by its formations, with a warning.

Package groups

split_by_lithology=True (default)

split_by_lithology=False

formations=

formation × lithology

one group per formation

zones=

zone × lithology

one group per zone

neither

lithology runs over the whole well

the whole well

The full order is: your zone values inside their zone, then your whole-well settings, then LAS header zone values (RW_Z1, M_Z1, … with TOP_Z1/BOT_Z1) inside their zone, then LAS header whole-well values, then the defaults. A header value one of yours overrides is named in the warnings. The same order holds on every route; DynamicWorkflow(config).run alone uses the config as given, without the header. An explicit setting wins over a LAS header value: rw over the header RW, salinity_ppm over the header RW, rw_meas_temp over the header RWT, and rm, rmf_salinity_ppm and rmf_chlorides_mg_l over the header RMF and CLFL (a value pp.interpret copied from the header, such as CLFL, ranks with the header, below a direct RMF). phi_cl, rmf_meas_temp and rm_meas_temp are unset (None) by default and resolve to 0.15 v/v and 75 degF, so an explicit value, including one equal to the default, is always used. Zone-only header parameters (RW_Z1 with TOP_Z1/BOT_Z1) apply inside their zone; outside it the whole-well settings and header values are used, and the trace and warnings say so. A zone whose TOP_Z1/BOT_Z1 span every depth of the well replaces the header value everywhere, in pp.interpret as in the zoned runner, and a warning names both values when they differ. Header values are converted from their units: TD from its own depth unit (the well’s depth unit when it has none), RHO_MA/RHO_FL from kg/m3 (KG/M3, K/M3) or lb/ft3, and salinity from ppm, ppk, ppt (g/kg), mg/l, g/l or %; a salinity in a unit not on that list is not used, with a warning. Settings outside their physical range are refused: temperatures below absolute zero, bht below surface_temp, rho_ma outside 1.5-3.5 g/cm3 or not above rho_fl, rho_fl outside 0-2 g/cm3, nphi_ma outside -0.1 to 0.5 and salinity_ppm outside 0-400,000 ppm. rw_meas_temp given without rw is the measurement temperature of the header RW, replacing its RWT. A measured TEMP log with at least half of its samples finite is the temperature source, with the modelled gradient filling its gaps; a sparser log is kept as TEMP_LOG and the modelled profile is used. With bht or surface_temp set, the modelled profile is used and the log is kept as TEMP_LOG. Set rho_ma, dt_ma or nphi_ma and it holds at every depth, also where a lithology log would give each group its own matrix value. The SP-derived Rw uses sp_max and sp_min as its clean-sand and shale lines when they are set. With apply_hc_correction=True, the porosity step reads the hydrocarbon-corrected NPHI_HC and RHOB_HC. The correction scales with the flushed zone’s hydrocarbon (1 - SXO) and runs before the saturation step, so it needs an input SXO curve; without one it is skipped with a warning.

With depth_check=True, the porosity step first matches density, neutron and sonic to each other with depth_match and warns when one of them lines up with the others only after a depth shift; the curves stay as recorded (see Curves off depth).

Three settings take a mapping, so you give only the values you change and the rest keep their defaults:

result = pp.interpret("well.las",
    bad_hole={"cali": 2.0, "drho": 0.20},                  # CALI - BS (in), |DRHO| (g/cm3), large_hole bit size (in)
    perm_coefficients={"a": 0.1, "b": 4.0, "c": 2.0},      # of the equation perm_method selects
    mineral_endpoints={"quartz": {"rhob": 2.65, "nphi": -0.04}, "water": {"nphi": 1.0}},
)

Setting

Keys

Defaults

bad_hole

cali, drho, large_hole

1.5 in, 0.15 g/cm3, 17.5 in

perm_coefficients

a coefficient, b porosity exponent, c Swirr exponent

Timur 0.136, 4.4, 2; Coates-Denoo 10000, 4, 2; Wyllie-Rose 62500, 6, 2

mineral_endpoints

per quartz, calcite, dolomite, anhydrite, clay, water: rhob, nphi, pef, u, dt

the built-in mineral table; water from rho_fl and dt_fl

The bad-hole thresholds also set the BAD_HOLE band of pp.plot and the bad-hole notes of a context export, the coefficients appear in the permeability trace and notes, and the endpoints apply to the clastic mineral solve. Like any other setting they can differ by zone (zones=[{"top": ..., "bottom": ..., "bad_hole": {"cali": 2.0}}]), and the LAS header can give them one value at a time (BADHOLE_CALI, PERM_A, QUARTZ_RHOB, …; Input templates). Each key follows the same order as any other setting: your zone values, your whole-well values, the header zone values, the header values, the defaults. PHIE_CC is written by the core-correction step alone, before saturation, so SW, BVW, net pay and RQI read the same porosity; the step runs on core porosity named PHIC, CPOR, CPOR-AMB or CPOR_AMB, or on peer-well core (use_peer_core=True with peer_wells). A peer well needs PHIE or PHIT (interpret it first; one without is left out, with a warning), and its formations may be attached with pp.read(..., formations=...). When the run fits its own core model, input PHIE_CC and PERM_CC curves are kept as PHIE_CC_INPUT and PERM_CC_INPUT and not used; without core data, or with core_correction in skip_steps, input PHIE_CC and PERM_CC are used as they stand by every step, and a warning says so. PHIE_CC and PERM_CC are written over the whole well, from each formation’s own core model where the tops table gives it one and from the whole-well model elsewhere. PERM_CC is written where the core-corrected porosity lies within the porosity range of the plugs behind the poro-perm fit and the clay volume is at or below the net-rock clay cutoff, since a porosity-permeability transform describes reservoir rock, not shale; the trace of the core-correction step gives the limits. The summaries read PHIE_CC and PERM_CC where they are written and PHIE and PERM at the other samples.

A carbonate run (lithology_domain="carbonate") with no core permeability, its own or of peer wells, and no input PERM_CC warns that PERM has no core calibration. lithology_domain="auto" without a lithology log or core matrix evidence is settled before the core-correction step, from the mineral solver’s volumes or else the clastic default, so Rw, SW and net pay use the domain that result.config reports. Without a clay indicator (gamma ray, SP or neutron-density) net pay assumes VCL = 0, and a warning says so. The "geolink" profile keeps the GeoLink eval package’s calculation in each case.

Clay volume

pp.interpret takes VCL as the minimum of the gamma-ray and neutron-density indicators, VCL_GR and VCL_ND. VCL_ND is measured from the neutron-density clean line of the run’s matrix, to a clay point picked in the well’s good-hole shales: the median RHOB and NPHI of 20 or more shale-lithology samples, else of the samples with VCL_GR above 0.9, else (2.62 g/cm3, 0.38). One median over the whole log is lighter than the shales of a deep reservoir where shallow, undercompacted shale dominates, so set nd_clay from a crossplot of the interval you evaluate. A clay point less than 0.10 v/v of neutron above the clean line leaves VCL_ND out of VCL, with a warning.

VCL_SP is reported, and joins the minimum only when you set both SP baselines: sp_min, the shale baseline, and sp_max, the clean-sand line. Both are constant lines over the whole log, so set them only for an SP without baseline drift, such as a drift-corrected SP. Equal baselines are rejected, and a warning flags baselines whose order contradicts the SP polarity (read from the SP and GR, and taken as normal where they do not show it).

Water saturation

With sw_model="auto" (the default), saturation is routed per sample. Samples with VCL below sw_routing_vcl_cutoff (by default vcl_cutoff, or 0.3 when that is unset) get Archie; the same clay volume bounds the samples SWIRR_APP is picked from. With vcl_cutoff unset, routing switches at 0.3 while clastic net rock extends to VCL 0.40, so net rock with 0.3-0.4 clay gets a shaly-sand equation. In shaly rock, carbonate samples get Dual Water when the bound-water resistivity rwb is given; Rwb is never estimated.

Where the porosity SW is computed on is below 0.01 v/v, about what porosity tools resolve, there is no pore space to hold hydrocarbon, and SW and SXO are 1 whatever the equation returns; a shaly-sand equation would otherwise read an Sw of its clay term alone in shale. The saturation step’s trace counts those samples. All other shaly samples get Waxman-Smits when cec (meq/100 g) and b_coeff ((S/m)/(meq/cm3)) are given, Simandoux when the formation-water salinity is at least 20,000 ppm (salinity_ppm, or else the salinity of the given or header Rw at its temperature), and otherwise Indonesia, the published equation of Poupon and Leveaux (1971). On 30/6-5, Rw 0.07 ohm.m at 230 degF is a water of about 30,500 ppm, so shaly samples get Simandoux. sw_model="dual_water" without rwb, or "waxman_smits" without cec and b_coeff, fails the saturation step with a message naming the missing input. With oil-based mud (mud_type="OBM"), no SXO or MHI is computed and Rw is not estimated from the SP or Rxo/Rt.

One setting apart, the saturation model changes the Brent Group answer. Dual Water and Waxman-Smits are left out here, as 30/6-5 gives no rwb, cec or b_coeff:

runs = {model: pp.interpret(well, rw=0.07, rw_meas_temp="230 degF", sw_model=model)
        for model in ["archie", "simandoux", "indonesia", "auto"]}
pd.DataFrame({model: run.summary(top=2841, bottom=2958)["net_thickness"]
              for model, run in runs.items()})
archie simandoux indonesia auto
depth_unit m m m m
net_rock 76.500 76.500 76.500 76.500
net_res 65.990 65.990 65.990 65.990
net_pay 25.150 29.720 30.630 26.060

Lithology domain

lithology_domain picks the mineral solver and keeps the automatic matrix within its family. It defaults to clastic: set carbonate for carbonate wells. It is not a per-depth rock label: lithology intervals from Input templates supply those, else a lithology code curve in the LAS, and both take precedence over computed labels.

Domain

Mineral solver

Needs

clastic (default)

multi-mineral solve (MultiMineralSolver): each tool equation weighted by its nominal uncertainty, and samples whose mineral total misses the available rock volume by more than 0.05 left unsolved; quartz, calcite, dolomite and anhydrite with PEF (sonic beside it), quartz, calcite and dolomite from RHOB and NPHI without it; PEF set aside when it reads like barite-weighted mud; where NPHI is missing, porosity solved with the minerals from RHOB and PEF (quartz and calcite, or calcite and dolomite in carbonate); sandstone matrix

RHOB, NPHI or PEF, DTC, VCL, PHIE

carbonate

calcite and dolomite from bulk density and closure, with clay from VCL at rho_cl and pore fluid rho_fl; carbonate_calibration="costa" applies the COSTA field calibration instead (illite from GR at 2.52 g/cm3 and a 1.1 g/cm3 brine, unless rho_cl or rho_fl is set); limestone or dolomite matrix

RHOB, VCL (GR for costa), PHIE or PHIT

evaporite

the clastic mineral solve (anhydrite among its minerals); an automatic matrix with no family limit, taken from the lithology log or core where they exist, halite endpoints where the logs read like halite; clastic cutoffs, with evaporite, halite and anhydrite samples left out of net reservoir and pay. On a well whose matrix resolves to sandstone it gives the clastic result

as clastic

auto

resolved from attached or embedded geology; falls back to clastic with a warning

If the data point to a carbonate while the domain is clastic, the run keeps the sandstone matrix and warns you to set lithology_domain="carbonate".

The lithology code curve is the curve lithology_curve names, else LITHOLOGY_GEOLINK, else the first curve under a lithology-code name (LITHOLOGY, LITHOFACIES, FACIES, LITH_CODE, ROCK_TYPE, …) whose values pass the code checks in Input templates. That one curve gives the vendor lithology, the "auto" matrix and the per-depth lithology groups, and its codes are decoded with the built-in lithology code table (Kingdom nomenclature) whatever the curve is called. result.warnings names a curve other than LITHOLOGY_GEOLINK; if it holds other codes, pass its codebook as lithology_codes, or lithology_source="computed", or lithology intervals.

The carbonate solve uses bulk density alone, so its calcite-dolomite split depends on the pore-fluid density rho_fl (1.0 g/cm3 by default, 1.1 with carbonate_calibration="costa"; a value you set is used by porosity and the mineral solve alike) and on the matrix density behind the porosity. On HW-3 the generic defaults put nearly nine samples in ten at the calcite end member, with no dolomite; set rho_fl for your brine, and use the field calibration on COSTA wells. Here the clastic run on 30/6-5 is set against a carbonate run on the COSTA well HW-3:

# Rw comes from the LAS header; COSTA wells take the field's own calibration.
hw3 = pp.interpret(pp.read(pp.sample("HW-3")), lithology="carbonate",
                   carbonate_calibration="costa")
pd.DataFrame({name: {"method": run.step("lithology").method,
                     "outputs": run.step("lithology").output_curves}
              for name, run in {"30/6-5": result, "HW-3": hw3}.items()})
30/6-5 HW-3
method multi_mineral_solver costa_calcite_dolomite_density_closure
outputs [VQUAR, VCALC, VDOLO, VANHY] [VQUAR, VCALC, VDOLO, VANHY, VILL, LITHO]
pp.plot(hw3, tracks=["GAMMA / HOLE", "DENSITY / NEUTRON", "MINERAL VOLUMES"])
_images/7c92feb35f392d056c299af6e97e7efbac97d58f3bb51937d48c3c30bf2ff88b.png

The carbonate solve is closed-form over whole arrays, through the apparent matrix density (Clavier and Rust, 1976), so a whole well takes well under a second; the “geolink” calculation profile keeps the COSTA notebooks’ sample-by-sample solve, which takes about a second on a COSTA interval but minutes on a whole well. Where the solved volumes miss RHOB by more than 0.02 g/cm3 (an apparent matrix density outside calcite-dolomite, such as quartz, anhydrite or bad hole), mineral volumes are NaN and QC-flagged; closure alone does not prove a mineral model right.

Zoned and batch runs

pp.interpret("logs/", formations="tops.xlsx") interprets every well of a folder (or a pattern, or a list of wells) with the same settings and returns one result for them all: summary() and formation_summary() give one table across the wells, to_las(folder) and save_plots(folder) a file per well (Quickstart). process_las_directory_with_workflow() interprets every LAS file in a folder and writes the interpreted LAS plus a JSON trace per well. Each file runs through run_dynamic_workflow_with_zones(), where LAS header values fill settings you leave unset. Header zones such as TOP_Z1, BOT_Z1, RW_Z1 re-run their depth range with their own settings, from the input curves rather than the whole-well run’s results; a curve the zone run did not compute (for example PHIE_CC where the zone holds too few core plugs) is NaN in the zone after the merge, and a warning names it.

Here the three COSTA wells HW-3, HW-4 and HW-5 of the bundled COSTA folder are interpreted into interpreted/, and write_batch_report() writes one CSV row per file:

from pathlib import Path
from petrophys.workflow import process_las_directory_with_workflow, write_batch_report

costa_folder = Path(pp.sample("HW-3")).parent
batch = process_las_directory_with_workflow(
    costa_folder, "interpreted", pattern="HW-[345].las",
    config=pp.DynamicWorkflowConfig(lithology_domain="carbonate", carbonate_calibration="costa"))
report = pd.read_csv(write_batch_report(batch, "batch_report.csv"))
report[["output_file", "success", "zones_applied", "rw_methods", "rw_values"]]
output_file success zones_applied rw_methods rw_values
0 interpreted/HW-3.las True 0 base:las_metadata_temperature_profile_corrected base:0.0202661-0.0206553
1 interpreted/HW-4.las True 0 base:las_metadata_temperature_profile_corrected base:0.0207504-0.0210703
2 interpreted/HW-5.las True 0 base:las_metadata_temperature_profile_corrected base:0.0252574-0.0256197

Failed files are reported, not raised. write_curve_audit_report() adds a CSV report of the curves. For wells already in memory, BatchProcessor runs the same workflow on each, with the settings as a dict: BatchProcessor(config={"lithology_domain": "carbonate"}).process_wells(wells).

Run selected steps

DynamicWorkflow.run_selected_steps runs a subset in pipeline order. Unlike pp.interpret, it adds curves to the well you pass.

from petrophys.workflow import DynamicWorkflow, WorkflowStep

workflow = DynamicWorkflow(pp.DynamicWorkflowConfig(rw=0.07, rw_meas_temp="230 degF"))
partial = workflow.run_selected_steps(pp.read(pp.sample("30_6-5")),
                                      [WorkflowStep.VCLAY, WorkflowStep.POROSITY])
partial.to_dataframe()[["Step", "Method", "Output Curves"]]
Step Method Output Curves
0 input_context validated_geology_selection
1 vclay linear VCL, VCLAY, VCL_GR, VCLGR, VCL_SP, VCLSP, VCL_ND, VCLND
2 porosity component_based PHIN, PHID, PHIS, PHIT, PHIE, PHI_SEC

Review an interpretation

A completed run shows that the calculations ran; it does not make the numbers a calibrated interpretation. The checks below run on 30/6-5 again, with its lithology intervals attached as well as its tops.

Read the warnings first

well = pp.read(pp.sample("30_6-5"), formations=pp.sample("formations_30_6-5"),
               lithology=pp.sample("lithology_30_6-5"))
result = pp.interpret(well, rw=0.07, rw_meas_temp="230 degF")
result.warnings
['Held readings, one value repeated exactly over ten samples or more: RHOB 1.8 over 180.42-242.752 m (411 samples), RSHA 7.012 over 3537.94-3555.32 m (116 samples), RHOB 1.9602 over 1461.19-1468.66 m (51 samples), GR 187.5 over 3548.77-3556.08 m (50 samples), RHOB 1.899 over 529.416-536.274 m (47 samples) and 28 more. A tool that stopped reading, or a log padded to a depth, holds its last value while the other logs change; check these against the other logs before using them.',
 'Marl uses the limestone matrix and carbonate cutoff family. This is a routing convention, not a calibrated marl model; check clay correction and supply project-specific cutoffs.',
 'External lithology: unmapped labels [], 30 uncovered samples. Labels/gaps are preserved; unclassified samples use configured calculation fallbacks, not inferred rock labels.',
 'lithology: PEF set aside: in 96% of 259 clean porous samples the apparent matrix density is quartz-like (< 2.67 g/cm3) but the apparent matrix U calcite-like (> 10 b/cm3), the signature of barite-weighted mud; minerals solved without PEF',
 "Bad hole removed 53.93 m of net pay (BAD_HOLE at 12631 of 22176 samples). Check the flag against the caliper and DRHO; bad_hole={'drho': ..., 'cali': ...} sets its thresholds and skip_steps=['bad_hole'] keeps the pay.",
 'Net pay where the gamma ray reads shale and neutron-density clean, VCL_GR above VCL_ND by more than 0.5: 2805.05-2805.66 m (VCL_GR 0.78, VCL_ND 0.15), 3272.77-3273.07 m (VCL_GR 0.72, VCL_ND 0.05). VCL takes the lower value, so these beds count as clean rock; check the density and neutron there (a density read too light in bad hole or near a casing shoe, gas, heavy minerals).',
 "The LAS header gives rw_meas_temp=(230.0, 'degF'); not used, rw_meas_temp='230 degF' is set"]

This page hides one more message, a Python warning raised each time the percent core saturations are converted (Core saturation units).

A review checklist

Check

Where to look

Inputs: expected curves, right units

well.describe(); DataQualityWarning messages

Rw and its temperature

pass rw_meas_temp with rw; the rw step in the trace

Clay volume: the gamma-ray endpoints (gr_min, gr_max; picked from the log when unset, see Input templates) and the neutron-density clay point (nd_clay, Clay volume)

the vclay step in the trace

Porosity and saturation: core agreement; the core porosity correction, used only when its fit has at least 8 core-log pairs, a positive slope and r² of at least 0.5; the chosen Sw model

result.print_trace(), the core_correction and saturation steps

Hole quality: bad-hole samples are left out of net reservoir and pay; where no bit size is known, only DRHO can flag them

the BAD_HOLE curve next to the pay flags; the warnings and sample counts of the bad_hole step

Cutoffs: project values instead of the lithology-family standards

the net_pay step parameters

Geology: formation and lithology files are optional

logs drive the workflow; a formation name never creates logs or mineral fractions

Calculation profile: the interpretation configuration selected for your task

result.config.calculation_profile; see Calculation profiles

Do not tune Rw just to get the pay you expect.

Implausible inputs and bad hole

DataQualityWarning flags values a curve’s unit cannot explain, and says what was removed:

checked = pp.interpret(pp.read(pp.sample("15_9-14")))
checked.status
DataQualityWarning: DTE: 20181 of 20181 samples are outside the plausible DTE range 20
    to 600 us/ft and were removed.
DataQualityWarning: RSHA: 13 of 20295 samples sit at the curve's maximum 2000 ohm.m, a
    tool or computation ceiling rather than a reading, and were removed.
DataQualityWarning: RXO: 6 of 4059 samples sit at the curve's maximum 2000 ohm.m, a tool
    or computation ceiling rather than a reading, and were removed.
DataQualityWarning: RMED: 13 of 20295 samples sit at the curve's maximum 2000 ohm.m, a
    tool or computation ceiling rather than a reading, and were removed.
'interpreted'

The run continues without those samples, and the messages stay in result.warnings.

pp.interpret raises the lower limit of the DTC range and adds one for SP. Compressional slowness (DTC) below 38.5 us/ft is removed: no rock matrix is faster (dolomite is 38.5-43.5 us/ft, calcite 43.5-47.6 and quartz 51-55.5; Schlumberger, 1989), so a lower value is a unit or scale error. SP beyond ±500 mV is removed: a formation’s static SP lies within about 200 mV of the shale baseline, so such readings come from the tool or the recording. The workflow also checks these inputs:

Input

What Petrophys does

Header bit size outside 3-36 in (a null such as -999.25, or a value in mm)

Ignored, with a warning

No bit size at a sample, from the BS curve or a 3-36 in header value

No size is assumed: the caliper washout test (CALI more than 1.5 in over the bit size) and the large-hole test (bit size above 17.5 in) do not run there, so BAD_HOLE there comes from an absolute DRHO above 0.15 g/cm3 alone. A warning names the depths where a caliper reading has no bit size

A caliper, but neither a bit size nor DRHO

The bad_hole step is skipped, with the reason in result.specific_steps_skipped, and no BAD_HOLE curve is written

Logs that read like halite where no lithology code says evaporite: RHOB 1.95-2.15 g/cm3, GR below 15 API, RT above 500 ohm.m (or, without RT, a caliper more than 0.5 in under the bit size), and NPHI at most 0.05 and PEF 4.0-5.5 where logged

Porosity uses the halite endpoints; the samples are left out of net reservoir and pay

Neutron readings beyond both the clean line’s 40 p.u. end point and the clay point, as in undercompacted mudstone

VCL_ND is left undefined there, and VCL comes from the other indicators

A log that repeats one reading exactly over ten samples or more (a tool that stopped reading, a log padded to a depth); calipers are not checked

A warning names the curve, the value and the depths; the readings are kept

Net pay where VCL_GR exceeds VCL_ND by more than 0.5 over three samples or more

A warning names the depths: VCL takes the lower value, so a radioactive bed counts as clean; the density may read too light (bad hole, a casing shoe), or gas or heavy minerals move the neutron-density point

A neutron in sandstone or dolomite units (NPSS, CNSS, NPHI_SS)

Converted to the limestone scale along the chartbook’s lines (Schlumberger Por-11), with a warning

BAD_HOLE = 1 marks washout or large hole, where density and neutron readings, and the PHIE and SW built on them, are unreliable. Each sample’s bit size is the BS curve, else a 3-36 in header value, which also fills gaps in the BS curve. An absolute DRHO above 0.15 g/cm3 flags washout wherever DRHO is logged, also in a well without a caliper. The bad_hole step records where its bit sizes came from (bit_size_source) and counts the samples without a bit size (no_bit_size_samples), the samples given the caliper test (caliper_test_samples) and the samples neither test reaches (not_assessed_samples), where BAD_HOLE stays 0.

Rw needs its temperature

Without rw_meas_temp, Rw is taken at the well’s median formation temperature, recorded in the rw step and in result.warnings. On 30/6-5 the median formation temperature is 168 degF, not 230 degF, so the same 0.07 ohm.m stands for a saltier water: Rw in the reservoir reads lower, Sw lower, and the Brent Group net pay rises from 23.0 m to 24.8 m.

assumed = pp.interpret(well, rw=0.07)  # no temperature given
[text for text in assumed.warnings if "rw_meas_temp" in text]
['Rw 0.07 ohm.m was given without rw_meas_temp: it is taken at the median formation temperature, 168.1 degF.']
pd.DataFrame({"Rw at 230 degF": result.summary(top=2841, bottom=2958)["net_thickness"],
              "Rw at the median temperature": assumed.summary(top=2841, bottom=2958)["net_thickness"]})
Rw at 230 degF Rw at the median temperature
depth_unit m m
net_rock 70.560 70.560
net_res 57.910 57.910
net_pay 23.010 24.840
pp.plot({"Rw at 230 degF": result, "Rw at the median temperature": assumed},
        curves=["RW", "SW"], top=2841, bottom=2958)
_images/2c7ac2f6090b1d7499957b742ac7da07481cc0e311cc3ce7181e5de7cd8704f1.png

Where the pay sits

NET_ROCK, NET_RES and NET_PAY are cutoff flags, not confirmed hydrocarbons. Summarize them per group before trusting a total:

groups = result.formation_summary(rank="group")
groups
Formation Top Bottom Gross (m) Net Rock (m) Net Reservoir (m) Net Pay (m) N/G (reservoir) Pay/Gross Avg PHIE ... Avg GR Avg RHOB Avg NPHI Avg RDEP Avg PHIT HCPV BVW Samples Pay Samples Data Coverage %
0 NORDLAND GP. 181.000 726.000 544.982 160.325 0.000 0.000 0.000 0.000 NaN ... 58.417 1.901 NaN 5.409 0.452 NaN NaN 3576 0 100.000
1 HORDALAND GP. 879.000 1908.000 1029.005 1017.575 536.448 0.610 0.521 0.001 0.427 ... 39.165 1.958 0.522 0.969 0.463 0.108 0.250 6752 4 100.000
2 ROGALAND GP. 1908.000 2203.000 295.047 247.650 111.252 0.000 0.377 0.000 NaN ... 48.754 2.215 0.418 1.015 0.334 NaN NaN 1936 0 100.000
3 SHETLAND GP. 2203.000 2408.000 204.978 15.850 8.077 0.152 0.039 0.001 0.353 ... 57.746 2.391 0.368 1.412 0.259 0.020 0.225 1345 1 100.000
4 CROMER KNOLL GP. 2408.000 2452.000 44.043 21.488 11.278 0.000 0.256 0.000 NaN ... 49.309 2.489 0.293 1.613 0.195 NaN NaN 289 0 100.000
5 VIKING GP. 2452.000 2841.000 388.925 14.326 0.762 0.152 0.002 0.000 0.287 ... 98.199 2.453 0.372 4.039 0.228 0.019 0.163 2552 1 100.000
6 BRENT GP. 2841.000 2958.000 117.043 70.561 57.912 23.013 0.495 0.197 0.216 ... 60.025 2.388 0.242 8.341 0.200 3.700 0.055 768 151 100.000
7 DUNLIN GP. 2958.000 3223.000 265.024 10.516 0.152 0.000 0.001 0.000 NaN ... 92.734 2.573 0.271 5.356 0.145 NaN NaN 1739 0 100.000

8 rows × 23 columns

pp.bar_chart(groups["Formation"], groups["Net Pay (m)"], horizontal=True, value_labels=True,
             xlabel="Flagged net pay [m]", title="30/6-5: net-pay flags by group",
             figsize=(8, 4.5));
_images/0ae26ab7d6ccd4f760bf65e4104874f4799e7c3919ecd7ccf5db9265b357cb79.png

With these tops and lithology attached, nearly all the flagged pay lies in the Brent Group, the reservoir. The 0.6 m flagged in the Hordaland Group and the 0.15 m each in the Shetland and Viking groups still need a geological check. Summarize the reservoir window:

result.summary(top=2841, bottom=2958)["net_thickness"]
{'depth_unit': 'm', 'net_rock': 70.56, 'net_res': 57.91, 'net_pay': 23.01}

An external shale label does not remove pay by itself, and a well with no clay-volume curve at all is screened as clean rock (VCL = 0), with a warning. Check flagged pay against the geology, for example the Sodir description of the Heather Formation, a shale.

Known limitation: one Rw for the whole well

A run uses one formation-water resistivity for the whole well, corrected for temperature at constant salinity, but shallow formation waters are usually fresher than the reservoir’s. In undercompacted mudstones the clay indicators also disagree, so clay volume can read low. Where no lithology code covers a shallow Tertiary section, a whole-well run can therefore still flag marginal pay there, at SW about 0.5. On 25/5-1, for example, a run with default settings flags 199 m of pay above the reservoir top at 2984 m, almost all of it in uncoded Tertiary rock.

Read the results per formation (attach tops), or give the interval its own Rw: pass zones= (above), or let the zoned runner take RW_Z1 between TOP_Z1 and BOT_Z1 from the LAS header (Zoned and batch runs), or interpret the interval on its own with its rw. Petrophys does not model a formation-water salinity that changes with depth.

The cutoffs actually used

The 30/6-5 lithology file has samples of both families, clastic and carbonate, so the net_pay step lists the cutoffs per family (the standards are under Settings above):

net_pay = result.step("net_pay")
pd.DataFrame(net_pay.parameters["cutoffs_by_family"]).T
vcl_cutoff phie_cutoff sw_cutoff samples
clastic 0.400 0.080 0.600 20542.000
carbonate 0.300 0.045 0.700 1634.000

The step also records the samples left out of net reservoir and pay, and the thickness each kind removed over the whole well. On 30/6-5 bad hole removes 53.9 m of pay, and samples that read like coal on the logs 3.8 m:

excluded = net_pay.parameters["excluded_from_net_reservoir_and_pay"]
pd.DataFrame.from_dict(excluded, orient="index")
samples net_rock_samples_removed net_reservoir_samples_removed net_pay_samples_removed net_rock_removed net_reservoir_removed net_pay_removed depth_unit
coal_log_signature 345 0 344 25 0.000 52.410 3.810 m
bad_hole 12631 0 6046 354 0.000 921.110 53.930 m

Pass project values as vcl_cutoff, phie_cutoff and sw_cutoff; a value you set applies to every sample. Give them as fractions: a value above 1 is read as a percentage (vcl_cutoff=40 is 0.40). The same holds for swirr, phi_cl and sw_routing_vcl_cutoff, and for each value of a per-lithology setting ({"clastic": 40}); a value above 100 is refused.

Marl is a clay-carbonate mixture, not pure limestone (SLB definition). Petrophys interprets marl with the limestone matrix and the carbonate cutoffs, and warns when a lithology file contains it, as above. Supply project endpoints and cutoffs for marl-rich intervals.

Known sample limitations

Sample

Limitation

What Petrophys does

30/6-5 SWC, SOC

labelled frac, stored in percent

standardize_curves (and so interpret) converts them to v/v with a warning (Core saturation units), hidden on this page; the raw-well plots convert for display only; the bundled LAS is unchanged. Give an explicit unit for ambiguous low values

15/9-14 DTE

values fit no sonic unit; meaning unknown

not treated as shear slowness; range QC removes them. Do not rescale

Daydream CMR

scalar NMR curves only: no T2 bins or T2LM

T2LM cannot be computed; vendor KSDR and KTIM are read, not recomputed

30/6-5 tops

groups and formations nest

formation_summary reports formations; pass rank="group" for groups; core permeability is calibrated per group and per formation

COSTA HW-*

each LAS covers only the Kharaib-2 interval

formations_costa labels it KHARAIB-2; not for whole-well or multi-formation studies

Next

Custom workflows: choose the methods and parameters yourself, add your own steps, and run the recipe on one well or a folder.

The tutorials go further: the workflow as a glass box, QC and standardization, lithology and the mineral solver, reservoir quality and net pay, and the case studies carbonate rock typing and saturation-model sensitivity.