OPM Common Python Documentation

Note on Import Paths

In this documentation, some classes are referenced with their full import paths (e.g., opm.io.deck.DeckItem), 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.deck import DeckItem
  • 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.getCellDepth1G(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.getCellDepth3(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.getCellDepthAll() 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.getCellDepthMask(mask: list[int]) numpy.ndarray[double]

Returns the depths for the cell with the global ids given in the input list.

Returns:

The depths for the given cells.

Type:

numpy.ndarray[double]

EclipseGrid.getCellVolume1G(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.getCellVolume3(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.getCellVolumeAll() 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.getCellVolumeMask(mask: list[int]) numpy.ndarray[double]

Returns the cell volumes for the cells with the global ids given in the input list.

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

EclipseState.config() EclipseConfig

Returns the configuration for the Eclipse simulation.

Returns:

The simulation configuration.

Type:

EclipseConfig

EclipseState.field_props() FieldPropsManager

Returns the field properties for the Eclipse simulation.

Returns:

The field properties for the simulation.

Type:

FieldPropsManager

EclipseState.grid() EclipseGrid

Returns the EclipseGrid used for the Eclipse simulation.

Returns:

The grid used in the simulation.

Type:

EclipseGrid

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

EclipseState.tables() TableManager

Returns the table manager associated with the Eclipse simulation.

Returns:

The table manager for the simulation.

Type:

TableManager

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.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.pos() tuple

Retrieves the position of the well.

Returns:

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

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.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)

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.

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.

Returns:

None

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.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.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.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.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.title -> str

Returns the title of the EclipseState.

Returns:

The title.

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