Faults

Faults

class Faults(node=None, **kwargs)[source]

Faults component.

Contains faults in a single tree structure, faults attributes and preprocessing actions.

Parameters:

node (FaultSegment, optional) – Root node for fault’s tree.

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

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

Array of attributes.

property class_name

Name of the component.

copy()

Returns a deepcopy. Cached properties are not copied.

del_state(*args)

State remover.

drop(names)

Detach nodes by names.

Parameters:

names (str, array-like) – Nodes to be detached.

Returns:

out – Component without detached nodes.

Return type:

self

drop_empty_groups(logger=None)

Drop groups without nodes in descendants.

dump(path, **kwargs)

Dump attributes into file.

Parameters:
  • path (str) – Path to output file.

  • kwargs (dict, optional) – Any kwargs for dump method.

Returns:

comp – BaseComponent unchanged.

Return type:

BaseComponent

static dump_array_ascii(buffer, array, header=None, fmt='%f', compressed=True)

Writes array-like data into an ASCII buffer.

Parameters:
  • buffer (buffer-like)

  • array (1d, array-like) – Array to be saved

  • header (str, optional) – String to be written line before the array

  • fmt (str or sequence of strs, optional) – Format to be passed into numpy.savetxt function. Default to ‘%f’.

  • compressed (bool) – If True, uses compressed typing style

property empty

True if component is empty else False.

empty_like()

Get an empty component with the same state and the structure of embedded BaseComponents (if any).

property field

Field associated with the component.

get_blocks(segment, **kwargs)[source]

Calculate grid blocks for the tree of faults.

Parameters:
  • segment (class instance) – FaultSegment class.

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

Returns:

comp – faults component with calculated grid blocks and fault in block projections.

Return type:

faults

glob(name)

Return instances at name supporting wildcards.

group(node_names, group_name)

Group nodes in a new group attached to root.

Parameters:
  • node_names (array-like) – Array of nodes to be grouped.

  • group_name (str) – Name of a new group.

Returns:

out – Component with a new group added.

Return type:

self

init_state(**kwargs)

Init state attributes.

items()

Returns pairs of attribute’s names and data.

keys()

Array of attributes.

load(path_or_buffer, **kwargs)

Load data from a file or buffer.

Parameters:
  • path_or_buffer (str of string buffer) – Source to read data from.

  • **kwargs (dict, optional) – Any kwargs to be passed to load method.

Returns:

comp – BaseComponent with loaded attributes.

Return type:

BaseComponent

property names

List of well names.

ravel(attr=None, order='F')

Ravel attributes where applicable assuming by default Fortran order.

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

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

Returns:

out

Return type:

Raveled attribute.

render_tree()

Print tree structure.

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

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.

property resolver

Tree resolver.

property root

Tree root.

set_state(**kwargs)

State setter.

property state

Get state.

update(data, mode='w', **kwargs)[source]

Update tree nodes with new faultsdata. If fault does not exists, it will be attached to root.

Parameters:
  • data (dict) – Keys are fault names, values are dicts with fault attributes.

  • mode (str, optional) – If ‘w’, write new data. If ‘a’, try to append new data. Default to ‘w’.

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

Returns:

out – Faults with updated attributes.

Return type:

Faults

values()

Returns a generator of attribute’s data.

FaultSegment