GridProperty#
- class cegalprizm.pythontool.GridProperty(petrel_object_link: GridPropertyGrpc)#
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 propertychunk
(irange, jrange, krange)Creates a
cegalprizm.pythontool.Chunk
with the values for the specified rangesclone
(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 columncolumns
([irange, jrange])Returns a generator of column slices
has_same_parent
(other)Tests whether the grid property has the same parent grid
is_undef_value
(value)Whether the value is the 'undefined' value for the property
layer
(k)Creates a
cegalprizm.pythontool.Chunk
with the values for the specified layerlayers
([krange])Returns a generator of layer slices
The Petrel history for the object.
Retrieves a dictionary summarizing the statistics for the object
Properties
The comments on the PetrelObject.
The PROJCS well known text representation of the object CRS.
The date and time recorded for the property
The Petrel Droid (object id or guid) for the object
The parent grid of the property
The parent collection for the grid property
'parent_grid' has been removed.
The path of this object in Petrel.
Returns the name of this object in Petrel
The read-only status of this object
Returns the Petrel template for the object as a string.
The 'undefined value' for this property
Returns the symbol of the object unit, None if template of object is unitless.
Get/set the cell indices of values which have been upscaled
- 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 property- Returns
A Chunk containing the values for the property
- Return type
- chunk(irange: Tuple[int, int], jrange: Tuple[int, int], krange: Tuple[int, int]) cegalprizm.pythontool.chunk.Chunk #
Creates a
cegalprizm.pythontool.Chunk
with the values for the specified ranges- Parameters
i – inclusive range in the i-direction
j – inclusive range in the j-direction
k – inclusive range in the k-direction
- Returns
A Chunk containing the values for all layers
- Return type
- Raises
ValueError – if the ranges specify volumes outside the property’s extent
- clone(name_of_clone: str, copy_values: bool = False) cegalprizm.pythontool.gridproperty.GridProperty #
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
name_of_clone – Petrel name of the clone
copy_values – Set to True if values shall be copied into the clone. Defaults to False.
- Returns
the cloned GridProperty object
- 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
- column(i: int, j: int) cegalprizm.pythontool.chunk.Chunk #
Creates a
cegalprizm.pythontool.Chunk
with the values for the specified column- Parameters
i – the index in the i-direction
j – the index in the j-direction
- Returns
A Chunk containing the values for all layers
- Return type
- Raises
ValueError – if the property does not have the column specified
- columns(irange: Optional[Tuple[int, int]] = None, jrange: Optional[Tuple[int, int]] = None) Iterator[cegalprizm.pythontool.chunk.Chunk] #
Returns a generator of column slices
- 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.
- A generator of column
- 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(irange=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.gridproperty.GridProperty) bool #
Tests whether the grid property has the same parent grid
- Parameters
other – the other grid property
- Returns
True
if theother
object has the same grid- Return type
bool
- Raises
ValueError – if
other
is not a GridProperty
- is_undef_value(value: Union[float, int]) bool #
Whether the value is the ‘undefined’ value for the property
Petrel represents some undefined values by
MAX_INT
, others byNaN
. A comparison withNaN
will always returnFalse
(e.g.float.nan != float.nan
) so it is preferable to always use this method to test for undefined values.- Parameters
value – The value to test if it is ‘undefined’ in Petrel
- Returns
True if the value is ‘undefined’ for this property
- Return type
bool
- layer(k: int) cegalprizm.pythontool.chunk.Chunk #
Creates a
cegalprizm.pythontool.Chunk
with the values for the specified layer- Parameters
k – the index in the k-direction (the layer)
- Returns
A Chunk containing the values for the layer
- Return type
- Raises
ValueError – if the property does not have the layer specified
- layers(krange: Optional[Tuple[int, int]] = None) Iterator[cegalprizm.pythontool.chunk.Chunk] #
Returns a generator of layer slices
- Parameters
krange – an iterable (e.g.) of k-values to generate layers for. If None, generate for all k-values
- Yields
A generator of layer
cegalprizm.pythontool.Chunk
objects covering the krange passed
Example:
# sets to 0 all values in the k-slices k=10 through to k=19, for layer in my_prop.layers(range(10, 20)): layer.set(0) # sets to 0 all values in the property for layer in my_prop.layers(): layer.set(0)
- 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 comments#
The comments on the PetrelObject.
- Returns
The comments on the PetrelObject as a string.
- Return type
string
- 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 date: Optional[datetime.datetime]#
The date and time recorded for the property
- Returns
The datetime recorded, or None if not used
- Return type
datetime
- 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 grid: cegalprizm.pythontool.grid.Grid#
The parent grid of the property
- Returns
The parent grid of the property
- Return type
- property parent_collection: Optional[cegalprizm.pythontool.gridproperty.PropertyCollection]#
The parent collection for the grid property
- Returns
the parent collection, or None
- Return type
cegalprizm.pythontool.PropertyCollection
- property parent_grid: None#
‘parent_grid’ has been removed. Use ‘grid’ instead
- Type
DeprecationWarning
- 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 undef_value: float#
The ‘undefined value’ for this property
Use this value when setting a slice’s value to ‘undefined’. Do not attempt to test for undefined value by comparing with this value, use
is_undef_value()
instead.- Returns
The ‘undefined value’ for this property
- property unit_symbol: Optional[str]#
Returns the symbol of the object unit, None if template of object is unitless.
- property upscaled_cells: List[cegalprizm.pythontool.primitives.Indices]#
Get/set the cell indices of values which have been upscaled
Example:
myproperty.upscaled_cells = [Indices(20, 24, 5), Indices(20, 24, 6)] print(len(myproperty.upscaled_cells)) # outputs '2'
- Returns
a list of cegalprizm.pythontool.Indices of the upscaled cells
- Return type
List