OPM Common Python Documentation

Note on Import Paths

In this documentation, some classes are referenced with their full import paths (e.g., opm.io.ecl.EGrid), while others are shown with just the class name. This distinction reflects how these classes are structured within the package:

  • Fully Qualified Class Names: Classes displayed with their full import paths can be imported from their respective modules. They have constructors and can be directly instantiated in Python using the __init__ method. For example:

    from opm.io.ecl import EGrid
    
  • Unqualified Class Names: Classes displayed with just their names, e.g., Connection, do not have constructors in Python and cannot be directly instantiated in Python. Objects of these classes might be return values of methods of other classes.

Documentation

class Connection

The Connection class represents a connection point in a reservoir simulation. It includes properties for spatial indices, state, and various physical attributes of the connection.

Connection.attached_to_segment -> bool

Checks if the connection is attached to a segment.

Returns:

True if attached to a segment, otherwise False.

Connection.center_depth -> double

Returns the center depth of the connection.

Returns:

The center depth of the connection.

Connection.cf -> double

Returns the static connection transmissibility factor of the connection. This quantity is calculated from the connection input quantities.

Returns:

The static connection transmissibility factor.

Connection.complnum -> int

Returns the completion number of the connection.

Returns:

The completion number.

Connection.direction -> str

Returns the direction of the connection.

Returns:

The direction of the connection.

Connection.getI() int

Returns the ‘i’ index of the connection.

Returns:

The ‘i’ index of the connection.

Connection.getJ() int

Returns the ‘j’ index of the connection.

Returns:

The ‘j’ index of the connection.

Connection.getK() int

Returns the ‘k’ index of the connection.

Returns:

The ‘k’ index of the connection.

Connection.kh -> double

Returns the static ‘Kh’ product for the connection.

Returns:

The static ‘Kh’ product for the connection.

Connection.number -> int

DEPRECATED: Use ‘complnum’ instead. Returns the completion number of the connection.

Returns:

The completion number.

Connection.pos -> tuple

Returns the position of the connection as a tuple.

Returns:

The position of the connection.

Connection.rw -> double

Returns the radius of the well (rw) at the connection.

Returns:

The radius of the well (rw).

Connection.sat_table_id -> int

Returns the saturation table ID for the connection.

Returns:

The saturation table ID.

Connection.segment_number -> bool

Returns the segment number associated with the connection.

Returns:

The segment number.

Connection.state -> str

Returns the current state of the connection.

Returns:

The current state of the connection.

class Deck

The Deck class represents a collection of keywords and their associated data used in reservoir simulations.

Deck.__contains__(keyword: str) bool

Checks if the specified keyword exists in the deck.

Parameters:

keyword (str) – The keyword to check.

Returns:

True if the keyword exists, otherwise False.

Deck.__getitem__(index: int) DeckKeyword

Returns the keyword at the specified index.

Parameters:

index (int) – The index of the keyword.

Returns:

The keyword at the specified index.

Deck.__getitem__(key: tuple(keyword_name: str, index: int)) DeckKeyword

Returns the entry at the index of the DeckView of the specified keyword name.

Parameters:

key (tuple (str, int)) – The tuple key to access the entry.

Returns:

The the entry at the index of the DeckView of the specified keyword name.

Deck.__getitem__(keyword_name: str) DeckKeyword

Returns the last entry of the DeckView of the specified keyword name.

Parameters:

keyword (str) – The name of the keyword.

Returns:

The last entry of the DeckView of the specified keyword name.

Deck.__iter__() Iterator[DeckKeyword]

Returns an iterator over the keywords in the deck.

Returns:

An iterator over the keywords.

Deck.__len__() int

Returns the number of keywords in the deck.

Returns:

The number of keywords.

Deck.__str__() str

Returns a string representation of the deck.

Returns:

A string representation of the deck.

Deck.active_unit_system() UnitSystem

Returns the active unit system of the deck.

Returns:

The active unit system.

Deck.add(keyword: DeckKeyword) None

Adds a new keyword to the deck.

Parameters:

keyword (DeckKeyword) – The keyword to add.

Deck.count(keyword: str) int

Returns the number of occurrences of the specified keyword in the deck.

Parameters:

keyword (str) – The keyword to count.

Returns:

The number of occurrences of the keyword.

Deck.default_unit_system() UnitSystem

Returns the default unit system of the deck.

Returns:

The default unit system.

class DeckRecord

Represents a record of data in the deck. A DeckRecord holds a collection of DeckItems and provides access to them in various ways.

DeckRecord.__getitem__(index: int) DeckItem

Returns the DeckItem at the specified index.

Parameters:

index (int) – The index used to retrieve the DeckItem.

Returns:

The DeckItem at the specified index.

Type:

DeckItem

DeckRecord.__iter__() iterator

Returns an iterator for the DeckRecord, allowing iteration over the contained DeckItems.

Returns:

An iterator for iterating through the DeckItems.

Type:

iterator

DeckRecord.__len__() int

Returns the number of DeckItems in the DeckRecord.

Returns:

The number of DeckItems.

Type:

int

DeckRecord.__repr__() str

Returns a string representation of the DeckRecord.

Returns:

A string representation of the DeckRecord.

Type:

str

class EclipseConfig

Represents the configuration for an Eclipse simulation.

EclipseConfig.init() InitConfig

Returns the initialization configuration.

Returns:

The initialization configuration.

Type:

InitConfig

class EclipseGrid

Represents the grid configuration for an Eclipse simulation.

EclipseGrid._getXYZ()

Returns the number of cells in XYZ direction for the grid as a tuple.

Returns:

A tuple containing the number of cells in XYZ direction.

Type:

tuple(int,int,int)

EclipseGrid.cartesianSize() int

Returns the Cartesian size of the grid, i.e., the number of all cells.

Returns:

The Cartesian size of the grid.

Type:

int

EclipseGrid.getCellDepth() numpy.ndarray[double]

Returns a numpy.ndarray containing the depths of all grid cells. Each entry in the array corresponds to the depth of a grid cell, with the array index matching the global index of that cell.

Returns:

A numpy.ndarray each entry represents the depth of a grid cell, and the index being the global index.

Type:

numpy.ndarray[double]

EclipseGrid.getCellDepth(g: int) double

Returns the depth of the grid cell corresponding to the given global index.

Parameters:

g (int) – The global index of the grid cell.

Returns:

The depth of the grid cell with the specified global index.

Type:

double

EclipseGrid.getCellDepth(i: int, j: int, k: int) double

Returns the depth of the grid cell specified by the given IJK indices.

Parameters:
  • i (int) – The I index of the grid cell.

  • j (int) – The J index of the grid cell.

  • k (int) – The K index of the grid cell.

Returns:

The depth of the grid cell with the specified IJK indices.

Type:

double

EclipseGrid.getCellDepthMask(mask: list[int]) numpy.ndarray[double]

Returns the depths for the selected cells.

Parameters:

mask (list[int]) – List containing one entry per grid cell, if the entry in the list is ‘1’, this cell is selected by the mask.

Returns:

The depths for the given cells.

Type:

numpy.ndarray[double]

EclipseGrid.getCellVolume() numpy.ndarray[double]

Returns a numpy.ndarray containing the volumes of all grid cells. Each entry in the array corresponds to the volume of a grid cell, with the array index matching the global index of that cell.

Returns:

A numpy.ndarray each entry represents the volume of a grid cell, the index being to the global index.

Type:

numpy.ndarray[double]

EclipseGrid.getCellVolume(g: int) double

Returns the cell volume for the grid cell at the global index g.

Parameters:

