Horizons#

This section offers an overview of the different methods and attributes available for the Petrel Horizon object subcategories.

Horizon interpretation#

Check out the API documentation to view a detailed description of all the functions and methods available for the Horizon objects.

To retrieve all the horizon interpretations from our Petrel project we can use the .horizonInterpretation3d property. This property returns all the horizon interpretations within the project in a dictionary where the keys represent the path of the interpretation within the Petrel input tree and the values represent the name of the interpretation:

[8]:
#Connect to a Petrel project
from cegalprizm.pythontool import PetrelConnection
petrel = PetrelConnection()

all_horizons = petrel.horizon_interpretation_3ds
print(all_horizons)
{'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive/Top Etive_Seismic Data': HorizonInterpretation3D(petrel_name="Top Etive_Seismic Data"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Base Cretaceous/Base Cretaceous_Seismic Data': HorizonInterpretation3D(petrel_name="Base Cretaceous_Seismic Data"), 'Input/3D Seismic Lines (Time)/Facies [Converted]/Facies_Seismic Data': HorizonInterpretation3D(petrel_name="Facies_Seismic Data"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Tarbert/Top Tabert_Seismic Data': HorizonInterpretation3D(petrel_name="Top Tabert_Seismic Data"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Ness/Top Ness_Seismic Data': HorizonInterpretation3D(petrel_name="Top Ness_Seismic Data")}

Using a for loop, we can iterate through the dictionary and print out all of the horizon interpretation names:

[9]:
for hor in petrel.horizon_interpretation_3ds:
    print(hor.petrel_name)
Top Etive_Seismic Data
Base Cretaceous_Seismic Data
Facies_Seismic Data
Top Tabert_Seismic Data
Top Ness_Seismic Data

Let’s select the Top Etive interpretation. First, we save all the paths of the horizons to a list, then we slice through the list and assign the selected value to the Top_Etive_Hor variable:

[10]:
hor_path = list(all_horizons.keys())
Top_Etive_Hor_path = hor_path[0]
Top_Etive_Hor=petrel.horizon_interpretation_3ds[Top_Etive_Hor_path]
print(Top_Etive_Hor.petrel_name)
Top Etive_Seismic Data

The .horizon_interpretation property returns the parent 3d horizon interpretation of the horizon property:

parent_inter.png

[15]:
Top_Etive_Hor.horizon_interpretation
[15]:
HorizonInterpretation(petrel_name="Top Etive")

Using the .horizon_property_3ds property we can return an iterable collection of the 3d horizon interpretation properties for the 3d horizon interpretation grid:

[23]:
for prop in Top_Etive_Hor.horizon_property_3ds:
    print(prop.petrel_name)
TWT
Interpretation attribute
Edge detection: pre-smooth method, combo average
Seismic signature bidirectional, sample type: constant sample window = 10
Combined confidence map
Surface stability index
RMS of seismic cube
Influential data: Clamped to P5, P95
Anomaly data

We can obtain the number of samples contained in the Horizon Interpretation 3d object using the .sample_count property:

[11]:
Top_Etive_Hor.sample_count
[11]:
23719

We can obtain the size of the grid using the .extent property which will return the number of nodes in the i and j directions:

[14]:
Top_Etive_Hor.extent
[14]:
Extent(i=375, j=301, k=1)

We can create a chunk that contains all the values in the entire horizon interpretation by using the .all() function. To learn more about chunks, please view the Working with chunks subchapter of the User Guide:

[26]:
Top_Etive_Hor.all()
[26]:
<cegalprizm.pythontool.chunk.Chunk at 0x20086c6cdf0>

Alternatively, we can create a chunk containing values in the specified ranges by using the .chunk method:

[30]:
hor_chunk = Top_Etive_Hor.chunk((0,1), (1,3))
print(hor_chunk)
Chunk(backing_object=HorizonInterpretation3D(petrel_name="Top Etive_Seismic Data"), i=(0, 1), j=(1, 3), k=None)

Using the .position() function we can retrieve the x,y,z position of the interpretation node by specifying the i and j-index of the surface node:

[32]:
Top_Etive_Hor.position(12,5)
[32]:
Point(x=451329.0330604219, y=6780660.558162178, z=-2140.7900390625)

Similarly, using the .indices() function, we can retrieve the indices of the interpretation node nearest the specified point. Note that the node indices are 0-based, but in the Petrel UI they are 1-based:

[34]:
Top_Etive_Hor.indices(451329,6780660)
[34]:
Indices(i=12, j=5, k=None)

Using the .clone() function we can create a copy of the horizon interpretation. The copy_values parameter is optional and requires a boolean value. If set to True the values of the interpretation shall be copied into the clone. It defaults to false. The cloned horizon interpretation is placed in the same collection as the source object. A clone cannot be created with the same name as an existing Petrel object in the same collection:

cloned_interp.png

[35]:
Top_Etive_Hor.clone('New_horizon', copy_values=True)
[35]:
HorizonInterpretation3D(petrel_name="New_horizon")

Horizon properties#

Check out the API documentation to view a detailed description of all the functions and methods available for the Horizon properties.

To retrieve all the horizon properties from our Petrel project we can use the .horizon_properties property. It returns all the horizon properties within the project in a dictionary where the keys represent the path of the property within the Petrel input tree and the value represents the name of the property:

[36]:
all_prop=petrel.horizon_properties
print(all_prop)
{'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive_copy/New_horizon/Influential data: Clamped to P5, P95': HorizonProperty3D(petrel_name="Influential data: Clamped to P5, P95"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive/Top Etive_Seismic Data/Anomaly data': HorizonProperty3D(petrel_name="Anomaly data"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive_copy/New_horizon/TWT': HorizonProperty3D(petrel_name="TWT"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive_copy/New_horizon/Combined confidence map': HorizonProperty3D(petrel_name="Combined confidence map"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive/Top Etive_Seismic Data/Seismic signature bidirectional, sample type: constant sample window = 10': HorizonProperty3D(petrel_name="Seismic signature bidirectional, sample type: constant sample window = 10"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive/Top Etive_Seismic Data/TWT': HorizonProperty3D(petrel_name="TWT"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive_copy/New_horizon/Surface stability index': HorizonProperty3D(petrel_name="Surface stability index"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive/Top Etive_Seismic Data/Interpretation attribute': HorizonProperty3D(petrel_name="Interpretation attribute"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive_copy/New_horizon/Edge detection: pre-smooth method, combo average': HorizonProperty3D(petrel_name="Edge detection: pre-smooth method, combo average"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive/Top Etive_Seismic Data/RMS of seismic cube': HorizonProperty3D(petrel_name="RMS of seismic cube"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive/Top Etive_Seismic Data/Influential data: Clamped to P5, P95': HorizonProperty3D(petrel_name="Influential data: Clamped to P5, P95"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive/Top Etive_Seismic Data/Surface stability index': HorizonProperty3D(petrel_name="Surface stability index"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive_copy/New_horizon/Anomaly data': HorizonProperty3D(petrel_name="Anomaly data"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive_copy/New_horizon/RMS of seismic cube': HorizonProperty3D(petrel_name="RMS of seismic cube"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive_copy/New_horizon/Seismic signature bidirectional, sample type: constant sample window = 10': HorizonProperty3D(petrel_name="Seismic signature bidirectional, sample type: constant sample window = 10"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive/Top Etive_Seismic Data/Edge detection: pre-smooth method, combo average': HorizonProperty3D(petrel_name="Edge detection: pre-smooth method, combo average"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive_copy/New_horizon/Interpretation attribute': HorizonProperty3D(petrel_name="Interpretation attribute"), 'Input/Seismic/Work shop Interpretation/Horizons for Wshop/Top Etive/Top Etive_Seismic Data/Combined confidence map': HorizonProperty3D(petrel_name="Combined confidence map")}

Using a for loop we can iterate through the dictionary and print out all the horizon properties names. The results are duplicated because we cloned a horizon interpretation together with the associated properties in a previous cell (In [35]) :

[37]:
for hor_prop in petrel.horizon_properties:
    print(hor_prop.petrel_name)
Influential data: Clamped to P5, P95
Anomaly data
TWT
Combined confidence map
Seismic signature bidirectional, sample type: constant sample window = 10
TWT
Surface stability index
Interpretation attribute
Edge detection: pre-smooth method, combo average
RMS of seismic cube
Influential data: Clamped to P5, P95
Surface stability index
Anomaly data
RMS of seismic cube
Seismic signature bidirectional, sample type: constant sample window = 10
Edge detection: pre-smooth method, combo average
Interpretation attribute
Combined confidence map

Let’s select the first Edge detection property. First, we save all the paths of the properties to a list, then we slice through the list and assign the selected value to the Top_Etive_Edge_Det variable:

[39]:
hor_prop_path = list(all_prop.keys())
Top_Etive_Edge_Det_path = hor_prop_path[8]
Top_Etive_Edge_Det=petrel.horizon_properties[Top_Etive_Edge_Det_path]
print(Top_Etive_Edge_Det.petrel_name)
Edge detection: pre-smooth method, combo average

The .template property returns the Petrel template for the object as a string. If no template is available, it will return an empty string. In Petrel, for the horizon property example the template can be found by accessing the setting of a property. Similarly, using the .unit_symbol attribute we can access the unit for any object associated with a certain template. In Petrel you can access this data by propping up the global settings for the selected property template:

templateHorprop.png

[40]:
Top_Etive_Edge_Det.template
[40]:
'Edge surface'
[41]:
Top_Etive_Edge_Det.unit_symbol
[41]:
'%'

The .is_undef_value() function checks whether the provided value is the ‘undefined value’ for the attribute. Petrel represents some undefined values by MAX_INT, others by NaN. A comparison with NaN will always return False (e.g. float.nan != float.nan) so it is preferable to always use this method to test for undefined values:

[47]:
Top_Etive_Edge_Det.is_undef_value(0)
[47]:
False