Grid#
- class cegalprizm.pythontool.Grid(petrel_object_link: GridGrpc)#
Functions
__init__
(petrel_object_link)add_comment
(new_comment[, overwrite])Add a comment to the already existing comments on the PetrelObject, or overwrite the existing comments.
clone
(name_of_clone[, copy_values])ijks_to_positions
(indices)Converts a tuple with ijk indices to xyz.
indices
(x, y, z)The indices of a cell containing the specified point
is_undef_cell
(i, j, k)Checks if the cell with given i,j and k index is undefined
position
(i, j, k)The XYZ position of the cell center in the Petrel coordinate system
positions_to_ijks
(positions)Converts a tuple with xyzs to ijk
The Petrel history for the object.
Retrieves a dictionary summarizing the statistics for the object
vertices
(i, j, k)The positions of the vertices of the cell.
vertices_unchecked
(i, j, k)The positions of the vertices of the cell
Properties
The comments on the PetrelObject.
The extent of the object in world-coordinates
The PROJCS well known text representation of the object CRS.
The Petrel Droid (object id or guid) for the object
The number of cells in the i, j and k directions
The path of this object in Petrel.
Returns the name of this object in Petrel
A readonly iterable collection of the grid properties for the grid
The read-only status of this object
A readonly iterable collection of the segments for the grid
Returns the Petrel template for the object as a string.
A readonly iterable collection of the zones for the grid
- 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
- ijks_to_positions(indices: Tuple[List[float], List[float], List[float]]) Tuple[List[float], List[float], List[float]] #
Converts a tuple with ijk indices to xyz.
- Parameters
indices – A tuple([i],[j],[k]) where [i] is a list of i indices, [j] is a list of j indices and [k] is a list of k indices.
- Returns
- A tuple([x], [y], [z]), where [x] is a list of x coordinates,
[y] is a list of y positions and [z] is a list of z (time/depth) coordinates.
- indices(x: float, y: float, z: float) cegalprizm.pythontool.primitives.Indices #
The indices of a cell containing the specified point
Note that due to rounding errors and the way a pillar grid is defined, more than one cell might contain a given point; only one set of indices is ever returned.
- Parameters
x – the x-coordinate
y – the y-coordinate
z – the z-coordinate
- Returns
- object representing the indices of the cell
containing the xyz coordinates
- Return type
- Raises
ValueError – if no cell contains the specified point
- is_undef_cell(i: int, j: int, k: int) bool #
Checks if the cell with given i,j and k index is undefined
- Parameters
i – the i-index
j – the j-index
k – the k-index
- Returns
True
if the cell is undefined at the indices specified- Return type
bool
- position(i: int, j: int, k: int) cegalprizm.pythontool.primitives.Point #
The XYZ position of the cell center in the Petrel coordinate system
- Parameters
i – the i-index
j – the j-index
k – the k-index
- Returns
- The XYZ position of the cell center
in the Petrel coordinate system
- Return type
cegalprizm.pythontool.Point
- Raises
ValueError – if the indices are invalid for the grid
- positions_to_ijks(positions: Tuple[List[float], List[float], List[float]]) Tuple[List[float], List[float], List[float]] #
Converts a tuple with xyzs to ijk
- Parameters
positions – A tuple([x], [y], [z]), where [x] is a list of x coordinates, [y] is a list of y positions and [z] is a list of z (time/depth) coordinates.
- Returns
- A tuple([i],[j],[k]) where [i] is a list of i indices, [j] is a list of j indices
and [k] is a list of k indices.
- 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
- vertices(i: int, j: int, k: int) List[cegalprizm.pythontool.primitives.Point] #
The positions of the vertices of the cell.
Use
vertices_unchecked()
if you do not wish to spend time checking if the cell is defined. In that case, the method will return an list of undefined points.See
cegalprizm.pythontool.vertices
for how to query the returned list for specific vertices.- Parameters
i – the i-index
j – the j-index
k – the k-index
- Returns
A list of
cegalprizm.pythontool.Point
objects.- Raises
ValueError – if the cell is undefined or outside of the grid
- vertices_unchecked(i: int, j: int, k: int) List[cegalprizm.pythontool.primitives.Point] #
The positions of the vertices of the cell
See
cegalprizm.pythontool.vertices
for how to query the returned list for specific vertices.If the cell is not defined, a list of undefined points (where x, y and z are equal to NaN) will be returned. (Use
vertices()
to check for undefined cells).- Parameters
i – the i-index
j – the j-index
k – the k-index
- Returns
A list of
cegalprizm.pythontool.Point
objects.- Raises
ValueError – if the cell outside of the grid
- property comments#
The comments on the PetrelObject.
- Returns
The comments on the PetrelObject as a string.
- Return type
string
- property coords_extent: cegalprizm.pythontool.primitives.CoordinatesExtent#
The extent of the object in world-coordinates
- Returns
the extent of the object in world-coordinate
- Return type
- property crs_wkt#
The PROJCS well known text representation of the object CRS.
- Returns
PROJCS well known text representation of the CRS.
- 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 extent: cegalprizm.pythontool.primitives.Extent#
The number of cells in the i, j and k directions
- Returns
The number of cells in each direction
- Return type
- 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 properties: cegalprizm.pythontool.gridproperty.GridProperties#
A readonly iterable collection of the grid properties for the grid
- Returns
a list of the grid properties (continuous and discrete)
- property readonly: bool#
The read-only status of this object
- Returns
True if the object is read-only
- Return type
bool
- property segments: cegalprizm.pythontool.segment.Segments#
A readonly iterable collection of the segments for the grid
- Returns
the segments for the grid
- Return type
- property template: str#
Returns the Petrel template for the object as a string. If no template available, will return an empty string.
- property zones: cegalprizm.pythontool.zone.Zones#
A readonly iterable collection of the zones for the grid
- Returns
the zones for the grid
- Return type