g (int) – The global index of the grid cell.

Returns:

The volume of the grid cell.

Type:

double

EclipseGrid.getCellVolume(i: int, j: int, k: int) double

Returns the cell volume for a grid cell identified by its (i, j, k) indices.

Parameters:
  • i (int) – The I index of the grid cell.

  • j (int) – The J index of the grid cell.

  • k (int) – The K index of the grid cell.

Returns:

The volume of the grid cell identified by the (i, j, k) indices.

Type:

double

EclipseGrid.getCellVolume(mask: list[int]) numpy.ndarray[double]

Returns the cell volumes for the selected cells.

Parameters:

mask (list[int]) – List containing one entry per grid cell, if the entry in the list is ‘1’, this cell is selected by the mask.

Returns:

The cell volumes for the given cells.

Type:

numpy.ndarray[double]

EclipseGrid.getIJK(g: int)

Returns a tuple containing the IJK indices of the grid cell with global index g.

Returns:

A a tuple containing the IJK indices of the grid cell with global index g.

Type:

tuple(int,int,int)

EclipseGrid.globalIndex(i: int, j: int, k: int) int

Returns the global index of the grid cell at the specified (i, j, k) coordinates.

Parameters:
  • i (int) – The I index of the grid cell.

  • j (int) – The J index of the grid cell.

  • k (int) – The K index of the grid cell.

Returns:

The global index of the grid cell at the specified coordinates.

Type:

int

EclipseGrid.nactive() int

Returns the number of active cells in the Eclipse grid.

Returns:

The number of active cells.

Type:

int

EclipseGrid.nx() int

Returns the number of cells along the X-axis in the Eclipse grid.

Returns:

The number of cells along the X-axis.

Type:

int

EclipseGrid.ny() int

Returns the number of cells along the Y-axis in the Eclipse grid.

Returns:

The number of cells along the Y-axis.

Type:

int

EclipseGrid.nz() int

Returns the number of cells along the Z-axis in the Eclipse grid.

Returns:

The number of cells along the Z-axis.

Type:

int

class FieldProperties

Provides access to field-wide simulation properties.

FieldProperties.__contains__(keyword: str) bool

Checks whether the given keyword exists.

Parameters:

keyword (str) – Name of the keyword.

Returns:

True if the keyword exists.

Return type:

bool

FieldProperties.__getitem__(keyword: str) numpy.ndarray

Retrieves a double-precision floating-point or integer array associated for the given keyword.

Parameters:

keyword (str) – Name of the keyword.

Returns:

NumPy array of doubles or integers.

Return type:

numpy.ndarray

FieldProperties.get_double_array(keyword: str) numpy.ndarray

Returns a double-precision floating-point array for the given keyword.

Parameters:

keyword (str) – Name of the keyword.

Returns:

NumPy array of doubles.

Return type:

numpy.ndarray

FieldProperties.get_int_array(keyword: str) numpy.ndarray

Returns an integer array for the given keyword.

Parameters:

keyword (str) – Name of the keyword.

Returns:

NumPy array of integers.

Return type:

numpy.ndarray

class Group

The Group class.

Group.name()

Returns the name of this group.

Returns:

The name of this group.

Group.num_wells()

Returns the number of wells in this group.

Returns:

The number of wells in this group.

Group.well_names()

Returns a list of all well names in this group.

Returns:

A list of all well names in this group.

class IOConfig

Represents the configuration for the input/output settings.

class InitConfig

Represents the initialization configuration.

InitConfig.getRestartStep() int

Returns the step number to restart at.

Returns:

The restart step number.

Type:

int

InitConfig.hasEquil() bool

Returns whether the initialization configuration includes the keword ‘EQUIL’, which defines the equilibration initialization data.

Returns:

True if ‘EQUIL’ is present, False otherwise.

Type:

bool

InitConfig.restartRequested() bool

Returns whether a restart is requested for the simulation.

Returns:

True if a restart is requested, False otherwise.

Type:

bool

class ScheduleState

The ScheduleState class.

ScheduleState.get_group(group_name: str) Group

Gets the group with the specified name from the schedule state.

Parameters:

group_name (str) – The name of the group to retrieve from the schedule state.

Returns:

The group with the specified name from the schedule state.

ScheduleState.nupcol()

The NUPCOL value at this Schedule State. This is a positive integer that defines the maximum number of Newton iterations used to update well targets within a time step.

class Well

The Well class.

Well.available_gctrl() bool

Checks if the well is available for group control.

Returns:

True if the well is available for group control, False otherwise.

Well.connections() list[Connection]

Gets a list of all connections associated with the well.

Returns:

A list containing all connections of the well.

Well.group() str

Returns the name of the group the well belongs to.

Returns:

The group name.

Well.guide_rate() float

Returns the guide rate for the well.

Returns:

The guide rate.

Well.isdefined(report_step: int) bool

Checks if the well is defined at a specific report step.

Parameters:

report_step (int) – The report step to check for the well’s definition.

Returns:

True if the well is defined at the specified report step, False otherwise.

Well.isinjector() bool

Checks whether the well is configured as an injector.

Returns:

True if the well is an injector, otherwise False.

Well.isproducer() bool

Checks whether the well is configured as a producer.

Returns:

True if the well is a producer, otherwise False.

Well.name -> str

Returns the name of the well.

Returns:

The well name.

Well.pos() tuple

Retrieves the position of the well.

Returns:

A tuple containing the (i, j) coordinates and the reference depth of the well.

Well.preferred_phase -> str

Returns the preferred phase (e.g., oil, gas, water) for the well.

Returns:

The preferred phase.

Well.status() str

Returns the operational status of the well, i.e., OPEN, SHUT, AUTO or STOP.

Returns:

The well status.

class opm.io.OpmLog

Fully static class providing logging functionality for OPM, for embedded python accessible via opm_embedded.OpmLog.

opm.io.OpmLog.bug(msg: str) None

Add a bug message to the OPM log.

Parameters:

msg (str) – Bug report message.

Returns:

None

opm.io.OpmLog.debug(msg: str) None

Add a debug message to the OPM log.

Parameters:

msg (str) – Debug message.

Returns:

None

opm.io.OpmLog.error(msg: str) None

Add an error message to the OPM log.

Parameters:

msg (str) – Error message.

Returns:

None

opm.io.OpmLog.info(msg: str) None

Add an info message to the OPM log.

Parameters:

msg (str) – Message to log.

Returns:

None

opm.io.OpmLog.note(msg: str) None

Add a note to the OPM log.

Parameters:

msg (str) – Note message.

Returns:

None

opm.io.OpmLog.problem(msg: str) None

Add a problem message to the OPM log.

Parameters:

msg (str) – Problem description.

Returns:

None

opm.io.OpmLog.warning(msg: str) None

Add a warning message to the OPM log.

Parameters:

msg (str) – Warning message.

Returns:

None

class opm.io.deck.DeckItem

Represents an item in the deck.

opm.io.deck.DeckItem.__defaulted(index: int) bool

Returns whether the DeckItem’s value at index is the default.

Parameters:

index (int) – The index used to check if the DeckItem’s value is the default.

Returns:

True if the value at index is defaulted, False otherwise.

Type:

bool

opm.io.deck.DeckItem.__has_value(index: int) bool

Returns whether the DeckItem has a value at index.

Parameters:

index (int) – The index used to check if the DeckItem has a value.

Returns:

True if the DeckItem has a value at index, False otherwise.

Type:

bool

opm.io.deck.DeckItem.__is_numeric() bool

Returns whether the UDA data of the DeckItem is numeric.

Returns:

