interpret

petrophys.api.interpret

Also available as petrophys.interpret

interpret(
well,
config=None,
*,
formations=None,
lithology=None,
output=None,
inplace=False,
depth_unit=None,
context_profile=None,
curve_aliases=None,
**options,
)[source]

Run the full petrophysical interpretation on one well or several.

The workflow standardizes vendor mnemonics and units, checks which curves and parameters are available and runs every step it can (clay volume, porosity, water saturation, permeability, net pay, …). Steps that cannot run are skipped with a recorded reason. Where a step has to assume a value (a default Rw, a 30 C/km temperature gradient, …), the trace records it and result.warnings says so; no bit size is assumed. The "geolink" calculation profile (calculation_profile) keeps the eval package’s behaviour instead: no standardization, an 8.5 in bit size where the well records none, and of these assumptions only the default Rw is warned about.

Several wells (a list of wells or files, the wells read() returns for a folder, or a folder or file pattern) are each interpreted with the same settings, and LAS header values fill each well’s unset settings from its own header. The result is a MultiWellResult: one table across the wells from formation_summary() and summary(), a LAS file or plot per well from to_las(folder) and save_plots(folder), and each well’s result by name (results["15/9-12"]). A well whose interpretation raises is named in results.failed and in a warning; the other wells are interpreted.

Parameters:
  • well (Well, str, Path or list) – Well to interpret, or a well file to read with read(); several wells as above.

  • config (DynamicWorkflowConfig or dict, optional) – Complete workflow settings, or a dict of settings (the same as keywords). When omitted, settings come from options and the DynamicWorkflowConfig defaults. Recognized LAS header parameters fill otherwise unspecified settings; explicit Python options take precedence.

  • formations (path, DataFrame, mapping, or sequence, optional) – Formation tops or intervals, as for read(). They calibrate core permeability per formation and annotate result.plot().

  • lithology (str, path or DataFrame, optional) – The lithology to interpret with: lithology intervals (a top,bottom,lithology table, as for read()), the name of the well’s lithology code curve (e.g. "FACIES"), or a lithology domain ("clastic", "carbonate", "evaporite", "auto").

  • output (str or Path, optional) – Write the interpreted well to this LAS file; for several wells, a folder for one LAS file per well.

  • inplace (bool, default False) – If False, the well is copied and the caller’s well is left unchanged. If True, calculated curves are added to well itself.

  • depth_unit ({"m", "ft"}, optional) – Depth unit of a CSV/TSV file given as well. It applies only when a file is read; given with a Well it raises ValueError.

  • context_profile (str, optional) – "geolink", "geolink_train", "costa" or "danish": interpret a well of that context package exactly as its context does (petrophys.reporting.context_profiles.interpret_with_context_profile()), so the statistics of result.well over a context group’s depths are that group’s context statistics. well must be the well’s raw LAS file from the package’s delivery; the profile fixes the settings, so config and options are not accepted. With context_profile="danish", formations is the Danish tops workbook, which supplies the lithology of wells without a lithology log.

  • curve_aliases (mapping, path or DataFrame, optional) – Your names for standard curves ({"GAMMA_RAY_1": "GR"} or a CSV/Excel table), as for read(); added to any mapping the well already carries.

  • **options – Individual DynamicWorkflowConfig settings, e.g. rw=0.07, rw_meas_temp="230 degF" or sw_model="indonesia". With config, they override the corresponding fields of a copy of config.

Returns:

Interpreted well (result.well), the settings actually used (result.config), and a step-by-step trace (result.print_trace(), result.to_trace_dict()). Call result.raise_for_errors() to stop on failed steps.

Return type:

DynamicWorkflowResult or MultiWellResult

Raises:
  • TypeError – If an option is not a DynamicWorkflowConfig setting, a setting is given both in a config dict and as a keyword, well is neither a Well nor a file path, or context_profile is combined with a Well, config, lithology, output or other settings.

  • ValueError – If a setting has an invalid value, the list of wells is empty, or depth_unit is given with a Well.

Examples

>>> import petrophys as pp
>>> result = pp.interpret(pp.read(pp.sample("30_6-5")), rw=0.07, rw_meas_temp="230 degF")
>>> result.raise_for_errors().status
'interpreted'
>>> result = pp.interpret("well.las", formations="tops.csv", lithology="FACIES",
...                       output="well_interpreted.las")
>>> results = pp.interpret("logs/", formations="tops.xlsx")
>>> table = results.formation_summary()