SeismicCube#

class cegalprizm.pythontool.SeismicCube(petrel_object_link: SeismicCubeGrpc)#

A class holding information about a seismic cube

Seismic files of format SEG-Y are always read-only.

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.

all()

Creates a cegalprizm.pythontool.Chunk with the values for the entire cube

annotation(i, j[, k])

The annotations for seismic indices

annotation_indices(inline, crossline[, ...])

The i,j and k index of a particular inline/crossline/samplenumber

chunk(irange, jrange, krange)

Creates a cegalprizm.pythontool.Chunk with the values for the specified index ranges

clone(name_of_clone[, copy_values])

Creates a clone of the Petrel object.

column(i, j)

Creates a cegalprizm.pythontool.Chunk with the values for the specified traces

columns([irange, jrange])

The columns in given i- and j-range

has_same_parent(other)

Tests whether the seismic cube has the same parent collection

ijks_to_positions(indices)

Converts a tuple with ijk indices to xyz.

indices(x, y, z)

The indices of a node nearest the specified point

layer(k)

Creates a cegalprizm.pythontool.Chunk with the values for the specified sample index

position(i, j, k)

The position of the seismic node/sample index

positions_to_ijks(positions)

Converts a tuple with xyzs to ijk.

reconnect(path)

Reconnects the 3D seismic object to the given file path.

retrieve_history()

The Petrel history for the object.

retrieve_stats()

Retrieves a dictionary summarizing the statistics for the object

seismic_file_path()

Returns the seismic file path of the seismic object.

set_value(value)

Sets the values of the entire seismic cube to the value provided.

Properties

affine_transform

The affine transform of the object.

comments

The comments on the PetrelObject.

coords_extent

The extent of the object in world-coordinates

crs_wkt

droid

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

extent

The extent of the cube in the i, j and k directions

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

template

Returns the Petrel template for the object as a string.

unit_symbol

Returns the symbol of the object unit, None if template of object is unitless.

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

all() cegalprizm.pythontool.chunk.Chunk#

Creates a cegalprizm.pythontool.Chunk with the values for the entire cube

Note: This can be an expensive operation in time and memory depending on the size of cube.

Returns

A Chunk containing the values contained in the entire cube

annotation(i: int, j: int, k: int = 0) cegalprizm.pythontool.primitives.Annotation#

The annotations for seismic indices

Args:

i: the i-index j: the j-index k: the k-index (defaults to 0)

Returns: cegalprizm.pythontool.Annotation: an Annotation object

with the inline, xline and sample of the given index

Raises

ValueError – if the i, j or k index are beyond the valid range

annotation_indices(inline: int, crossline: int, samplenumber: int = 1) cegalprizm.pythontool.primitives.Indices#

The i,j and k index of a particular inline/crossline/samplenumber

Parameters
  • inline – the inline annotation

  • crossline – the crossline annotation

  • samplenumber – the sample number (defaults to 1)

Returns: an ‘Indices’ object with the i, j and k index of the given inline, crossline and samplenumber

chunk(irange: Optional[Tuple[int, int]], jrange: Optional[Tuple[int, int]], krange: Optional[Tuple[int, int]]) cegalprizm.pythontool.chunk.Chunk#

Creates a cegalprizm.pythontool.Chunk with the values for the specified index ranges

Parameters
  • irange – Inclusive range of i-values, or () or None for all

  • jrange – Inclusive range of j-values, or () or None for all

  • krange – Inclusive range of k-values, or () or None for all

Returns

A Chunk containing the values contained in the ranges specified

clone(name_of_clone: str, copy_values: bool = False) cegalprizm.pythontool.seismic.SeismicCube#

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.

Parameters
  • name_of_clone (str) – New Petrel name of the clone

  • copy_values (bool, optional) – Set to True if values shall be copied into the clone. Defaults to False.

Returns

the clone

Return type

SeismicCube

