Step

petrophys.workflow.custom.Step

Also available as petrophys.workflow.Step

class Step(
kind,
name,
params,
*,
settings,
runner,
requirements=(),
produces=None,
description='',
planner=None,
produces_text='',
factory=None,
label=None,
default_name=None,
)[source]

One configured step of a Workflow.

Create steps with the factories in petrophys.workflow.steps, for example steps.porosity(method="density"), or with a function decorated by workflow_step(). Steps are immutable: use with_params() to change a parameter.

A step’s name is unique within a workflow and defaults to its kind (built-in steps) or function name (custom steps). params holds the parameters set when it was created; requires and produces state its inputs and its output curves with their units.

Examples

>>> from petrophys.workflow import Workflow, steps
>>> step = steps.net_pay(sw_cutoff=0.5, name="pay_tight")
>>> step.name, step.kind, step.params
('pay_tight', 'net_pay', {'sw_cutoff': 0.5})
>>> step.requires
('VCL', 'PHIE', 'SW')

Attributes

description

One-line summary of what the step does.

is_custom

True for steps made with workflow_step().

kind

Built-in step type, or "module:function" for a custom step.

name

Unique name of this step within a workflow.

params

Parameters set when the step was created (a copy).

produces

Curves this step adds to the well, mapped to their units.

requires

Inputs this step needs, e.g. ("PHIE", "RDEP or RT", "RW").

Methods

to_dict

Return the step as {"name", "kind", "params"} (JSON-serializable).

with_params

Return a copy of this step with some parameters changed.

Parameters:
  • kind (str)

  • name (str)

  • params (Mapping[str, Any])

  • settings (Mapping[str, Any])

  • runner (Callable[..., None])

  • requirements (Sequence[_Requirement])

  • produces (Optional[Mapping[str, str]])

  • description (str)

  • planner (Optional[Callable[..., Iterable[str]]])

  • produces_text (str)

  • factory (Optional[Callable[..., 'Step']])

  • label (Optional[str])

  • default_name (Optional[str])

property name: str

Unique name of this step within a workflow.

property kind: str

Built-in step type, or "module:function" for a custom step.

property params: Dict[str, Any]

Parameters set when the step was created (a copy).

property requires: Tuple[str, ...]

Inputs this step needs, e.g. ("PHIE", "RDEP or RT", "RW").

property produces: Dict[str, str]

Curves this step adds to the well, mapped to their units.

property description: str

One-line summary of what the step does.

property is_custom: bool

True for steps made with workflow_step().

with_params(**changes)[source]

Return a copy of this step with some parameters changed.

The new values are validated as when the step was created; the name is kept.

Parameters:

**changes (Any) – Parameters to set, e.g. n=2.2.

Returns:

A new step; this one is unchanged.

Return type:

Step

Examples

>>> from petrophys.workflow import Workflow, steps
>>> steps.saturation(model="archie", n=2.0).with_params(n=2.2)
steps.saturation(model='archie', n=2.2)
to_dict()[source]

Return the step as {"name", "kind", "params"} (JSON-serializable).

Return type:

Dict[str, Any]