Skip to content

ecl⚓︎

Read Schlumberger Eclipse output files.

EclipseCase ⚓︎

Bases: object

Read data for an Eclipse simulation case.

__init__(casename) ⚓︎

Initialize the Eclipse case.

Parameters:

Name Type Description Default
casename str

Path to the case, with or without extension.

required

Returns:

Type Description
None

at(when) ⚓︎

Recurrent data for a certain timestep.

The result of this method is usually passed to functions that need to calculate something using several properties.

Parameters:

Name Type Description Default
when datetime or int

Date of the property.

required

Returns:

Type Description
EclipseRestart

Object containing properties for this timestep.

atsm(when) ⚓︎

Recurrent data from summary file for a certain timestep.

The result of this method is usually passed to functions that need to calculate something using several properties.

Parameters:

Name Type Description Default
when datetime or int

Date of the property.

required

Returns:

Type Description
EclipseSummary

Object containing summary properties for this timestep.

cell_data(prop, when=None) ⚓︎

Read cell-wise data from case. This can be either static information or recurrent information for a certain date.

Parameters:

Name Type Description Default
prop str

Name of the property, e.g., 'SWAT'.

required
when datetime or int

Date of the property, or None if static.

None

Returns:

Type Description
ndarray

Loaded array for the property.

Examples:

>>> case = EclipseCase(cmd_args.filename)
>>> zmf2 = case.cell_data('ZMF2', datetime.datetime(2054, 7, 1))

components() ⚓︎

Components that exist in the restart file.

Examples:

>>> case = EclipseCase(filename)
>>> comps = case.components()
>>> print("Number of components is %d" % (len(comps)))
>>> for num, name in enumerate(comps):
>>>     print("%d : %s" % (num, name))

field_data(prop, when=None) ⚓︎

Read field-wise data from case. This can be either static information or recurrent information for a certain date.

Parameters:

Name Type Description Default
prop str

Name of the property, e.g., 'ZPHASE'.

required
when datetime or int

Date of the property, or None if static.

None

Returns:

Type Description
ndarray

Loaded array for the property.

Examples:

>>> case = EclipseCase(cmd_args.filename)
>>> zphase = case.cell_data('ZPHASE', datetime.datetime(2054, 7, 1))

grid() ⚓︎

Grid structure for simulation case.

phases() ⚓︎

Phases that exist in the restart file.

case = EclipseCase (filename) phs = case.phases () print ("Number of phases is %d" % (len (phs))) print ("Keyword for first phase is %s" % ("S" + phs [0])) if Phase.oil in phs: print ("Oil is present") else: print ("Oil is not present")

report_dates() ⚓︎

List of all the report dates that are available in this case.

Items from this list can be used as a parameter to at to get the case for that particular report step.

Returns:

Type Description
list of datetime.datetime

List of available report dates in sequence.

Examples:

>>> for rstp in case.report_dates():
>>>     print(case.at(rstp).this_date)
See Also

ecl.EclipseCase.at

shape() ⚓︎

Get shape of returned field data.

Returns:

Type Description
tuple of int

Shape of the field data as (num_k, num_j, num_i).

start_date() ⚓︎

Starting date of the simulation

summary_data(prop, when) ⚓︎

Read summary data from case. This is typically well data, but can also be, for example, newton iterations.

Parameters:

Name Type Description Default
prop str

Name of the property, e.g., 'WWPR PRO1'.

required
when datetime or int

Date of the property.

required

Returns:

Type Description
ndarray

Loaded array for the property.

Examples:

>>> case = EclipseCase(cmd_args.filename)
>>> data = case.cell_data('WWIR INJ-5', datetime.datetime(2054, 7, 1))

EclipseData ⚓︎

Bases: object

Base class for both static and recurrent data.

cell_data(selector) ⚓︎

Get a field property for every cell at this restart step.

Parameters:

Name Type Description Default
selector tuple

Specification of the property to be loaded. This is a tuple starting with a Prop, and then some context-dependent items.

required

Returns:

Type Description
ndarray

Array of the data with inactive cells masked off.

Examples:

>>> pres = case.cell_data((Prop.pres,))
>>> swat = case.cell_data((Prop.sat, Phase.wat))
>>> xco2 = case.cell_data((Prop.mole, 'CO2', Phase.gas))

