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:
- Returns:
output – Transformed component.
- Return type:
- data_dict()¶
Create dict from attributes.
- property empty¶
True if component is empty else False.
- 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:
- Returns:
output
- Return type:
component if inplace else padded attribute.
- reshape(attr, newshape, order='C', inplace=True)¶
Reshape numpy.ndarray attributes.
- Parameters:
- 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.