Base classes

BaseComponent

class BaseComponent(data=None, field=None)[source]

Base class for reservoir model components.

apply(func, attr, *args, inplace=False, **kwargs)[source]

Apply function to attributes.

Parameters:
  • func (callable) – A function to apply. Must accept data as its first argument.

  • attr (str, array-like) – Attributes to get data from.

  • args (misc) – Any additional positional arguments to func.

  • kwargs (misc) – Any additional named arguments to func.

Returns:

output – Transformed component.

Return type:

BaseComponent

property attributes: Sequence[str]

Names of attributes.

property binary_attributes: Sequence[str]

Names of binary attributes.

data_dict()[source]

Create dict from attributes.

property empty

True if component is empty else False.

property field: Field

Field associated with the component.

items()[source]

Returns pairs of attribute’s names and data.

load(data, binary_data, logger)[source]

Load data.

SpatialComponent

class SpatialComponent(data=None, field=None)[source]

Bases: BaseComponent

Base component for spatial-type attributes.

load(data, binary_data, logger)[source]

Load data.

pad_na(attr, fill_na=0.0, inplace=True)[source]

Add dummy cells into the state vector in the positions of non-active cells if necessary.

Parameters:
  • attr (str, array-like) – Attributes to be padded with non-active cells.

  • actnum (array-like of type bool) – Vector representing a mask of active and non-active cells.

  • fill_na (float) – Value to be used as filler.

  • inplace (bool) – Modify сomponent inplace.

Returns:

output

Return type:

component if inplace else padded attribute.

ravel(attr, order='F')[source]

Ravel attributes using Fortran order.

reshape(attr, newshape, order='C', inplace=True)[source]

Reshape numpy.ndarray attributes.

Parameters:
  • attr (str, array of str) – Attribute to be reshaped.

  • newshape (tuple) – New shape.

  • order (str) – Numpy reshape order. Default to ‘C’.

  • inplace (bool) – If True, reshape is made inplace, return BaseComponent. Else, return reshaped attribute.

Returns:

output

Return type:

BaseComponent if inplace else reshaped attribute itself.

to_spatial(attr, **kwargs)[source]

Bring component to spatial state.

BaseTree

class BaseTree(root=None, **kwargs)[source]

Bases: BaseComponent

Base tree component.

Contains nodes and groups in a single tree structure.

Parameters:

node (TreeSegment, optional) – Root node for the tree.

build_tree()[source]

Build tree from component’s data.

glob(name)[source]

Return instances at name supporting wildcards.

property names

List of node names excluding group nodes.

render_tree()[source]

Print tree structure.

property resolver

Tree resolver.

property root

Tree root.

BaseTreeNode

class BaseTreeNode(name, key=None, is_group=False, **kwargs)[source]

Bases: Node

Tree’s node.

Parameters:
  • name (str) – Name of the node.

  • key (str, optional) – Key used to query node data.

  • is_group (bool, optional) – Should a node represet a group of nodes. Default False.

property fullname

Full name from root.

property is_group

Check that node is a group of nodes.

property key

Node’s type.