Rock

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

Rock component.

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: Sequence[str]

Names of attributes.

property binary_attributes: Sequence[str]

Names of binary attributes.

data_dict()

Create dict from attributes.

property empty

True if component is empty else False.

property field: Field

Field associated with the component.

histogram(attr, **kwargs)[source]

Show distribution over active cells.

Parameters:
  • attr (str) – Attribute to compute the histogram.

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

Returns:

plot

Return type:

Histogram plot.

items()

Returns pairs of attribute’s names and data.

load(data, binary_data, logger)

Load data.

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

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

Parameters:
  • attr (str, array-like) – Attributes to be padded with 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')

Ravel attributes using Fortran order.

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.

show_slice(attr, i=None, j=None, k=None, figsize=None, **kwargs)[source]

Visualize slices of 3D array. If no slice is specified, all 3 slices will be shown with interactive slider widgets.

Parameters:
  • attr (str) – Attribute to show.

  • i (int or None, optional) – Slice along x-axis to show.

  • j (int or None, optional) – Slice along y-axis to show.

  • k (int or None, optional) – Slice along z-axis to show.

  • figsize (array-like, optional) – Output plot size.

  • kwargs (dict, optional) – Additional keyword arguments for plot.

strip_na(attr, **kwargs)[source]

Remove non-active cells from the rock vector.

Parameters:

attr (str, array-like) – Attributes to be stripped

Returns:

output

Return type:

stripped attribute.

to_spatial(attr, **kwargs)[source]

Spatial order ‘F’ transformations.