components() ⚓︎

Components that exist in the restart file. Components used in the simulation are stored in all the restart files instead of once in the init file, since it is the restart file that hold component fields.

field_data(propname) ⚓︎

Get a property for the entire field at this restart step.

Parameters:

Name Type Description Default
propname str

Name of the property to be loaded.

required

Returns:

Type Description
ndarray

Array of the data.

summary_data(propname) ⚓︎

Get a property from the summary file at this restart step.

Parameters:

Name Type Description Default
propname str

Name of the property to be loaded. This is in the form 'mnemonic well', e.g., 'WWIR I05'. Alternatively, propname can be either only well or only mnemonic. Then the value for all mnemonics or all wells are given, e.g., propname='WWIR' returns WWIR for all wells.

required

Returns:

Type Description
ndarray

Array of the data.

EclipseFile ⚓︎

Bases: object

Low-level class to read records from binary files.

Access to this object must be within a monitor (with-statement).

__exit__(typ, val, traceback) ⚓︎

Close the underlaying file object when we go out of scope.

__init__(root, ext) ⚓︎

Initialize file object from a path in the filesystem.

Parameters:

Name Type Description Default
root str

Stem of the file name (including directory).

required
ext str

Extension of the file to read from.

required

Returns:

Type Description
None

dump(positional=False, fileobj=sys.stdout) ⚓︎

Dump catalog contents of records in the datafile.

Parameters:

Name Type Description Default
positional bool

If True, the keywords should be sorted on position in the file.

False

Examples:

>>> f = EclipseFile("foo", 'INIT')
>>> f.dump()

get(kwd, seq=0) ⚓︎

Read a (potentially indexed) keyword from file.

Parameters:

Name Type Description Default
kwd str

Keyword to read.

required
seq int

Sequence number, starting from zero.

0

Examples:

>>> with EclipseFile('foo', 'EGRID') as grid:
>>>     zcorn = grid.get('ZCORN')

EclipseGrid ⚓︎

Bases: object

Corner-point geometry data from an Eclipse Extensive Grid file.

grid() ⚓︎

Create a grid structure from the information read from file.

Returns:

Type Description
dict

Grid structure.

Examples:

>>> # convert from .EGRID to .grdecl:
>>> import pyresito.io.ecl as ecl
>>> import pyresito.io.grdecl as grdecl
>>> grdecl.write('foo.grdecl', ecl.EclipseGrid('FOO').grid())

EclipseInit ⚓︎

Bases: EclipseData

Read information from static data (init) file.

EclipseRFT ⚓︎

Bases: object

Read data from an Eclipse RFT file.

__init__(casename) ⚓︎

Initialize the Eclipse case.

Parameters:

Name Type Description Default
casename str

Path to the case, with or without extension.

required

Returns:

Type Description
None

rft_data(well, prop) ⚓︎

Read the RFT data for the requested well.

Parameters:

Name Type Description Default
well str

Name of the well, e.g., 'PRO-1'.

required
prop str

Type of property (depth, pressure, swat, or sgas).

required

Returns:

Type Description
ndarray

Loaded array for the property.

Examples:

>>> case = EclipseRFT(cmd_args.filename)
>>> data = case.rft_data(well='INJ-5', prop='PRESSURE')

EclipseRestart ⚓︎

Bases: EclipseData

Read information from a recurrent data (restart) file.

__init__(grid, seq) ⚓︎

Initialize the restart file reader.

Parameters:

Name Type Description Default
grid EclipseInit or EclipseGrid

Initialization file which contains grid dimensions.

required
seq int

Run number.

required

Returns:

Type Description
None

date() ⚓︎

Simulation date the restart file is created for.

EclipseSummary ⚓︎

Bases: EclipseData

Read information from a recurrent data (summary) file.

__init__(grid, seq) ⚓︎

Initialize the restart file reader.

Parameters:

Name Type Description Default
grid EclipseInit or EclipseGrid

Initialization file which contains grid dimensions.

required
seq int

Run number.

required

Returns:

Type Description
None

date() ⚓︎

Simulation date the restart file is created for.

main(*args) ⚓︎

Read a data file to see if it parses OK.