WorkflowRunResult

petrophys.workflow.custom.WorkflowRunResult

Also available as petrophys.workflow.WorkflowRunResult

class WorkflowRunResult(workflow, well)[source]

The outcome of Workflow.run() on one well.

Parameters:
workflow

The workflow as run, including any one-off params changes.

Type:

Workflow

well

The interpreted well (a copy of the input unless inplace=True).

Type:

Well

steps

One trace record per executed step, in order: method, input and output curves, parameters, decisions and, for a failed step, the error message.

Type:

list of StepResult

steps_skipped

Steps that did not run, mapped to the reason.

Type:

dict

warnings

Warnings, prefixed with the step name.

Type:

list of str

errors

Failed steps, prefixed with the step name.

Type:

list of str

artifacts

Non-curve outputs by step name, e.g. the table of steps.formation_summary() or the full result of steps.interpret().

Type:

dict

Attributes

output_curves

Curves written by the run, in the order they were written.

status

"complete", "partial" (steps skipped), "failed" or "not_run".

success

True when no step failed (skipped steps are not failures).

Methods

formation_summary

Gross, net and average properties for each formation.

plot

Plot the interpreted well; takes the same options as petrophys.plot().

print_trace

Print a readable, step-by-step account of the run.

raise_for_errors

Raise RuntimeError if a step failed; otherwise return this result.

statistics

Statistics of curves of the run's well over a depth window: a row per curve with unit, samples, mean, p10, median and p90 (default VCL, PHIT, PHIE, SW and PERM where present).

step

The record of one step that ran: its method, decisions, parameters, input_curves and output_curves.

summary

Summarize the run as compact, JSON-serializable data.

to_dataframe

Return the trace as a table, one row per workflow step.

to_json

Export the run as JSON; see to_trace_dict().

to_las

Write the interpreted well to LAS, with the workflow definition.

to_trace_dict

Export the run as a JSON-safe dictionary.

step(name)[source]

The record of one step that ran: its method, decisions, parameters, input_curves and output_curves. A step that did not run raises KeyError, with the reason it was skipped.

Parameters:

name (str)

Return type:

StepResult

statistics(curves=None, top=None, bottom=None)[source]

Statistics of curves of the run’s well over a depth window: a row per curve with unit, samples, mean, p10, median and p90 (default VCL, PHIT, PHIE, SW and PERM where present).

Parameters:
Return type:

Any

property status: str

"complete", "partial" (steps skipped), "failed" or "not_run".

property success: bool

True when no step failed (skipped steps are not failures).

property output_curves: List[str]

Curves written by the run, in the order they were written.

raise_for_errors()[source]

Raise RuntimeError if a step failed; otherwise return this result.

Return type:

WorkflowRunResult

summary(top=None, bottom=None)[source]

Summarize the run as compact, JSON-serializable data.

Parameters:
  • top (float, optional) – Depth window (well depth unit) for the statistics and net thickness; defaults to the whole well.

  • bottom (float, optional) – Depth window (well depth unit) for the statistics and net thickness; defaults to the whole well.

Returns:

petrophys_version, workflow, well, status, summary_interval, key_results (statistics of the curves the steps declare they produce), net_thickness (net rock, reservoir and pay), executed_steps, skipped_steps with reasons, artifacts, warnings and errors.

Return type:

dict

Examples

>>> import petrophys as pp
>>> from petrophys.workflow import Workflow, steps
>>> run = Workflow("vcl", [steps.clay_volume()]).run(pp.read(pp.sample("30_6-5")))
>>> sorted(run.summary(top=2841, bottom=2958)["key_results"])
['VCL']
formation_summary(formations=None, *, rank=None)[source]

Gross, net and average properties for each formation.

Same table as petrophys.workflow.DynamicWorkflowResult.formation_summary(): averages of PHIE, SW, VCL and PERM are over net-pay samples.

Parameters:
  • formations (path, DataFrame, mapping or sequence, optional) – Formation tops or intervals; defaults to the formations attached with petrophys.read(path, formations=...).

  • rank (str, optional) – Level to summarize when the tops mix levels, e.g. "group"; tops that mix levels default to "formation".

Returns:

One row per formation.

Return type:

DataFrame

Raises:

ValueError – If no formations are given or attached.

to_dataframe()[source]

Return the trace as a table, one row per workflow step.

Skipped steps are included with status SKIPPED and their reason in Message. For the curves themselves use result.well.to_dataframe().

Returns:

Columns Step, Kind, Status (OK, FAIL or SKIPPED), Method, Input Curves, Output Curves, Parameters, Decisions, Warnings and Message.

Return type:

DataFrame

print_trace()[source]

Print a readable, step-by-step account of the run.

Return type:

None

to_trace_dict(include_curves=None)[source]

Export the run as a JSON-safe dictionary.

Parameters:

include_curves (sequence of str, optional) – Curves to add compact statistics for.

Returns:

schema, schema_version, petrophys_version, workflow (the definition as run), well, status, success, steps (every trace record with its warnings), steps_skipped, warnings, errors, artifacts (tables as records) and curve_summaries.

Return type:

dict

to_json(path=None, include_curves=None, indent=2)[source]

Export the run as JSON; see to_trace_dict().

Parameters:
  • path (str or Path, optional) – Output file. Without it, the JSON text is returned.

  • include_curves (sequence of str, optional) – Curves to add compact statistics for.

  • indent (int, default 2) – JSON indentation.

Returns:

The JSON text, or the written file.

Return type:

str or Path

to_las(path, **options)[source]

Write the interpreted well to LAS, with the workflow definition.

The ~Params section keeps the source header values and adds PP_VERSION, PP_WORKFLOW, PP_STATUS and one PP_STEPnn entry per step (its name, call and outcome). ~Other holds the full workflow definition as JSON, so Workflow.from_dict() can rebuild it, and the reasons for skipped steps.

Parameters:
Returns:

The written file.

Return type:

Path

plot(**options)[source]

Plot the interpreted well; takes the same options as petrophys.plot().

Returns:

Use .show(), .save(path) and .close().

Return type:

LogViewer

Parameters:

options (Any)