States

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

States component.

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

Apply function to each timestamp of states 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.

  • inplace (bool) – Modify сomponent inplace.

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

Returns:

output – Transformed component.

Return type:

States

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.

items()

Returns pairs of attribute’s names and data.

load(data, binary_data, logger)

Load data.

property n_timesteps

Effective number of timesteps.

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)[source]

Ravel order ‘F’ transformations.

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, t=None, i=None, j=None, k=None, figsize=None, **kwargs)[source]

Visualize slices of 4D states arrays. If no slice is specified, spatial slices will be shown with interactive slider widgets.

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

  • t (int or None, optional) – Timestamp 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)[source]

Remove non-active cells from the state vector.

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

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

Returns:

output

Return type:

stripped attribute.

Notes

Outputs 1d array for each timestamp.

to_spatial(attr, **kwargs)[source]

Spatial order ‘F’ transformations.