True if the value is numeric, False otherwise.

Type:

bool

opm.io.deck.DeckItem.__len__() int

Returns the number of data elements in the DeckItem. If if the number returned by this method is less than what is semantically expected (e.g. size() is less than the number of cells in the grid for keywords like e.g. SGL), then the remaining values are defaulted. The deck creates the defaulted items if all their sizes are fully specified by the keyword, though.

Returns:

The number of elements.

Type:

int

opm.io.deck.DeckItem.__uda_double() double

Returns the double value of the UDA data of the DeckItem.

Returns:

The double value of the UDA data.

Type:

double

opm.io.deck.DeckItem.__uda_str() str

Returns the string value of the UDA data of the DeckItem.

Returns:

The string value of the UDA data.

Type:

str

opm.io.deck.DeckItem.get_SI(index: int) double

Returns the SI double data of the DeckItem at the given index.

Parameters:

index (int) – The index used to retrieve the SI double data from the DeckItem.

Returns:

The SI double data of the DeckItem at the given index.

Type:

double

opm.io.deck.DeckItem.get_SI_data_list() list[double]

Returns the list of SI double data elements contained in the DeckItem.

Returns:

A list of SI double data elements in the DeckItem.

Type:

list

opm.io.deck.DeckItem.get_data_list() list

Returns the list of data elements contained in the DeckItem for int or string data elements.

Returns:

A list of data elements in the DeckItem.

Type:

list

opm.io.deck.DeckItem.get_int(index: int) int

Returns the integer data of the DeckItem at the given index.

Parameters:

index (int) – The index used to retrieve the integer data from the DeckItem.

Returns:

The integer data of the DeckItem at the given index.

Type:

int

opm.io.deck.DeckItem.get_raw(index: int) double

Returns the raw double data of the DeckItem at the given index.

Parameters:

index (int) – The index used to retrieve the raw double data from the DeckItem.

Returns:

The raw double data of the DeckItem at the given index.

Type:

double

opm.io.deck.DeckItem.get_raw_data_list() list[double]

Returns the list of raw data elements (as doubles) contained in the DeckItem.

Returns:

A list of raw data elements in the DeckItem.

Type:

list

opm.io.deck.DeckItem.get_str(index: int) str

Returns the string data of the DeckItem at the given index, if the DeckItem is of type string.

Parameters:

index (int) – The index used to retrieve the string data from the DeckItem.

Returns:

The string representation of the DeckItem at the given index’s data.

Type:

str

opm.io.deck.DeckItem.get_uda(index: int) UDAValue

Returns the UDA data of the DeckItem at the given index.

Parameters:

index (int) – The index used to retrieve the UDA data from the DeckItem.

Returns:

The UDA data of the DeckItem at the given index.

Type:

UDAValue

opm.io.deck.DeckItem.is_double() bool

Returns whether the DeckItem holds double data.

Returns:

True if the DeckItem is of type double, False otherwise.

Type:

bool

opm.io.deck.DeckItem.is_int() bool

Returns whether the DeckItem holds integer data.

Returns:

True if the DeckItem is of type int, False otherwise.

Type:

bool

opm.io.deck.DeckItem.is_string() bool

Returns whether the DeckItem holds string data.

Returns:

True if the DeckItem is of type string, False otherwise.

Type:

bool

opm.io.deck.DeckItem.is_uda() bool

Returns whether the DeckItem holds UDA data.

Returns:

True if the DeckItem is UDA, False otherwise.

Type:

bool

opm.io.deck.DeckItem.name() str

Returns the name of the DeckItem.

Returns:

The name of the DeckItem.

Type:

str

class opm.io.deck.DeckKeyword

Represents a keyword in the Deck.

opm.io.deck.DeckKeyword.__getitem__(index: int) DeckValue

Returns the record at the specified index.

Parameters:

index (int) – The index of the record to retrieve.

Returns:

The record at the specified index.

Type:

DeckValue

opm.io.deck.DeckKeyword.__init__(parser_keyword: ParserKeyword) DeckKeyword

Creates a DeckKeyword with a specified ParserKeyword.

Parameters:

parser_keyword (ParserKeyword) – The ParserKeyword to initialize the DeckKeyword with.

opm.io.deck.DeckKeyword.__init__(parser_keyword: ParserKeyword, py_data: numpy.ndarray[double], active_system: UnitSystem, default_system: UnitSystem) DeckKeyword

