Field

class Field(path=None, config=None, logfile=None, encoding='auto', loglevel='INFO')[source]

Reservoir model.

Contains components of reservoir model and preprocessing actions.

Parameters
  • path (str, optional) – Path to source model files.

  • config (dict, optional) – Components and attributes to load.

  • logfile (str, optional) – Path to log file.

  • enoding (str, optional) – Files encoding. Set ‘auto’ to infer encoding from initial file block. Sometimes it might help to specify block size, e.g. ‘auto:3000’ will read first 3000 bytes to infer encoding.

  • loglevel (str, optional) – Log level to be printed while loading. Default to ‘INFO’.

property aquifers

Aquifers component.

assert_components_available(*comp_names)[source]

Raises ValueError in case comp_names are not presented in self.

property basename

Model filename without extention.

calculate_rates(wellnames=None, cf_aggregation='sum', multiprocessing=True, verbose=True)[source]

Calculate oil/water/gas rates for each well segment.

Parameters
  • wellnames (list of str) – Wellnames for rates calculation. If None, all wells are included. Default to None.

  • cf_aggregation (str, 'sum' or 'eucl') – The way of aggregating cf projection (‘sum’ - sum, ‘eucl’ - Euclid norm).

Returns

  • rates (pd.DataFrame) – pd.Dataframe filled with production rates for each phase.

  • block_rates (pd.DataFrame of ndarrays) – pd.Dataframe filled with arrays of production rates in each grid block.

property components

Model components.

copy()[source]

Returns a deepcopy of Field.

dump(path=None, mode='a', data=True, results=True, title=None, **kwargs)[source]

Dump model components.

Parameters
  • path (str) – Common path for output files. If None path will be inherited from model path.

  • mode (str) – Mode to open file. ‘w’: write, a new file is created (an existing file with the same name would be deleted). ‘a’: append, an existing file is opened for reading and writing, and if the file does not exist it is created. Default to ‘a’.

  • data (bool) – Dump initial model data. No effect for HDF5 output. Default True.

  • results (bool) – Dump calculated results. No effect for HDF5 output. Default True.

  • title (str) – Model name. No effect for HDF5 output.

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

Returns

out – Field unchanged.

Return type

Field

get_spatial_connection_factors_and_perforation_ratio(date_range=None, mode=None)[source]

Get model’s connection factors and perforation ratios in a spatial form.

Parameters
  • date_range (tuple) – Minimal and maximal dates for events.

  • mode (str, None) – If not None, pick the blocks only with specified mode.

Returns

  • connection_factors (np.array)

  • perf_ratio (np.array)

get_spatial_well_control(attrs, date_range=None, fill_shut=0.0, fill_outside=0.0)[source]

Get the model’s control in a spatial form

Parameters
  • attrs (tuple or list) – Conrol attributes to get data from.

  • date_range (tuple) – Minimal and maximal dates for control events.

  • fill_shut (float) – Value to fill shutted perforations

  • fill_outside – Value to fill non-perforated cells

Returns

control

Return type

np.array

property grid

Grid component.

history_to_results()[source]

Convert history to results.

items()[source]

Returns pairs of components’s names and instance.

load(raise_errors=False, include_binary=True, spatial=True, fill_na=0.0)[source]

Load model components.

Parameters
  • raise_errors (bool) – Error handling mode. If True, errors will be raised and stop loading. If False, errors will be printed but do not stop loading.

  • include_binary (bool) – Read data from binary files in RESULTS folder. Default to True.

  • spatial (bool) – Return Field components is spatial state.

  • fill_na (float) – Value to fill at non-active cells. Default to 0.

Returns

out – Field with loaded components.

Return type

Field

property meta

“Model meta data.

property path

Path to original model.

ravel(only_active=True)[source]

Ravel data in spatial components.

Parameters

only_active (bool) – Strip non-active cells fron state vectors. Default is True.

Returns

out – Field with reshaped spatial components.

Return type

Field

property result_dates

Result dates, actual if present, target otherwise.

property rock

Rock component.

set_state(**kwargs)[source]

State setter.

show(attr=None, opacity=0.5, thresholding=False, slicing=False, timestamp=None, use_only_active=True, cell_size=None, scaling=True, cmap=None, show_wells=True, notebook=False, theme='default', show_labels=True)[source]

Field visualization.

Parameters
  • attr (str or None) – Attribute of the grid to show. If None, ACTNUM will be shown.

  • opacity (float or None) – Opacity of the visualization. Default is 0.5.

  • thresholding (bool) – Show slider for thresholding. Cells with attribute value less than threshold will not be shown. Default False.

  • slicing (bool) – Show by slices. Default False.

  • timestamp (int or None) – The timestamp to show. Meaningful only for sequential attributes (States). Has no effect given non-sequential attributes.

  • use_only_active (bool) – Corner point grid creation using only active cells. Default to True.

  • cell_size (int) – Cell size for orthogonal uniform grid.

  • scaling (bool, list or tuple) – The ratio of the axes in case of iterable, if True then it’s (1, 1, 1), if False then it is natural. Default True.

  • cmap (object) – Matplotlib, Colorcet, cmocean, or custom colormap

  • show_wells (bool) – Show well trajectories. Default True.

  • notebook (bool) – When True, the resulting plot is placed inline a jupyter notebook. Assumes a jupyter console is active. Automatically enables off_screen.

  • theme (str) – PyVista theme, e.g. ‘default’, ‘night’, ‘document’. See https://docs.pyvista.org/examples/02-plot/themes.html for more options.

  • show_labels (bool) – Show x, y, z axis labels. Default True.

property start

Model start time in a datetime format.

property state

“Field state.

property states

States component.

property tables

Tables component.

to_spatial(fill_na=0.0)[source]

Bring data to spatial state.

Parameters

fill_na (float) – Value to fill at non-active cells. Default to 0.

Returns

out – Field in spatial representation.

Return type

Field

unravel(*args, **kwargs)[source]

Alias for to_spatial method.

Deprecated since version Renamed: to_spatial

well_mask

Get the model’s well mask in a spatial form.

Returns

well_mask – Array with well-names in cells which are registered as well-blocks and empty strings everywhere else.

Return type

np.array

property wells

Wells component.