plopm.utils.readers module#

Read and derive plotting quantities from OPM Flow output.

The module opens INIT, UNRST, EGRID, SMSPEC, deck, and CSV data; constructs plotting coordinates; evaluates variable expressions; and derives saturation, mass, caprock, distance, well, and fault quantities.

read_case(deck, gif, vtk, variables, restart, filters, n=0)[source]#

Open the OPM output required for one simulation case.

Parameters:
deckstr

Simulation-case stem without an extension.

gif, vtkbool

Output modes controlling restart and grid loading.

variableslist

Requested variables or expressions.

restartlist

Requested restart report steps.

filterslist

Property-filter expressions.

nint, default: 0

Case index used to select per-case settings.

Returns:
SimData

Loaded readers, grid properties, and report-step metadata.

Parameters:
Return type:

SimData

get_yz_coords(cfg, data, n)[source]#

Build coordinate meshes for a yz slice.

Parameters:
cfgPlopmConfig

Initialized map configuration.

dataSimData

Loaded grid data.

nint

Slice index.

Returns:
tuple[np.ndarray, np.ndarray]

Y- and z-coordinate meshes.

Parameters:
Return type:

tuple[NDArray, NDArray]

get_xz_coords(cfg, data, n)[source]#

Build coordinate meshes for an xz slice.

Parameters:
cfgPlopmConfig

Initialized map configuration.

dataSimData

Loaded grid data.

nint

Slice index.

Returns:
tuple[np.ndarray, np.ndarray]

X- and z-coordinate meshes.

Parameters:
Return type:

tuple[NDArray, NDArray]

get_xy_coords(cfg, data, n)[source]#

Build coordinate meshes for an xy slice.

Parameters:
cfgPlopmConfig

Initialized map configuration.

dataSimData

Loaded grid data.

nint

Slice index.

Returns:
tuple[np.ndarray, np.ndarray]

X- and y-coordinate meshes.

Parameters:
Return type:

tuple[NDArray, NDArray]

read_series(cfg, case, values, tunit, qskl, n)[source]#

Read one one-dimensional series for plotting.

Parameters:
cfgPlopmConfig

Initialized series configuration.

casestr

Simulation-case stem or CSV path.

valuesstr

Variable name or expression.

tunitstr

Requested time-unit code.

qsklfloat

Scale factor applied to values.

nint

Plot or case index.

Returns:
tuple[np.ndarray, np.ndarray, str, str]

Coordinates, values, coordinate unit, and value unit.

Parameters:
Return type:

tuple[NDArray, NDArray, str, str]

time_unit(times)[source]#

Get the conversion and label for a time unit.

Parameters:
timesstr

Time-unit code or "dates".

Returns:
tuple[float, str]

Factor converting OPM days and the axis label.

Parameters:

times (str)

Return type:

tuple[float, str]

read_csv_grid(cfg, deck, n)[source]#

Read coordinate meshes from a regular CSV grid.

Parameters:
cfgPlopmConfig

CSV column and animation configuration.

deckstr

CSV path without the extension.

nint

Map index.

Returns:
tuple

Coordinate meshes, dimensions, and axis names.

Parameters:
Return type:

tuple[NDArray, NDArray, int, int, str, str]

get_unit(name)[source]#

Get the display unit for a variable.

Parameters:
namestr

Variable name.

Returns:
str

Matplotlib-formatted unit label.

Parameters:

name (str)

Return type:

str

read_quantity(deck, data, name, step, scale, mass, mass_all, caprock, stress, filters, isgif, vmin, vmax, cvs)[source]#

Read and transform one spatial or VTK quantity.

Parameters:
deckstr

Simulation-case stem or CSV path.

dataSimData

Loaded simulation data.

namestr

Variable name or expression.

stepint

Restart report step.

scalefloat

Scale factor applied to derived values.

mass, mass_all, caprocklist[str]

Supported derived-variable groups.

stressfloat

Stress coefficient for caprock quantities.

filtersstr

Property-filter expression.

isgifbool

Whether the CSV path contains a restart placeholder.

vmin, vmaxstr

Optional value thresholds.

cvslist

CSV input and column settings.

Returns:
tuple[str, np.ndarray]

Unit label and quantity values.

Parameters:
Return type:

tuple[str, NDArray]

get_wells(cfg, n)[source]#

Read wells intersecting the selected slice.

Parameters:
cfgPlopmConfig

Case and slice configuration.

nint

Case index.

Returns:
tuple[list, list[str]]

Completion intervals grouped by well and the well names.

Parameters:
Return type:

tuple[list, list]

get_faults(cfg, n)[source]#

Read faults intersecting the selected slice.

Parameters:
cfgPlopmConfig

Case and slice configuration.

nint

Case index.

Returns:
tuple[list, list[str]]

Grid segments grouped by fault and the fault names.

Parameters:
Return type:

tuple[list, list]