PolylineSet#
- class cegalprizm.pythontool.PolylineSet(python_petrel_polylineset: PolylineSetGrpc)#
A class holding many
cegalprizm.pythontool.Polyline
objects.- ** The implementation of polyline sets is in a preliminary state. Handling large sets may
fail or be slow. We are working on improving this.
This is an iterable, returning
cegalprizm.pythontool.Polyline
objects. When iterating over this, do not modify the collection by adding or deleting lines - like many other Python iterators, undefined behaviour may result.Functions
__init__
(python_petrel_polylineset)add_comment
(new_comment[, overwrite])Add a comment to the already existing comments on the PetrelObject, or overwrite the existing comments.
add_line
(points[, closed])Adds a line to the set
clear
()Deletes all the lines from the polyline set
clone
(name_of_clone[, copy_values])Creates a clone of the Petrel object.
delete_line
(line)Deletes a polyline from the polyline set
get_positions
(idx)Gets the xyz positions of the polygons in a PolylineSet.
is_closed
(idx)Information if polygon is closed or open.
The Petrel history for the object.
Retrieves a dictionary summarizing the statistics for the object
set_positions
(idx, xs, ys, zs)Replaces all xyz positions of the polygons in a PolylineSet.
Properties
The comments on the PetrelObject.
crs_wkt
The Petrel Droid (object id or guid) for the object
The path of this object in Petrel.
Returns the name of this object in Petrel
Python iterator returning the polylines in a polyline set
The read-only status of this object
Returns the Petrel template for the object as a string.
- 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_line(points: List[cegalprizm.pythontool.primitives.Point], closed: bool = True) None #
Adds a line to the set
You must supply at least two points, or three if the polyline is closed.
- Parameters
points – a list of
cegalprizm.pythontool.PolylinePoint
objects.closed – True if the polyline is closed, False if open. Defaults to True.
- Raises
exceptions.PythonToolException – If PolylineSet is readonly
ValueError – if fewer than 2 points are given, or fewer than 3 if closed=True
- clear() None #
Deletes all the lines from the polyline set
- clone(name_of_clone: str, copy_values: bool = False) cegalprizm.pythontool.polylines.PolylineSet #
Creates a clone of the Petrel object.
The clone 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.
This is a Python Tool Pro function and is not available when running scripts in the editor integrated in Python Tool or in a workflow.
- Parameters
path_of_clone (str) – Petrel name of the clone
copy_values (bool) – Set to True if values shall be copied into the clone. Defaults to False.
- Returns
The clone
- Return type
- Raises
Exception – If there already exists a Petrel object with the same name
ValueError – If name_of_clone is empty or contains slashes
- delete_line(line: cegalprizm.pythontool.polylines.Polyline) None #
Deletes a polyline from the polyline set
- Parameters
line – the line to delete
- get_positions(idx: int) Tuple[List[float], List[float], List[float]] #
Gets the xyz positions of the polygons in a PolylineSet.
- Parameters
idx – Index of the polygon in the PolylineSet
Note: Index in Python starts at 0. Index in Petrel starts at 1.
- Raises
ValueError – If provided index is outside the range of indexes
- Returns
- A tuple([x], [y], [z]), where [x] is a list of x positions,
[y] is a list of y positions and [z] is a list of z positions
- is_closed(idx: int) bool #
Information if polygon is closed or open.
- Parameters
idx (int) – Index of the polygon in the PolylineSet
Note: Index in Python starts at 0. Index in Petrel starts at 1.
- Returns
True if closed, False otherwise.
- Return type
bool
- 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
- set_positions(idx: int, xs: List[float], ys: List[float], zs: List[float]) None #
Replaces all xyz positions of the polygons in a PolylineSet.
Note: Index in Python starts at 0. Index in Petrel starts at 1.
- Parameters
idx – Index of the polygon in the PolylineSet
xs – A list with x-coordinates
ys – A list with y-coordinates
zs – A list with z-coordinates
- Raises
PythonToolException – if the polylineset is readonly
ValueError – if the number of x-coordinates is lower than 1
- 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 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 polylines: Iterable[cegalprizm.pythontool.polylines.Polyline]#
Python iterator returning the polylines in a polyline set
Use to retrieve the polylines
cegalprizm.pythontool.Polyline
from the polyline set
- property readonly: bool#
The read-only status of this object
- Returns
True if the object is read-only
- Return type
bool
- property template: str#
Returns the Petrel template for the object as a string. If no template available, will return an empty string.