MarkerCollection#

class cegalprizm.pythontool.MarkerCollection(petrel_object_link: MarkerCollectionGrpc)#

A class holding information about a MarkerCollection.

Functions

__init__(petrel_object_link)

add_attribute(data, name, data_type[, ...])

Add a new MarkerAttribute to a MarkerCollection by specifying the data as a numpy array and the name and data_type of the attribute as strings.

add_comment(new_comment[, overwrite])

Add a comment to the already existing comments on the PetrelObject, or overwrite the existing comments.

add_marker(well, marker_stratigraphy, ...)

Add a new Marker to the MarkerCollection.

as_dataframe([include_unconnected_markers, ...])

Gets a dataframe with information about Markers in the MarkerCollection.

clone(name_of_clone[, copy_values])

retrieve_history()

The Petrel history for the object.

retrieve_stats()

Retrieves a dictionary summarizing the statistics for the object

Properties

attributes

Get a list of MarkerCollection attributes

comments

The comments on the PetrelObject.

droid

The Petrel Droid (object id or guid) for the object

name

The name of the MarkerCollection.

path

The path of this object in Petrel.

petrel_name

Returns the name of this object in Petrel

readonly

The read-only status of this object

stratigraphies

Get a list of MarkerCollection stratigraphies

template

Returns the Petrel template for the object as a string.

add_attribute(data: numpy.array, name: <module 'string' from '/usr/lib/python3.10/string.py'>, data_type: <module 'string' from '/usr/lib/python3.10/string.py'>, include_unconnected_markers: bool = True, marker_stratigraphy: typing.Optional[cegalprizm.pythontool.markerstratigraphy.MarkerStratigraphy] = None, well: typing.Optional[cegalprizm.pythontool.borehole.Well] = None) None#
Add a new MarkerAttribute to a MarkerCollection by specifying the data as a numpy array and the name and data_type of the attribute as strings.

The include_unconnected_markers flag is used for verifying that the length of the provided array matches the expected amount of data. If set to False the attribute will still be added to all markers, but with default values for all unconnected markers. If an empty array is passed in the attribute will be added to all markers with default values. For boolean attributes the default value is False.

Example:

Add a new continuous attribute to a markercollection and set values only for the connected markers.

import numpy as np
new_attribute_values = np.array([1.1, 2.2, 3.3])
markercollection.add_attribute(new_attribute_values, 'MyNewAttribute', 'continuous', False)
Parameters
  • data – A numpy array of attributes with format as returned by MarkerAttribute.as_array()

  • name – A string specifying the name of the new attribute

  • data_type – A string specifying the data_type. Supported strings are: string | bool | continuous | discrete

  • include_unconnected_markers – A boolean flag to include markers where the borehole does not exist in the project. Defaults to True.

  • marker_stratigraphy – Limit array to include only markers for one specified MarkerStratigraphy (as returned by markercollection.stratigraphies). Defaults to None.

  • well – Limit array to include only markers for a specified Well (as returned by petrelconnection.wells). Defaults to None.

Raises
  • PythonToolException – if the MarkerCollection is read-only

  • ValueError – if the data_type is not ‘string | bool | continuous | discrete’

  • UserErrorException – if column already exist

add_comment(new_comment: str, overwrite: bool = False) None#

Add a comment to the already existing comments on the PetrelObject, or overwrite the existing comments.

Input:

new_comment: The new comment to add to the PetrelObject. overwrite: Boolean flag to overwrite all existing comments with the new comment. Default is False.

Raises

PythonToolException – if object is read-only

add_marker(well: cegalprizm.pythontool.borehole.Well, marker_stratigraphy: cegalprizm.pythontool.markerstratigraphy.MarkerStratigraphy, measured_depth: float)#

Add a new Marker to the MarkerCollection.

Input:

well: A Well object as returned from petrelconnection.wells. marker_stratigraphy: A MarkerStratigraphy object as returned by markercollection.stratigraphies. measured_depth: A float value as the measured depth of the new Marker

Raises
  • PythonToolException – if the MarkerCollection is read-only

  • TypeError – if the well parameter is not a Well object or marker_stratigraphy parameter is not a MarkerStratigraphy object

as_dataframe(include_unconnected_markers: bool = True, marker_stratigraphy: Optional[cegalprizm.pythontool.markerstratigraphy.MarkerStratigraphy] = None, well: Optional[cegalprizm.pythontool.borehole.Well] = None) pandas.core.frame.DataFrame#

Gets a dataframe with information about Markers in the MarkerCollection.

Parameters
  • include_unconnected_markers – Flag to include markers where the borehole does not exist in the project. Defaults to true.

  • marker_stratigraphy – Limit dataframe to include only markers for one specified MarkerStratigraphy (as returned by markercollection.stratigraphies). Defaults to None.

  • well – Limit dataframe to include only markers for a specified Well (as returned by petrelconnection.wells). Defaults to None.

Returns

A dataframe with Marker information, similar to the Well tops spreadsheet in Petrel.

Return type

Dataframe

retrieve_history() pandas.core.frame.DataFrame#

The Petrel history for the object.

Returns the Petrel history for the object as Pandas dataframe.

Returns

The history of the object as reported by Petrel

Return type

DataFrame

retrieve_stats() Dict[str, str]#

Retrieves a dictionary summarizing the statistics for the object

The statistics are a snapshot of the information in the Statistics page of the Settings panel of the object in the Petrel tree. Both the dict key and value are strings, and may contain punctuation, English phrases or just filler information. Any changes to the dict returned will not be saved or affect anything.

Note: this operation may be slow, since the statistics are ‘live’ - they represent the most up to date information.

Returns

The statistics of the object as reported by Petrel

Return type

dict

property attributes: dict#

Get a list of MarkerCollection attributes

property comments#

The comments on the PetrelObject.

Returns

The comments on the PetrelObject as a string.

Return type

string

property droid: str#

The Petrel Droid (object id or guid) for the object

Returns the Petrel Droid or object id or guid for the object. If not available, will throw a PythonToolException.

This property is planned to be deprecated in favour of a similar but more general id schema in future releases.

Returns

The Petrel Droid of the object

Return type

str

property name#

The name of the MarkerCollection.

Returns

Name of the MarkerCollection as a string.

Return type

string

property path: str#

The path of this object in Petrel. Neither the Petrel name nor the path is guaranteed to be unique.

Returns

The path of the Petrel object

Return type

str

property petrel_name: str#

Returns the name of this object in Petrel

property readonly: bool#

The read-only status of this object

Returns

True if the object is read-only

Return type

bool

property stratigraphies: dict#

Get a list of MarkerCollection stratigraphies

property template: str#

Returns the Petrel template for the object as a string. If no template available, will return an empty string.