Creates a DeckKeyword with a specified ParserKeyword, double data (as a numpy.ndarray, and two UnitSystem objects for active and default systems. For this, the keyword must be a data keyword!

Parameters:
  • parser_keyword (ParserKeyword) – The ParserKeyword to initialize the DeckKeyword with.

  • py_data (numpy.ndarray[double]) – The double data array.

  • active_system (UnitSystem) – The active UnitSystem to interpret the data.

  • default_system (UnitSystem) – The default UnitSystem to interpret the data.

opm.io.deck.DeckKeyword.__init__(parser_keyword: ParserKeyword, py_data: numpy.ndarray[int]) DeckKeyword

Creates a DeckKeyword with a specified ParserKeyword and integer data (as a numpy.ndarray). For this, the keyword must be a data keyword!

Parameters:
  • parser_keyword (ParserKeyword) – The ParserKeyword to initialize the DeckKeyword with.

  • py_data (numpy.ndarray[int]) – The integer data array.

opm.io.deck.DeckKeyword.__init__(parser_keyword: ParserKeyword, record_list: list, active_system: UnitSystem, default_system: UnitSystem) DeckKeyword

Creates a DeckKeyword with a specified ParserKeyword, a list of records, and two UnitSystem objects for active and default systems.

Parameters:
  • parser_keyword (ParserKeyword) – The ParserKeyword to initialize the DeckKeyword with.

  • record_list (list) – A list of records containing the keyword data as also specified in the parser_keyword.

  • active_system (UnitSystem) – The active UnitSystem.

  • default_system (UnitSystem) – The default UnitSystem.

opm.io.deck.DeckKeyword.__iter__() iterator

Returns an iterator over the records of the DeckKeyword.

Returns:

An iterator for the records.

Type:

iterator

opm.io.deck.DeckKeyword.__len__() int

Returns the number of records in the DeckKeyword.

Returns:

The number of records in the DeckKeyword.

Type:

int

opm.io.deck.DeckKeyword.__repr__() str

Returns the name of the DeckKeyword as a string.

Returns:

The name of the DeckKeyword.

Type:

str

opm.io.deck.DeckKeyword.__str__() str

Returns a string representation of the DeckKeyword.

Returns:

The string representation of the DeckKeyword.

Type:

str

opm.io.deck.DeckKeyword.get_SI_array() numpy.ndarray[double]

Returns the SI double data of the DeckKeyword in a numpy.ndarray.

Returns:

The SI double data.

Type:

numpy.ndarray[double]

opm.io.deck.DeckKeyword.get_int_array() numpy.ndarray[int]

Returns the integer data of the DeckKeyword in a numpy.ndarray.

Returns:

The integer data.

Type:

numpy.ndarray[int]

opm.io.deck.DeckKeyword.get_raw_array() numpy.ndarray[double]

Returns the raw doule data of the DeckKeyword in a numpy.ndarray.

Returns:

The raw double data.

Type:

numpy.ndarray[double]

opm.io.deck.DeckKeyword.name() str

Returns the name of the DeckKeyword.

Returns:

The name of the DeckKeyword.

Type:

str

class opm.io.deck.UDAValue

Represents a UDA (User-Defined Arguments) in the deck.

opm.io.deck.UDAValue.__init__(value: double, dimension: Dimension) UDAValue

Creates a UDA with a double value and a dimension.

Parameters:
  • value (double) – The double value to store.

  • dimension (Dimension) – The dimension associated with this UDA.

Returns:

The UDAValue.

Type:

UDAValue

opm.io.deck.UDAValue.__init__(value: str, dimension: Dimension) UDAValue

Creates a UDA with a string value and a dimension.

Parameters:
  • value (str) – The string value to store.

  • dimension (Dimension) – The dimension associated with this UDA.

Returns:

The UDAValue.

Type:

UDAValue

opm.io.deck.UDAValue.__repr__() str

Returns a string representation of the UDA. This works for both string and double UDAs.

Returns:

A string representation of the UDA.

Type:

str

opm.io.deck.UDAValue.dimension() Dimension

Returns the dimension associated with this UDA.

Returns:

The dimension of the UDA.

Type:

Dimension

opm.io.deck.UDAValue.get_double() double

Returns the double value of the UDA.

Returns:

The double value of the UDA.

Type:

double

opm.io.deck.UDAValue.get_string() str

Returns the string value of the UDA.

Returns:

The string value of the UDA.

Type:

str

opm.io.deck.UDAValue.is_double() bool

Returns whether the UDA is of type double.

Returns:

True if the UDA is a double, False otherwise.

Type:

bool

opm.io.deck.UDAValue.is_string() bool

Returns whether the UDA is of type string.

Returns:

True if the UDA is a string, False otherwise.

Type:

bool

class opm.io.ecl.EGrid

Represents an Eclipse Grid file.

opm.io.ecl.EGrid.__init__(filename: str, grid_name: str = 'global') EGrid

Initializes an EGrid object by loading the grid file.

Parameters:
  • filename (str) – Path to the grid file.

  • grid_name (str) – The name of the grid (default is ‘global’).

Returns:

The EGrid object.

Return type:

EGrid

opm.io.ecl.EGrid.active_cells -> int

Returns the number of active cells in the grid.

Returns:

Number of active cells.

Type:

int

opm.io.ecl.EGrid.active_index(i: int, j: int, k: int) int

Returns the active index corresponding to the given IJK index.

Parameters:
  • i (int) – The i index.

  • j (int) – The j index.

  • k (int) – The k index.

Returns:

The active cell index.

Type:

int

opm.io.ecl.EGrid.cellvolumes() numpy.ndarray

Returns an array containing the volume of each cell in the grid.

Returns:

A NumPy array containing cell volumes.

Type:

numpy.ndarray

opm.io.ecl.EGrid.cellvolumes(mask: list[int]) numpy.ndarray

Returns an array containing the volume of the selected cells.

Parameters:

mask (list[int]) – List containing one entry per grid cell, if the entry in the list is ‘1’, this cell is selected by the mask.

Returns:

A NumPy array containing cell volumes.

Type:

numpy.ndarray

opm.io.ecl.EGrid.dimension -> tuple[int, int, int]

Returns the dimensions of the grid.

Returns:

The (x,y,z) dimensions.

Type:

tuple[int, int, int]

opm.io.ecl.EGrid.export_mapaxes() tuple[double, 8]

Exports the map axes transformation for visualization.

Returns:

tuple[double, 8]

opm.io.ecl.EGrid.global_index(i: int, j: int, k: int) int

Returns the global index corresponding to the given IJK index.

Parameters:
  • i (int) – The i index.

  • j (int) – The j index.

  • k (int) – The k index.

Returns:

The global index.

Type:

int

opm.io.ecl.EGrid.ijk_from_active_index(active_index: int) tuple[int, int, int]

Converts an active cell index to IJK indices.

Parameters:

active_index (int) – The active cell index.

Returns:

The (I, J, K) indices.

Type:

tuple[int, int, int]

opm.io.ecl.EGrid.ijk_from_global_index(global_index: int) tuple[int, int, int]

Converts a global index to IJK indices.

Parameters:

global_index (int) – The global index of the cell.

Returns:

The (I, J, K) indices.

Type:

tuple[int, int, int]

opm.io.ecl.EGrid.xyz_from_active_index(active_index: int) tuple[tuple[double, 8], tuple[double, 8], tuple[double, 8]]

Computes the XYZ coordinates of a cell given its active index.

Parameters:

active_index (int) – The active cell index.

Returns:

XYZ coordinates.

Type:

tuple[float, float, float]

opm.io.ecl.EGrid.xyz_from_active_index(active_index: int, apply_mapaxes: bool) tuple[tuple[double, 8], tuple[double, 8], tuple[double, 8]]

Computes the XYZ coordinates of a cell given its active index.

Parameters:
  • active_index (int) – The active cell index.

  • apply_mapaxes (bool) – Boolean to indicate if a mapaxes tranformation (if available) should be carried out before.

Returns:

XYZ coordinates.

Type:

tuple[float, float, float]

opm.io.ecl.EGrid.xyz_from_ijk(i: int, j: int, k: int) tuple[tuple[double, 8], tuple[double, 8], tuple[double, 8]]

Computes the XYZ coordinates of the 8 cell corners given its ijk indices.

Parameters:
  • i (int) – The i index of the cell.

  • j (int) – The j index of the cell.

  • k (int) – The k index of the cell.

Returns:

The XYZ coordinates, as three tuples.

Type:

tuple[tuple[double, 8], tuple[double, 8], tuple[double, 8]]

opm.io.ecl.EGrid.xyz_from_ijk(i: int, j: int, k: int, apply_mapaxes: bool) tuple[tuple[double, 8], tuple[double, 8], tuple[double, 8]]

Computes the XYZ coordinates of the 8 cell corners given its ijk indices.

Parameters:
  • i (int) – The i index of the cell.

  • j (int) – The j index of the cell.

  • k (int) – The k index of the cell.

  • apply_mapaxes (bool) – Boolean to indicate if a mapaxes tranformation (if available) should be carried out before.

Returns:

The XYZ coordinates, as three tuples.

Type:

tuple[tuple[double, 8], tuple[double, 8], tuple[double, 8]]

class opm.io.ecl.ERft

Handles RFT data from Eclipse simulation outputs.

opm.io.ecl.ERft.__get_data(array_name: str, report_index: int) tuple[numpy.ndarray, eclArrType]

Retrieves RFT array data using a report index.

Parameters:
  • array_name (str) – Name of the array.

  • report_index (int) – The report step index.

Returns:

The RFT data as a NumPy array and the eclArrType.

Return type:

tuple[numpy.ndarray, eclArrType]

opm.io.ecl.ERft.__get_data(array_name: str, well_name: str, year: int, month: int, day: int) tuple[numpy.ndarray, eclArrType]

Retrieves the RFT array data for a specific well and date.

Parameters:
  • array_name (str) – Name of the array.

  • well_name (str) – Well name.

  • year (int) – Year.

  • month (int) – Month.

  • day (int) – Day.

Returns:

The RFT data as a NumPy array and the eclArrType.

Return type:

tuple[numpy.ndarray, eclArrType]

opm.io.ecl.ERft.__get_list_of_arrays(report_index: int) list[tuple[str, eclArrType, int]]

Returns the metadata for arrays for a specific report step.

Parameters:

report_index (int) – The report step index.

Returns:

List of array metadata (name, type, size).

Return type:

list[tuple[str, eclArrType, int]]

opm.io.ecl.ERft.__get_list_of_arrays(well_name: str, year: int, month: int, day: int) list[tuple[str, eclArrType, int]]

Returns the metadata for arrays for a specific well and date.

Parameters:
  • well_name (str) – Well name.

  • year (int) – Year.

  • month (int) – Month.

  • day (int) – Day.

Returns:

List of array metadata (name, type, size).

Return type:

list[tuple[str, eclArrType, int]]

opm.io.ecl.ERft.__has_array(array_name: str, report_index: int) bool

Checks if an array exists for a specific report index.

Parameters:
  • array_name (str) – Name of the array.

  • report_index (int) – The report index.

Returns:

True if the array exists.

Return type:

bool

opm.io.ecl.ERft.__has_array(array_name: str, well_name: str, date: tuple[int, int, int]) bool

Checks if an array exists for a given well and date.

Parameters:
  • array_name (str) – Name of the array.

  • well_name (str) – Well name.

  • date (tuple[int, int, int]) – The date as a tuple(year, month, day).

Returns:

True if the array exists.

Return type:

bool

opm.io.ecl.ERft.__has_rft(well_name: str, year: int, month: int, day: int) bool

Checks if an RFT exists for the given well and date.

Parameters:
  • well_name (str) – Well name.

  • year (int) – Year.

  • month (int) – Month.

  • day (int) – Day.

Returns:

True if the RFT exists.

Return type:

bool

opm.io.ecl.ERft.__init__(filename: str) ERft

Initializes the ERft object from the specified file.

Parameters:

filename (str) – Path to the RFT file.

Returns:

The ERft object.

Return type:

ERft

opm.io.ecl.ERft.__len__() int

Returns the number of reports, i.e., the length of the ERft.

Returns:

The number of reports.

opm.io.ecl.ERft.list_of_rfts -> list[tuple[well_name: str, tuple[year: int, month: int, day: int]]]

Returns a list of RFT reports.

Returns:

A list of tuples with well names and corresponding dates.

Return type:

list[tuple[well_name: str, tuple[year: int, month: int, day: int]]]

class opm.io.ecl.ERst

Represents an Eclipse Restart file. This class inherits from the class EclFile.

opm.io.ecl.ERst.__contains__(tuple: [name: str, report_step: int]) bool

Checks if the Restart file contains a vector with the given name at the given report step.

Parameters:
  • name (str) – The name to check.

  • report_step (int) – The report step to check.

Returns:

True if such a vector exists, otherwise False.

Type:

bool

opm.io.ecl.ERst.__get_data(index: int, report_step: int) tuple[numpy.ndarray, eclArrType]

Retrieves the given index of the data at the given report step.

Parameters:

index (int) – The index.

Returns:

A tuple containing the data array and its associated type.

Return type:

tuple[numpy.ndarray, eclArrType]

opm.io.ecl.ERst.__has_report_step(report_step: int) bool

Checks if the specified report step exists in the file.

Parameters:

report_step (int) – The report step number to check.

Returns:

True if the report step exists, otherwise False.

Type:

bool

opm.io.ecl.ERst.__init__(filename: str) ERst

Initializes the ERst object by loading the Restart file (and the underlying EclFile) from the specified path.

Parameters:

filename (str) – The path to the Restart file.

Returns:

The ERst object.

Type:

ERst

opm.io.ecl.ERst.__len__() int

Returns the number of available report steps in the file.

Returns:

The number of report steps.

Type:

int

opm.io.ecl.ERst.arrays(report_step: int) list[tuple[str, eclArrType, int]]

Returns the list of arrays at the given report step.

Parameters:

report_step (int) – The report step number.

Returns:

A list of tuples containing the name, type, and size of each array.

Type:

list[tuple[str, eclArrType, int]]

opm.io.ecl.ERst.arrays(report_step: int, lgr_name: str) list[tuple[str, eclArrType, int]]

Returns a list of arrays matching the given LGR at the given report_step.

Parameters:
  • report_step (int) – The report step number.

  • lgr_name (str) – The name of the LGR.

Returns:

A list of tuples containing the name, type, and size of each array.

Type:

list[tuple[str, eclArrType, int]]

opm.io.ecl.ERst.count(name: str, report_step: int) int

Counts the occurrences of vectors with the specified name for the given report step.

Parameters:
  • name (str) – The name of the array to count.

  • report_step (int) – The report step number to load.

Returns:

The number of occurrences of the array for the given report step.

Type:

int

opm.io.ecl.ERst.get_erst_vector(name: str, report_step: int, occurrence: int) tuple[numpy.ndarray, eclArrType]

Retrieves the data array of the given name a the given occurrence at the given report step.

Parameters:
  • name (str) – The name of the arrays.

  • report_step (int) – The report step.

  • occurrence (int) – The occurrence to retrieve.

Returns:

A tuple containing the data array and its associated type.

Return type:

tuple[numpy.ndarray, eclArrType]

opm.io.ecl.ERst.load_report_step(report_step: int) None

Loads the specified report step from the file into memory.

Parameters:

report_step (int) – The report step number to load.

opm.io.ecl.ERst.report_steps -> list[int]

Returns a list of all available report step numbers in the file.

Returns:

A list of integers representing the available report steps.

Type:

list[int]

class opm.io.ecl.ESmry

Handles summary data from Eclipse simulations.

opm.io.ecl.ESmry.__contains__(key: str) bool

Checks if the specified key exists in the summary data.

Parameters:

key (str) – The key to check.

Returns:

True if the key exists, otherwise False.

Return type:

bool

opm.io.ecl.ESmry.__get_all(key: str) numpy.ndarray

Retrieves the summary vector for the given key.

Parameters:

key (str) – The key.

Returns:

The summary for the specified key.

Return type:

numpy.ndarray

opm.io.ecl.ESmry.__get_at_rstep(key: str) numpy.ndarray

Retrieves the report step summary vector for the given key.

Parameters:

key (str) – The key.

Returns:

The report step summary for the specified key.

Return type:

numpy.ndarray

opm.io.ecl.ESmry.__init__(filename: str, load_base_run: bool = False) ESmry

Initializes the ESmry object by loading the summary file.

Parameters:
  • filename (str) – Path to the .SMSPEC or .ESMRY file.

  • load_base_run (bool) – Whether to load base run data. Default is False.

Returns:

The ESmry object.

Return type:

ESmry

opm.io.ecl.ESmry.__len__() int

Returns the number of time steps in the summary data.

Returns:

The number of available time steps.

Return type:

int

opm.io.ecl.ESmry.dates() list[datetime.datetime]

Retrieves a list of dates corresponding to the time steps in the summary data.

Returns:

A list of dates.

Return type:

list[datetime.datetime]

opm.io.ecl.ESmry.keys() list[str]

Retrieves a list of summary keys.

Returns:

A list of available summary keys.

Return type:

list[str]

opm.io.ecl.ESmry.keys(pattern: str) list[str]

Retrieves a list of summary keys matching the given pattern.

Parameters:

pattern (str) – A pattern to filter the keys.

Returns:

A list of available summary keys.

Return type:

list[str]

opm.io.ecl.ESmry.make_esmry_file() None

Generates an ESMRY file from an SMSPEC input file.

opm.io.ecl.ESmry.start_date -> datetime.datetime

The start date of the summary data as a datetime.datetime.

Returns:

The start date.

Return type:

datetime.datetime

opm.io.ecl.ESmry.units(field: str) str

Retrieves the unit for a given field.

Parameters:

field (str) – The field name.

Returns:

The unit corresponding to the specified field.

Return type:

str

class opm.io.ecl.EclFile

Represents a file in the ECL format.

opm.io.ecl.EclFile.__contains__(name: str) bool

Checks if the array with the given name exists in the EclFile.

Parameters:

name (str) – The name to check for.

Returns:

True if the array exists, False otherwise.

Type:

bool

opm.io.ecl.EclFile.__get_data(index: int) -> tuple(numpy.ndarray, Opm::EclIO::eclArrType)

Retrieves an array of the EclFile by index.

Parameters:

index (int) – The index.

Returns:

A tupe of the array and its type.

:tuple(numpy.ndarray, Opm::EclIO::eclArrType)

opm.io.ecl.EclFile.__get_data(name: str) -> tuple(numpy.ndarray, Opm::EclIO::eclArrType)

Retrieves the first occurence of the array with the given name from the EclFile.

Parameters:

name (str) – The name.

Returns:

A tupe of the array and its type.

:tuple(numpy.ndarray, Opm::EclIO::eclArrType)

opm.io.ecl.EclFile.__get_data(name: str, occurrence: int) -> tuple(numpy.ndarray, Opm::EclIO::eclArrType)

Retrieves the given occurence of the array with the given name from the EclFile.

Parameters:
  • name (str) – The name.

  • occurrence (int) – The occurrence.

Returns:

A tupe of the array and its type.

:tuple(numpy.ndarray, Opm::EclIO::eclArrType)

opm.io.ecl.EclFile.__init__(filename: str, preload: bool = False) EclFile

Creates an EclFile instance.

Parameters:
  • filename (str) – The path to the EclFile.

  • preload (bool) – Whether to already load the contents of the file.

Returns:

The EclFile.

Type:

EclFile

opm.io.ecl.EclFile.__len__() int

Returns the number of arrays in the EclFile.

Returns:

The number of arrays.

Type:

int

opm.io.ecl.EclFile.arrays -> list[tuple(str, eclArrType, int)]

Returns a list of all arrays in the EclFile, where one entry of the list is a tuple containing the array name, the array type and the array size.

Returns:

A list the arrays in the EclFile.

Type:

list[tuple(str, eclArrType, int)]

opm.io.ecl.EclFile.count(name: str) int

Returns the total number of arrays with the given name in the EclFile.

Parameters:

name (str) – The name to check for.

Returns:

The number of records.

Type:

int

class opm.io.ecl.EclOutput

Class for writing Eclipse output files.

opm.io.ecl.EclOutput.__init__(filename: str, formatted: bool = False, append: bool = False) EclOutput

Initialize the EclOutput object.

Parameters:
  • filename (str) – The name of the output file.

  • formatted (bool) – Whether to use formatted output.

  • append (bool) – Whether to append to an existing file.

Returns:

The initialized EclOutput object.

Return type:

EclOutput

opm.io.ecl.EclOutput.__write_c0nn_array(array_name: str, data: list[str], element_size: int) None

Write connection (C0NN) data to the Eclipse output file.

Parameters:
  • array_name (str) – The array name for the data.

  • data (list[bool]) – List of C0NN strings to write.

  • element_size (int) – The element_size for type C0NN.

opm.io.ecl.EclOutput.__write_char_array(array_name: str, data: list[str]) None

Write a string array to the Eclipse output file under the given array name.

Parameters:
  • array_name (str) – The array name for the data.

  • data (list[str]) – List of strings to write.

opm.io.ecl.EclOutput.__write_doub_array(array_name: str, data: list[float]) None

Write a double-precision float array to the Eclipse output file under the given array name.

Parameters:
  • array_name (str) – The array name for the data.

  • data (list[float]) – List of double-precision floats to write.

opm.io.ecl.EclOutput.__write_inte_array(array_name: str, data: list[int]) None

Write an integer array to the Eclipse output file under the given array name.

Parameters:
  • array_name (str) – The array name for the data.

  • data (list[int]) – List of integers to write.

opm.io.ecl.EclOutput.__write_logi_array(array_name: str, data: list[bool]) None

Write a boolean array to the Eclipse output file under the given array name.

Parameters:
  • array_name (str) – The array name for the data.

  • data (list[bool]) – List of booleans to write.

opm.io.ecl.EclOutput.__write_real_array(array_name: str, data: list[float]) None

Write a float array to the Eclipse output file under the given array name.

Parameters:
  • array_name (str) – The array name for the data.

  • data (list[float]) – List of floats to write.

opm.io.ecl.EclOutput.write_message(message: str) None

Write a plain message to the Eclipse output file.

Parameters:

message (str) – The message string to write.

class opm.io.ecl.eclArrType

Python enum with the types of arrays used in the Eclipese file format.

opm.io.ecl.eclArrType.C0nn()

Represents an array type used for strings with a length > 8 characters.

opm.io.ecl.eclArrType.CHAR()

Represents a character array type.

opm.io.ecl.eclArrType.DOUB()

Represents a double-precision real array type.

opm.io.ecl.eclArrType.INTE()

Represents an integer array type.

opm.io.ecl.eclArrType.LOGI()

Represents a boolean array type.

opm.io.ecl.eclArrType.MESS()

Represents a data array type.

opm.io.ecl.eclArrType.REAL()

Represents a single-precision float array type.

class opm.io.ecl_state.EclipseState

The EclipseState class - this is a representation of all static properties in the model, ranging from porosity to relperm tables. The content of the EclipseState is immutable and may not be changed at runtime.

opm.io.ecl_state.EclipseState.__init__(deck: Deck) EclipseState

Creates an EclipseState from the given Deck.

Parameters:

deck (Deck) – The deck.

Returns:

The EclipseState.

opm.io.ecl_state.EclipseState.config() EclipseConfig

Returns the configuration for the Eclipse simulation.

Returns:

The simulation configuration.

Type:

EclipseConfig

opm.io.ecl_state.EclipseState.faultFaces(fault_name: str) list

Returns a list of faces of a fault with the given name.

Parameters:

fault_name (str) – The name of the fault.

Returns:

A list containing the faces of the specified fault.

opm.io.ecl_state.EclipseState.faultNames() list

Returns a list of fault names.

Returns:

A list containing the names of faults.

opm.io.ecl_state.EclipseState.field_props() FieldProperties

Returns the field properties for the Eclipse simulation.

Returns:

The field properties for the simulation.

Type:

FieldProperties

opm.io.ecl_state.EclipseState.grid() EclipseGrid

Returns the EclipseGrid used for the Eclipse simulation.

Returns:

The grid used in the simulation.

Type:

EclipseGrid

opm.io.ecl_state.EclipseState.has_input_nnc() bool

Checks whether the Eclipse simulation contains input for non-neighboring connections.

Returns:

True if the simulation has NNC input, otherwise False.

Type:

bool

opm.io.ecl_state.EclipseState.input_nnc() list

Returns a list of non-neighboring connections.

One non-neighboring connection is a tuple containing the following elements:

  • index1 (int): Index of the first cell.

  • index2 (int): Index of the second cell.

  • transmissibility (double): Transmissibility between the two cells.

Returns:

A list of non-neighboring connections.

opm.io.ecl_state.EclipseState.jfunc() dict

Function returning a dictionary with the following entries:

[‘FLAG’, ‘DIRECTION’, ‘ALPHA_FACTOR’, ‘BETA_FACTOR’, ‘OIL_WATER’, ‘GAS_OIL’]

Returns:

A dictionary containing the specified entries.

opm.io.ecl_state.EclipseState.simulation() SimulationConfiguration

Returns the simulation configuration.

Returns:

The simulation configuration.

opm.io.ecl_state.EclipseState.tables() TableManager

Returns the table manager associated with the Eclipse simulation.

Returns:

The table manager for the simulation.

Type:

TableManager

opm.io.ecl_state.EclipseState.title -> str

Returns the title of the EclipseState.

Returns:

The title.

class opm.io.parser.ParseContext

The ParseContext class manages how input parsing errors are handled for specific keywords.

opm.io.parser.ParseContext.__init__() ParseContext

Creates an empty ParseContext with default error handling behavior.

Returns:

ParseContext

opm.io.parser.ParseContext.__init__(action_list: list[tuple[str, action]]) None

Initializes a ParseContext with a list of specific error handling actions for the given keyword.

Parameters:

action_list (list[tuple[str, action]]) – A list of (keyword, action) pairs specifying how to handle errors for a keyword, wildcards ‘*’ are possible in the keyword.

Returns:

ParseContext

opm.io.parser.ParseContext.ignore_keyword(keyword: str) None

Instructs the parser to ignore the specified keyword.

Parameters:

keyword (str) – The keyword to ignore.

Returns:

None

opm.io.parser.ParseContext.update(keyword: str, action: action) None

Updates the error handling behavior for a specific keyword.

Parameters:
  • keyword (str) – The keyword to update, wildcards ‘*’ are possible in the keyword.

  • action (action) – The error handling action to associate with the keyword.

Returns:

None

class opm.io.parser.action

Python enum with the types of input errors for parsing a file.

opm.io.parser.action.ignore()

Silently ignore the parsing error.

opm.io.parser.action.throw()

Raise an exception when a parsing error occurs.

opm.io.parser.action.warn()

Issue a warning when a parsing error occurs, but continue.

class opm.io.schedule.Schedule

The Schedule class - this is a representation of all the content from the SCHEDULE section, notably all well and group information and the timestepping.

opm.io.schedule.Schedule.__contains__(well_name: str) bool

Checks if a well exists in the Schedule at the current report step.

Parameters:

well_name (str) – The name of the well to check.

Returns:

True if the well exists, False otherwise.

opm.io.schedule.Schedule.__getitem__(report_step: int) ScheduleState

Returns the ScheduleState at the given report step.

Parameters:

report_step (int) – The report step.

Returns:

The ScheduleState at the given report step.

opm.io.schedule.Schedule.__len__() int

Returns the number of report steps, i.e., the length of the Schedule.

Returns:

The number of report steps.

opm.io.schedule.Schedule._groups(report_step: int) list

Gets a list of all groups at a specified report step.

Parameters:

report_step (int) – The report step to retrieve groups for.

Returns:

A list containing all groups at the specified report step.

opm.io.schedule.Schedule.end -> datetime.datetime

Retrieves the end time of the schedule as a datetime.datetime.

Returns:

The end time of the schedule.

opm.io.schedule.Schedule.get_injection_properties(well_name: str, report_step: int) dict

Gets injection properties for a well at a specific report step.

Parameters:
  • well_name (str) – The name of the well.

  • report_step (int) – The report step to retrieve properties for.

Returns:

A dict containing the properties surf_inj_rate, resv_inj_rate, bhp_target, thp_target.

opm.io.schedule.Schedule.get_production_properties(well_name: str, report_step: int) dict

Gets production properties for a well at a specific report step.

Parameters:
  • well_name (str) – The name of the well.

  • report_step (int) – The report step to retrieve properties for.

Returns:

A dict containing the properties oil_rate, gas_rate, water_rate, liquid_rate, resv_rate, bhp_target, thp_target, alq_value.

opm.io.schedule.Schedule.get_well(well_name: str, report_step: int) Well

Retrieves a well at a given report step.

Parameters:
  • well_name (str) – The name of the well.

  • report_step (int) – The report step.

Returns:

Well object at the given report step.

opm.io.schedule.Schedule.get_wells(report_step: int) list

Gets the names of wells at the given report step.

Parameters:

report_step (int) – The report step.

Returns:

A list containing the names of wells at the given report step.

opm.io.schedule.Schedule.insert_keywords(data: str) None

Inserts the given keywords into the Schedule at the current report step using the unit system of the Schedule.

Parameters:

data (str) – The deck string to be inserted into the Schedule.

opm.io.schedule.Schedule.insert_keywords(data: str, step: int) None

Inserts the given keywords into the Schedule at the given report step using the unit system of the Schedule.

Parameters:
  • data (str) – The deck string to be inserted into the Schedule.

  • step (int) – The report step.

opm.io.schedule.Schedule.insert_keywords(data: str, step: int, unit_system: UnitSystem) None

Inserts the given keywords into the Schedule at the given report step using the given unit system.

Parameters:
  • data (str) – The deck string to be inserted into the Schedule.

  • step (int) – The report step.

  • unit_system (UnitSystem) – The unit system.

opm.io.schedule.Schedule.insert_keywords(keywords: list, step: int) None

Inserts the given keywords into the Schedule at the given report step.

Parameters:
  • keywords – A Python list of strings, contianing the keywords.

  • step (int) – The report step.

opm.io.schedule.Schedule.open_well(well_name: str) None

Opens a well at the current report step.

Parameters:

well_name (str) – The name of the well to open.

opm.io.schedule.Schedule.open_well(well_name: str, step: int) None

Opens a well at a given report step.

Parameters:
  • well_name (str) – The name of the well to open.

  • step (int) – The report step at which to open the well.

Raises:

ValueError – If the report step is in the past or exceeds the duration of the simulation.

opm.io.schedule.Schedule.reportsteps -> list[datetime.datetime]

Retrieves a list of all report steps in the schedule as a Python list of datetime.datetime objects.

Returns:

A list containing the report steps of the schedule.

opm.io.schedule.Schedule.shut_well(well_name: str) None

Shuts down a well at the current report step.

Parameters:

well_name (str) – The name of the well to shut down.

opm.io.schedule.Schedule.shut_well(well_name: str, step: int) None

Shuts down a well at a given report step.

Parameters:
  • well_name (str) – The name of the well to shut down.

  • step (int) – The report step at which to shut down the well.

opm.io.schedule.Schedule.start -> datetime.datetime

Retrieves the start time of the schedule as a datetime.datetime.

Returns:

The start time of the schedule.

opm.io.schedule.Schedule.stop_well(well_name: str) None

Stops a well at the current report step.

Parameters:

well_name (str) – The name of the well to stop.

opm.io.schedule.Schedule.stop_well(well_name: str, step: int) None

Stops a well at a given report step.

Parameters:
  • well_name (str) – The name of the well to stop.

  • step (int) – The report step at which to stop the well.

Raises:

ValueError – If the report step is in the past or exceeds the duration of the simulation.

opm.io.schedule.Schedule.well_names(well_name_pattern: str) list

Gets the names of wells matching a specified pattern.

Parameters:

well_name_pattern (str) – The pattern for well names, where ‘*’ acts as a wildcard.

Returns:

A list containing the names of wells that match the specified pattern.

class opm.io.sim.SummaryState

The SummaryState class - this is where the current summary results of the simulator are stored. The SummaryState class has methods to get hold of well, group and general variables.

opm.io.sim.SummaryState.__contains__(variable_name: str) bool

Checks if a variable exists in the SummaryState.

Parameters:

variable_name (str) – The name of the variable to check.

Returns:

True if the variable exists, False otherwise.

opm.io.sim.SummaryState.__getitem__(variable_name: str) double

Gets the value of a variable of the SummaryState.

Parameters:

variable_name (str) – The name of the variable to retrieve.

Returns:

The value of the specified variable for the well.

opm.io.sim.SummaryState.__setitem__(variable_name: str, new_value: double) None

Updates or insert the variable of the SummaryState.

Parameters:
  • variable_name (str) – The name of the variable to update or insert.

  • new_value (double) – The new value of the variable.

opm.io.sim.SummaryState.elapsed() double

Returns the elapsed time in seconds of the current simulation.

Returns:

The elapsed time in seconds.

opm.io.sim.SummaryState.group_var(group_name: str, variable_name: str) double

Gets the value of a variable for a group.

Parameters:
  • group_name (str) – The name of the group.

  • variable_name (str) – The name of the variable to retrieve.

Returns:

The value of the specified variable for the group.

opm.io.sim.SummaryState.groups -> list

Returns a list of strings containing all group names.

Returns:

A list of strings representing all group names.

opm.io.sim.SummaryState.has_group_var(group_name: str, variable_name: str) bool

Checks if a group variable exists.

Parameters:
  • group_name (str) – The name of the group.

  • variable_name (str) – The name of the variable to check.

Returns:

True if the variable exists for the group, False otherwise.

opm.io.sim.SummaryState.has_well_var(well_name: str, variable_name: str) bool

Checks if a well variable exists.

Parameters:
  • well_name (str) – The name of the well.

  • variable_name (str) – The name of the variable to check.

Returns:

True if the variable exists for the well, False otherwise.

opm.io.sim.SummaryState.update(variable_name: str, value: double) None

Updates or increments the given variable of the SummaryState, depending on whether the variable is cumulative or not. The variable must already exist in the SummaryState for this.

Parameters:
  • variable_name (str) – The name of the variable to update or increment.

  • value (double) – The value to set or increment the variable by.

opm.io.sim.SummaryState.update_group_var(group_name: str, variable_name: str, new_value: double) None

Updates the variable of a group.

Parameters:
  • group_name (str) – The name of the group.

  • variable_name (str) – The name of the variable to update.

  • new_value (double) – The new value of the variable.

opm.io.sim.SummaryState.update_well_var(well_name: str, variable_name: str, new_value: double) None

Updates the variable of a well.

Parameters:
  • well_name (str) – The name of the well.

  • variable_name (str) – The name of the variable to update.

  • new_value (double) – The new value of the variable.

opm.io.sim.SummaryState.well_var(well_name: str, variable_name: str) double

Gets the value of a variable for a well.

Parameters:
  • well_name (str) – The name of the well.

  • variable_name (str) – The name of the variable to retrieve.

Returns:

The value of the specified variable for the well.

opm.io.sim.SummaryState.wells -> list

Returns a list of strings containing all well names.

Returns:

A list of strings representing all well names.

class opm.io.summary.SummaryConfig

Represents the configuration for the summary.

opm.io.summary.SummaryConfig.__contains__(keyword: str) bool

Checks whether a keyword exists in the SummaryConfig.

Parameters:

keyword (str) – The keyword to check.

Returns:

True if the keyword exists, False otherwise.

Type:

bool

opm.io.summary.SummaryConfig.__init__(deck: Deck, state: EclipseState, schedule: Schedule) SummaryConfig

Creates a SummaryConfig with the provided deck, state, and schedule.

Parameters:
  • deck (Deck) – The deck containing simulation data.

  • state (EclipseState) – The EclipseState containing simulation state.

  • schedule (Schedule) – The schedule for the simulation.

Returns:

A new instance of SummaryConfig.

Type:

SummaryConfig

class opm.util.EModel

Represents an Eclipse model loaded from a simulation file.

opm.util.EModel.__add_filter(key: str, operator: str, value1: float, value2: float) None

Adds a float filter with two bounds, i.e., a range filter.

Parameters:
  • key (str) – Name of the parameter to filter.

  • operator (str) – Comparison operator (‘between’ or ‘in’).

  • value1 (float) – Lower bound.

  • value2 (float) – Upper bound.

opm.util.EModel.__add_filter(key: str, operator: str, value1: int, value2: int) None

Adds an integer filter with two bounds, i.e., a range filter.

Parameters:
  • key (str) – Name of the parameter to filter.

  • operator (str) – Comparison operator (‘between’ or ‘in’).

  • value1 (int) – Lower bound of the filter.

  • value2 (int) – Upper bound of the filter.

opm.util.EModel.__add_filter(key: str, operator: str, value: float) None

Adds a float filter with a single value.

Parameters:
  • key (str) – Name of the parameter to filter.

  • operator (str) – Comparison operator (‘==’, ‘>’, ‘<’ or ‘eq’, ‘gt’, ‘lt’).

  • value (float) – Floating-point value for the filter.

opm.util.EModel.__add_filter(key: str, operator: str, value: int) None

Adds an integer filter with a single value.

Parameters:
  • key (str) – Name of the parameter to filter.

  • operator (str) – Comparison operator (‘==’, ‘>’, ‘<’ or ‘eq’, ‘gt’, ‘lt’).

  • value (int) – Integer value for the filter.

opm.util.EModel.__contains__(parameter: str) bool

Checks if the given init or solution parameter exists in the model.

Parameters:

parameter (str) – Name of the parameter.

Returns:

True if the parameter exists.

Return type:

bool

opm.util.EModel.__init__(filename: str) EModel

Initializes the EModel instance using the provided file.

Parameters:

filename (str) – Path to the file.

Returns:

EModel object.

Return type:

EModel

opm.util.EModel.active_cells() int

Returns the number of active cells in the simulation grid.

Returns:

Number of active grid cells.

Return type:

int

opm.util.EModel.active_report_step() int

Gets the currently active report step.

Returns:

Active report step index.

Return type:

int

opm.util.EModel.add_filter(key: str, operator: str, val1: int | float, val2: int | float | None = None) None

Adds a filter to the EModel based on parameter type and number of values.

Automatically determines the array type (integer or float) based on the key and dispatches the appropriate filter method.

Parameters:
  • key (str) – Name of the parameter to filter.

  • operator (str) – Comparison operator (e.g., ‘==’, ‘>’, ‘<’, ‘>=’, ‘<=’).

  • val1 (int or float) – First comparison value.

  • val2 (int or float or None) – Optional second value for range-based filters.

Raises:

ValueError – If the report step is in the past or exceeds the duration of the simulation.

opm.util.EModel.add_hc_filter() None

Adds a HC volume filter to the model.

opm.util.EModel.get(key: str) numpy.ndarray

Retrieves a parameter array by key. Returns an array of floats or integers depending on the data type.

Parameters:

key (str) – Name of the parameter.

Returns:

Parameter data as a NumPy array.

Return type:

numpy.ndarray

opm.util.EModel.get_list_of_arrays() list[tuple[str, eclArrType]]

Returns a list of available parameter arrays and their types.

Returns:

List of tuples with parameter arrays and their types.

Return type:

list[tuple[str, eclArrType]]

opm.util.EModel.get_report_steps() list[int]

Returns all available report steps.

Returns:

List of report steps.

Return type:

list[int]

opm.util.EModel.grid_dims() tuple[int, int, int]

Returns the grid dimensions (I, J, K) of the simulation model.

Returns:

Tuple containing the grid dimensions.

Return type:

tuple[int, int, int]

opm.util.EModel.has_report_step(report_step: int) bool

Checks if the specified report step exists.

Parameters:

report_step (int) – The report step.

Returns:

True if the report step exists.

Return type:

bool

opm.util.EModel.reset_filter() None

Clears all filters currently applied to the model.

opm.util.EModel.set_depth_fwl(fwl: list[float]) None

Sets the free water level depths.

Parameters:

fwl (list[float]) – List of free water level depths.

opm.util.EModel.set_report_step(report_step: int) None

Sets the active report step to the given report step and initializes the solution data.

Parameters:

report_step (int) – The report step.