PetrelConnection#
- class cegalprizm.pythontool.PetrelConnection(allow_experimental: Optional[bool] = None, enable_history: Optional[bool] = True, petrel_ctx: Optional[cegalprizm.hub.base_ctx.BaseContext] = None)#
Creates a connection to Petrel. A typical usage is
ptp = PetrelConnection() '''write some code accessing Petrel here''' ptp.close()
Python Tool Pro will try to connect to a running Hub server and will create a default Petrel context (petrel_ctx). This will work if 1 Petrel connector (1 Petrel instace) is connected to the Hub server. If multiple Petrel connectors are available you need to define the Petrel context to ensure you connect to the correct Petrel instance.
- Parameters
petrel_ctx – A context or handle to a Cegal Hub Petrel Connector
allow_experimental – Enable experimental methods to be called. Defaults to False
enable_history –
Petrel data object history is updated when changed from Python Tool Pro. Defaults to True.
Functions
__init__
([allow_experimental, ...])Verify that a project is active on the server.
append_scriptname_to_history
(path_to_append)EXPERIMENTAL METHOD! Define path that will be appended to the history entries when objects are modified.
close
()Close the connection to Petrel.
Returns the name of the Petrel project of the established connection.
Get the Petrel project units of the established PetrelConnection.
get_petrelobjects_by_guids
(guids)Get the Petrel objects with the given GUIDs
import_workflows
(projectPath, workflowNames)Import a Petrel workflow from a different Petrel project.
open
()DeprecationWarning: "petrelconnection.open() is deprecated and will be removed in Python Tool Pro in 3.0.
ping
()Typically used to verify connection to the server.
Properties
crs_wkt
Retrieve all discrete well logs in Petrel as DiscreteGlobalWellLog objects and collect them in a dictionary with their paths as keys.
Retrieve all discrete grid properties in Petrel as GridDiscreteProperty objects and collect them in a dictionary with their paths as keys.
'discrete_properties' has been removed.
Retrieve all discrete surface attributes in Petrel as SurfaceDiscreteAttribute objects and collect them in a dictionary with their paths as keys.
Retrieve all discrete well logs in Petrel as DiscreteWellLog objects and collect them in a dictionary with their paths as keys.
Retrieve all global observed data sets in Petrel as GlobalObservedDataSet objects and collect them in a dictionary with their paths as keys.
Retrieve all global well logs in Petrel as GlobalWellLog objects and collect them in a dictionary with their paths as keys.
Retrieve all grid properties in Petrel as GridProperty objects and collect them in a dictionary with their paths as keys.
Retrieve all grids in Petrel as Grid objects and collect them in a dictionary with their paths as keys.
Retrieve all 3D horizon interpretation objects in Petrel as HorizonInterpretation3d objects and collect them in a dictionary with their paths as keys.
Retrieve all seismic horizon in Petrel as HorizonInterpretation objects and collect them in a dictionary with their paths as keys.
Retrieve all horizon properties in Petrel as HorizonProperty objects and collect them in a dictionary with their paths as keys.
Retrieve all marker collections in Petrel as MarkerCollection objects and collect them in a dictionary with their paths as keys.
Retrieve all observed data sets in Petrel as ObservedDataSet objects and collect them in a dictionary with their paths as keys.
Retrieve all point sets in Petrel as PointSet objects and collect them in a dictionary with their paths as keys.
Retrieve all polyline sets in Petrel as PolylineSet objects and collect them in a dictionary with their paths as keys.
Returns a dictionary with the predefined global observed data in the petrel project
'properties' has been removed.
Retrieve all property collections in Petrel as PropertyCollection objects and collect them in a dictionary with their paths as keys.
Retrieve all seismic lines in Petrel as SeismicLine objects and collect them in a dictionary with their paths as keys.
Retrieve all seismic cubes in Petrel as SeismicCube objects and collect them in a dictionary with their paths as keys.
Retrieve all seismic lines in Petrel as SeismicLine objects and collect them in a dictionary with their paths as keys.
Retrieve all surface attributes in Petrel as SurfaceAttribute objects and collect them in a dictionary with their paths as keys.
Retrieve all discrete surface attributes in Petrel as SurfaceDiscreteAttribute objects and collect them in a dictionary with their paths as keys.
Retrieve all surfaces in Petrel as Surface objects and collect them in a dictionary with their paths as keys.
Retrieve all wavelets in Petrel as Wavelet objects and collect them in a dictionary with their paths as keys.
Retrieve all well logs in Petrel as WellLog objects and collect them in a dictionary with their paths as keys.
Retrieve all well surveys in Petrel as WellSurvey objects and collect them in a dictionary with their paths as keys.
Retrieve all wells in Petrel as Well objects and collect them in a dictionary with their paths as keys.
Retrieve all workflows in Petrel as Workflows objects and collect them in a dictionary with their paths as keys.
- a_project_is_active() bool #
Verify that a project is active on the server. A project must be active.
- Returns
True if and only if a project is active
- Return type
bool
- append_scriptname_to_history(path_to_append: str) str #
EXPERIMENTAL METHOD! Define path that will be appended to the history entries when objects are modified.
- Args:
path_to_append: The string of the path to append.
Example:
from cegalprizm.pythontool.petrelconnection import PetrelConnection, make_connection petrel = PetrelConnection(allow_experimental=True) petrel.append_script_name_to_history(‘c:notebooksmergeworkbook.ipynb’) #Modify petrel.close()
- close() None #
Close the connection to Petrel.
- get_current_project_name() str #
Returns the name of the Petrel project of the established connection.
- get_petrel_project_units() Dict[str, str] #
Get the Petrel project units of the established PetrelConnection.
- Returns
A dictionary with the storage units and their unit symbols
- get_petrelobjects_by_guids(guids: List[str]) List[object] #
Get the Petrel objects with the given GUIDs
Note
The format of the GUIDs need to be the same as the droids of the Petrel objects which is 32-character hexadecimal string including dashes, e.g ‘12345678-1234-5678-1234-567812345678’ When using GUIDs from Studio for Petrel the GUIDs do not include the dashes, e.g ‘12345678123456781234567812345678’ To convert GUIDs from Studio format to Petrel droid format use library uuid https://docs.python.org/3/library/uuid.html
import uuid str(uuid.UUID('12345678123456781234567812345678'))
- Parameters
guids – A list of GUIDs as strings of the objects to be returned
- Returns
- A list with the objects for the given GUIDs.
If GUID does not exist in Petrel project ‘None’ is returned.
- import_workflows(projectPath: str, workflowNames: List[str]) List[cegalprizm.pythontool.workflow.Workflow] #
Import a Petrel workflow from a different Petrel project.
- Parameters
projectPath – the file path to the Petrel project
workflowNames – the Petrel name[s] of the workflow[s] to be imported
- open() None #
DeprecationWarning: “petrelconnection.open() is deprecated and will be removed in Python Tool Pro in 3.0. open() is no longer necessary after creating a new PetrelConnection object.
- ping() int #
Typically used to verify connection to the server.
- Returns
A counter returned by the server
- Return type
int
- property discrete_global_well_logs: cegalprizm.pythontool.grpc.petrelobjects.DiscreteGlobalWellLogs#
Retrieve all discrete well logs in Petrel as DiscreteGlobalWellLog objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of DiscreteGlobalWellLog objects by their path.
- Return type
DiscreteGlobalWellLogs
Examples
To retrieve a specific Petrel object use:
my_var=petrel.discrete_global_well_logs[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property discrete_grid_properties: cegalprizm.pythontool.grpc.petrelobjects.DiscreteProperties#
Retrieve all discrete grid properties in Petrel as GridDiscreteProperty objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of GridDiscreteProperty objects by their path.
- Return type
DiscreteProperties
Examples
To retrieve a specific Petrel object use:
my_var=petrel.discrete_grid_properties[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property discrete_properties: cegalprizm.pythontool.grpc.petrelobjects.DiscreteProperties#
‘discrete_properties’ has been removed. Use ‘discrete_grid_properties’ instead
- Type
DeprecationWarning
- property discrete_surface_attributes: cegalprizm.pythontool.grpc.petrelobjects.SurfaceDiscreteAttributes#
Retrieve all discrete surface attributes in Petrel as SurfaceDiscreteAttribute objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of SurfaceDiscreteAttribute objects by their path.
- Return type
SurfaceDiscreteAttributes
Examples
To retrieve a specific Petrel object use:
my_var=petrel.surface_discrete_attributes[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property discrete_well_logs: cegalprizm.pythontool.grpc.petrelobjects.DiscreteWellLogs#
Retrieve all discrete well logs in Petrel as DiscreteWellLog objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of DiscreteWellLog objects by their path.
- Return type
DiscreteWellLogs
Examples
To retrieve a specific Petrel object use:
my_var=petrel.discrete_well_logs[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property global_observed_data_sets: cegalprizm.pythontool.grpc.petrelobjects.GlobalObservedDataSets#
Retrieve all global observed data sets in Petrel as GlobalObservedDataSet objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of GlobalObservedDataSet objects by their path.
- Return type
GlobalObservedDataSets
Examples
To retrieve a specific Petrel object use:
my_var=petrel.global_observed_data_sets[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property global_well_logs: cegalprizm.pythontool.grpc.petrelobjects.GlobalWellLogs#
Retrieve all global well logs in Petrel as GlobalWellLog objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of GlobalWellLog objects by their path.
- Return type
GlobalWellLogs
Examples
To retrieve a specific Petrel object use:
my_var=petrel.global_well_logs[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property grid_properties: cegalprizm.pythontool.grpc.petrelobjects.Properties#
Retrieve all grid properties in Petrel as GridProperty objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of GridProperty objects by their path.
- Return type
Properties
Examples
To retrieve a specific Petrel object use:
my_var=petrel.grid_properties[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property grids: cegalprizm.pythontool.grpc.petrelobjects.Grids#
Retrieve all grids in Petrel as Grid objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of Grid objects by their path.
- Return type
Grids
Examples
To retrieve a specific Petrel object use:
my_var=petrel.grids[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property horizon_interpretation_3ds: cegalprizm.pythontool.grpc.petrelobjects.HorizonInterpretation3Ds#
Retrieve all 3D horizon interpretation objects in Petrel as HorizonInterpretation3d objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of HorizonInterpretation3d objects by their path.
- Return type
HorizonInterpretation3Ds
Examples
To retrieve a specific Petrel object use:
my_var=petrel.horizon_interpretation_3ds[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property horizon_interpretations: cegalprizm.pythontool.grpc.petrelobjects.HorizonInterpretations#
Retrieve all seismic horizon in Petrel as HorizonInterpretation objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of HorizonInterpretation objects by their path.
- Return type
Examples
To retrieve a specific Petrel object use:
my_var=petrel.horizon_interpretations[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property horizon_properties: cegalprizm.pythontool.grpc.petrelobjects.HorizonProperties#
Retrieve all horizon properties in Petrel as HorizonProperty objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of HorizonProperty objects by their path.
- Return type
HorizonProperties
Examples
To retrieve a specific Petrel object use:
my_var=petrel.horizon_properties[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property markercollections: cegalprizm.pythontool.grpc.petrelobjects.MarkerCollections#
Retrieve all marker collections in Petrel as MarkerCollection objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of MarkerCollection objects by their path.
- Return type
MarkerCollections
Examples
To retrieve a specific Petrel object use:
my_var=petrel.markercollections[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property observed_data_sets: cegalprizm.pythontool.grpc.petrelobjects.ObservedDataSets#
Retrieve all observed data sets in Petrel as ObservedDataSet objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of ObservedDataSet objects by their path.
- Return type
ObservedDataSets
Examples
To retrieve a specific Petrel object use:
my_var=petrel.observed_data_sets[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property pointsets: cegalprizm.pythontool.grpc.petrelobjects.PointSets#
Retrieve all point sets in Petrel as PointSet objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of PointSet objects by their path.
- Return type
PointSets
Examples
To retrieve a specific Petrel object use:
my_var=petrel.pointsets[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property polylinesets: cegalprizm.pythontool.grpc.petrelobjects.PolylineSets#
Retrieve all polyline sets in Petrel as PolylineSet objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of PolylineSet objects by their path.
- Return type
PolylineSets
Examples
To retrieve a specific Petrel object use:
my_var=petrel.polylinesets[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property predefined_global_observed_data: Dict[str, str]#
Returns a dictionary with the predefined global observed data in the petrel project
keys: the name of the predefined global observed data values: the ID used to identify the predefined global observed data
- property properties: cegalprizm.pythontool.grpc.petrelobjects.Properties#
‘properties’ has been removed. Use ‘grid_properties’ instead
- Type
DeprecationWarning
- property property_collections: cegalprizm.pythontool.grpc.petrelobjects.PropertyCollections#
Retrieve all property collections in Petrel as PropertyCollection objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of PropertyCollection objects by their path.
- Return type
PropertyCollections
Examples
To retrieve a specific Petrel object use:
my_var=petrel.property_collections[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property seismic_2ds: cegalprizm.pythontool.grpc.petrelobjects.Seismic2Ds#
Retrieve all seismic lines in Petrel as SeismicLine objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of SeismicLine objects by their path.
- Return type
Seismic2Ds
Examples
To retrieve a specific Petrel object use:
my_var=petrel.seismic_2ds[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property seismic_cubes: cegalprizm.pythontool.grpc.petrelobjects.SeismicCubes#
Retrieve all seismic cubes in Petrel as SeismicCube objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
Seismic cubes of format SEG-Y are read-only.
- Returns
A dictionary of SeismicCubes objects by their path.
- Return type
SeismicCubes
Examples
To retrieve a specific Petrel object use:
my_var=petrel.seismic_cubes[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property seismic_lines: cegalprizm.pythontool.grpc.petrelobjects.Seismic2Ds#
Retrieve all seismic lines in Petrel as SeismicLine objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
This is an alias for the member named seismic_2ds of this class.
- Returns
A dictionary of SeismicLine objects by their path.
- Return type
Seismic2Ds
Examples
To retrieve a specific Petrel object use:
my_var=petrel.seismic_lines[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property surface_attributes: cegalprizm.pythontool.grpc.petrelobjects.SurfaceAttributes#
Retrieve all surface attributes in Petrel as SurfaceAttribute objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of SurfaceAttribute objects by their path.
- Return type
SurfacesAttributes
Examples
To retrieve a specific Petrel object use:
my_var=petrel.surface_attributes[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property surface_discrete_attributes: cegalprizm.pythontool.grpc.petrelobjects.SurfaceDiscreteAttributes#
Retrieve all discrete surface attributes in Petrel as SurfaceDiscreteAttribute objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of SurfaceDiscreteAttribute objects by their path.
- Return type
SurfaceDiscreteAttributes
Examples
To retrieve a specific Petrel object use:
my_var=petrel.surface_discrete_attributes[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property surfaces: cegalprizm.pythontool.grpc.petrelobjects.Surfaces#
Retrieve all surfaces in Petrel as Surface objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of Surface objects by their path.
- Return type
Surfaces
Examples
To retrieve a specific Petrel object use:
my_var=petrel.surfaces[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property wavelets: cegalprizm.pythontool.grpc.petrelobjects.Wavelets#
Retrieve all wavelets in Petrel as Wavelet objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of Wavelet objects by their path.
- Return type
Wavelets
Examples
To retrieve a specific Petrel object use:
my_var=petrel.wavelets[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property well_logs: cegalprizm.pythontool.grpc.petrelobjects.WellLogs#
Retrieve all well logs in Petrel as WellLog objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of WellLog objects by their path.
- Return type
WellLogs
Examples
To retrieve a specific Petrel object use:
my_var=petrel.well_logs[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property well_surveys: cegalprizm.pythontool.grpc.petrelobjects.WellSurveys#
Retrieve all well surveys in Petrel as WellSurvey objects and collect them in a dictionary with their paths as keys. All 5 types of well surveys in Petrel are treated as one object in Python Tool Pro
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of WellSurveys objects by their path.
- Return type
Properties
Examples
To retrieve a specific Petrel object use:
my_var=petrel.well_surveys[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property wells: cegalprizm.pythontool.grpc.petrelobjects.Wells#
Retrieve all wells in Petrel as Well objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of Well objects by their path.
- Return type
Wells
Examples
To retrieve a specific Petrel object use:
my_var=petrel.wells[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.
- property workflows: cegalprizm.pythontool.grpc.petrelobjects.Workflows#
Retrieve all workflows in Petrel as Workflows objects and collect them in a dictionary with their paths as keys.
When iterated over, the objects are returned, not their paths (unlike a standard Python dictionary which returns the keys).
If multiple objects have the same path, a list of them is returned.
- Returns
A dictionary of Workflow objects by their path.
- Return type
Workflows
Examples
To retrieve a specific Petrel object use:
my_var=petrel.workflows[‘Petrel path’]
With ‘petrel’ as your defined PetrelConnection.