Raises
  • Exception – If there already exists a Petrel object with the same name

  • ValueError – If name_of_clone is empty or contains slashes

column(i: int, j: int) cegalprizm.pythontool.chunk.Chunk#

Creates a cegalprizm.pythontool.Chunk with the values for the specified traces

Parameters
  • i – the index in the i-direction

  • j – the index in the j-direction

Returns

A Slice containing the values for all specified traces

Raises

ValueError – if the cube does not have the traces specified

columns(irange: Optional[Tuple[int, int]] = None, jrange: Optional[Tuple[int, int]] = None) Iterator[cegalprizm.pythontool.chunk.Chunk]#

The columns in given i- and j-range

Parameters
  • irange – an iterable (e.g list) of i-values to generate columns for. If None, generate for all i-values

  • jrange – an iterable (e.g. list) of j-values to generate columns for. If None, generate for all j-values.

Yields
A generator of column cegalprizm.pythontool.Chunk objects covering the

irange and jrange passed.

Raises

ValueError – if the indices are invalid.

Example:

# sets to 0 all values in the i-slices i=10 through to i=19,
for col in my_prop.columns(range(10, 20), jrange=None):
    col.set(0)

# sets to 0 all values in the property
for col in my_prop.columns():
    col.set(0)
has_same_parent(other: cegalprizm.pythontool.seismic.SeismicCube) bool#

Tests whether the seismic cube has the same parent collection

Parameters

other – the other seismic cube

Returns

True if the other object has the same parent collection

Return type

bool

Raises

ValueError – if other is not a SeismicCube

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 node nearest the specified point

If you are working primarily with annotations (crossline/inline), use the annotation_indices() and annotation() methods to convert annotations to and from Indices.

Parameters
  • x – the x-coordinate

  • y – the y-coordinate

  • z – the z-coordinate

Raises

ValueError – if the position is outside the seismic object

Returns

An object representing the indices of the node nearest the specified point

Return type

cegalprizm.pythontool.Indices

layer(k: int) cegalprizm.pythontool.chunk.Chunk#

Creates a cegalprizm.pythontool.Chunk with the values for the specified sample index

Parameters

k – the sample index

Returns

A Slice containing the values for all the traces for a particular sample index

Raises

ValueError – if the cube does not have the seismic sample specified

position(i: float, j: float, k: float) cegalprizm.pythontool.primitives.Point#

The position of the seismic node/sample index

Parameters
  • i – the i-index

  • j – the j-index

  • k – the k-index

Raises

ValueError – if the indices are outside the seismic object

Returns

A cegalprizm.pythontool.Point object representing the position of the node.

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.

reconnect(path: str) None#

Reconnects the 3D seismic object to the given file path.

Note

The file path has to be written with 2 backslashes. This method only works on external seismic objects with broken links.

Parameters

path (str) – The seismic file path to reconnect the seismic object.

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

seismic_file_path() str#

Returns the seismic file path of the seismic object. Returns ‘Not available’ for Petrel internal seismic.

set_value(value: float)#

Sets the values of the entire seismic cube to the value provided. This is useful to set all values to zero. But any value can be provided.

Parameters

value – The value to set the seismic cube.

Raises
  • exceptions.PythonToolException – If seismic cube is readonly.

  • exceptions.PythonToolException – If set_value fails

property affine_transform#

The affine transform of the object.

Returns

An array with 6 coefficients of the affine transformation matrix. If array is represented as [a, b, c, d, e, f] then this corresponds to a affine transformation matrix of form: | a b e | | c d f | | 0 0 1 |

Return type

1d array

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

cegalprizm.pythontool.CoordinatesExtent

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 extent of the cube in the i, j and k directions

Seismic traces are indexed by i and j, with k specifying the sample number in a trace.

Returns

The number of traces in each direction and number of samples per trace

Return type

cegalprizm.pythontool.Extent

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 template: str#

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

property unit_symbol: Optional[str]#

Returns the symbol of the object unit, None if template of object is unitless.