Release Notes Version 2#

What’s new in 2.2#

Python Tool Pro 2.2 (December 2022)#

Python Tool Pro 2.2 is minor version change with added functionalities and backward compatible API changes.

New functionality#

Support for well marker collections#

You can retrieve well tops from Petrel in form of well marker collections. Marker collections can be loaded into a Pandas dataframe in Python. Well top attributes can be updated by retrieving the marker attribute object. A well marker point can be added.

Retrieve zone and segment information from 3D grid models#

It is now possible to retrieve zone and segment information of a 3D grid model. The IJ pairs of segments and the top and base k of zones are returned and can be matched to the IJK values of a (grid property) chunk dataframe to retrieve, update or create new values for specific zones and/or segments.

from cegalprizm.pythontool import PetrelConnection
ptp=PetrelConnection()

my_grid=[i for i in ptp.grids][0]
seg_ls=[i for i in my_grid.segments]
print(seg_ls)

my_segment=seg_ls[0]
print(my_segment.petrel_name)
print(my_segment.cells)

zone_ls=[i for i in my_grid.zones]
print(zone_ls)

my_zone=zone_ls[0]
print(my_zone.petrel_name)
print(my_zone.top_k)
print(my_zone.base_k)

Information about coordinate system#

The PetrelConnection has a new property ‘crs_wkt’ that returns the well-known-text of the project coordinate system.

from cegalprizm.pythontool import PetrelConnection
ptp=PetrelConnection()
ptp.crs_wkt

The same property is available for many of the supported Petrel objects.

Retrieve the affine transform of gridded objects#

It is now possible to retrieve the affine transform of gridded Petrel objects. Together with the well-know-text of the coordinate system (using the property crs_wkt) it is possible to create georeferenced output.

var.crs_wkt
var.affine_transform

Support for completions#

Completions are supported in Python Tool Pro 2.2 as experimental method. Users have to explicitly enable these methods when establishing the connection to Petrel.

import blueback
from blueback.pythontool.grpc.petrelconnection import PetrelConnection
ptp = PetrelConnection(allow_experimental=True)

It is then possible to retrieve a completion set from a well object. Python Tool Pro will always retunr the active completion set of the well object. Currently only casings and perforations are supported.

completions = well.completions_set
completions.as_dataframe()

Completions set can be loaded into a Pandas DataFrame for QC. Casing and casing parts can be updated by changing the bottom MD value. Perforations can be updated by changing the top and bottom MD, the start date and the skin factor. New perforation objects can be added to the completion set.

Changed functionality#

Add unit symbol to PointSet dataframe#

When using the method .as_dataframe() on a PointSet object it is now possible to include the unit symbol of the attributes. The unit symbol is added in square brackets to the DataFrame column name. When writing values back to Petrel a flag indicating that the dataframe contains units can be set to strip the unit symbol from the DataFrame coloum name.

Retrieve history returns string for objects without a Petrel history#

Petrel objects without a history table now return a string stating the fact that no history table is available. This applies to: * Global well logs * Discrete global well logs * Grid segments * Grid zones * Petrel workflows

Bug fixes#

Unit conversion symbol#

The values of Petrel objects with customized Petrel templates having unit symbols different to the default Petrel unit symbol where converted to the default Petrel unit for the that template. This lead to the values in Python beiing different than the values shown in Petrel. In Python Tool Pro 2.2 all values retrieved on the Python side are now the same as seen in Petrel.

Null values for discrete integers#

Null values of discrete integers were returned as np.maxint. This is fixed in Python Tool Pro 2.2 and pd.NA is returned. pd.NA needs to be used when setting values back in Petrel.

Known issues#

It is not possible to retrieve the statistics of a well marker attribute or of casings and perforation objects. The method .retrieve_stats() returns an empty dictionary.

What’s new in 2.1#

Python Tool Pro 2.1.3 (Ocotober 2022)#

Python Tool Pro 2.1.3 is a patch release. It includes a new version of the Cegal Hub plug-in avoiding a dll conflict with Petrel 2022. Further it inludes a bug fix on the as_dataframe() method unit conversion. Python Tool Pro converts units of customized templates to Petrel default template units. Values stored as type ‘double’ in Petrel with a template unit different to the Petrel project default template unit were not converted correctly. Values in a template unit the same as the Petrel project default template unit were not affected. The conversion to the Petrel project default template unit is corrected.

Python Tool Pro 2.1.2 (September 2022)#

Python Tool Pro 2.1.2 is a patch release introducing support for Petrel 2022.

Python Tool Pro 2.1.1 (June 2022)#

Python Tool Pro 2.1.1 is a patch release with performance improvements for reading and writing values from and to well logs.

Python Tool Pro 2.1.0 (May 2022)#

Python Tool Pro 2.1.0 is minor version change with added functionalities and backward compatible API changes. Moving to Python Tool Pro 2.1.0 from Python Tool Pro 1.x includes a major version change where Python Tool Pro is now placed within Prizm. Prizm is a modular data science solution for the entire energy sector. Python Tool Pro is now enabled to run in a remote (to Petrel) Python environment and, together with Hub, allows for programmatic access to Petrel. Version 2 of Python Tool Pro also includes changes to the namespace and the API. Some of these changes are not backward compatible with existing Python Tool Pro code.

Change of namespace#

To be consistent across the various Prizm modules and ensure a good user experience the Python namespace of Python Tool Pro has been changed from ‘blueback’ to ‘cegalprizm’. Python code written for Python Tool Pro v1.x will have to be adapted from

import blueback
from blueback.pythontool.grpc.petrelconnection import PetrelConnection
ptp = PetrelConnection()

to import from cegalprizm

import cegalprizm
from cegalprizm.pythontool import PetrelConnection
ptp = PetrelConnection()

Once the PetrelConnection is established, all other methods can be used from ‘ptp’ in the same way as the previous version. For any existing code using Python Tool Pro V1.x, which imports other classes than PetrelConnection, will also have to be adapted from the old ‘blueback’ namespace to cegalprizm. E.g.

from blueback.pythontool.welllog import WellLog

must be changed to

from cegalprizm.pythontool.welllog import WellLog

Hub implementation#

Python Tool Pro uses Hub to enable a connection between a Petrel project on a user’s workstation and any Python environment locally next to Petrel or remotely on a separate machine. In most scenarios, the user will establish a connection from the Hub Petrel plug-in to a Hub server. For more details, please check the Python Tool Pro ‘Getting Started’ section or the Hub documentation.

Backward incompatible API changes#

PetrelConnection moved to top-level#

The class PetrelConnection has been moved to the top-level of the Python API. Instead of using

import blueback
from blueback.pythontool.grpc.petrelconnection import PetrelConnection

users need to import the class from the top-level

import cegalprizm
from cegalprizm.pythontool import PetrelConnection

Removed borehole from API#

In previous versions the Python property ‘borehole’ was used as an alias for ‘well’. In Python Tool Pro only the property ‘well’ is available.

Removed get_rawvalues() from API#

In Python Tool Pro v1.x the method as_array() was introduced as an replacement for get_rawvalues(). In Python Tool Pro v2, get_rawvalues() has been removed, meaning that all Python scripts using the method get_rawvalues() need to be changed to as_array() to work with Python Tool Pro v2.

Removed discrete_properties and properties from API#

The properties ‘discrete_properties’ and ‘properties’ were removed from the PetrelConnection class in Python Tool Pro v2. Users should use ‘discrete_grid_properties’ and ‘grid_properties’ respectively, instead.

Changed .parent_surface to .surface#

To be consistent with other supported domain objects, the property parent_surface was renamed to surface. To get the surface object from a surface attribute object, users now need to use

surface_attribute.surface

Changed .parent_grid to .grid#

To be consistent with other supported domain objects, the property parent_grid was renamed to grid. To get the grid object from a continuous or discrete grid property object, users now need to use

grid_property.grid
discrete_grid_property.grid

Changed .parent_polylineset to .polylineset#

To be consistent with other supported domain objects, the property parent_polylineset was renamed to polylineset. To get the polylineset object from a polyline object, users now need to use

polyline.polylineset

Removed perforations from API#

The perforations() method has been removed from the well objects.

New functionality#

Create well logs from global well logs#

It is now possible to create a well log for a well from a global well log. This ensures that the new well log has an already existing template assigned to it.

Reconnect seismic cubes#

Seismic cubes with a broken link can be now reconnected. A seismic file path of the bulk file has to be passed as a string. This functionality only works for external seismic files and not for Petrel internal seismic.

Import workflows#

It is now possible to import Petrel workflows from a different Petrel project. The path of the Petrel project and the names of the Petrel workflow(s) are required.

Retrieve objects by GUID#

It is now possible to retrieve objects by passing a list of GUID (same as the .droid property). The method get_petrel_project_units() returns a dictionary with the Petrel project units.

Example:

{‘Seismic time’: ‘ms’, ‘Z unit’: ‘m’, ‘Volume unit’: ‘m3’, ‘Area unit’: ‘m2’, ‘Seismic velocity’: ‘m/s’, ‘XY unit’: ‘m’}

Retrieve template information#

For all the domain objects with a template, it is now possible to retrieve the Petrel template of the object by using the Python property .template. Objects without a template will return an empty string.

Example:

welllog.template

Retrieve grid properties from grid#

It is now possible to retrieve the grid properties of a grid from the grid object. Use the grid.properties to get a readonly iterable collection of the grid properties for the grid. This will return the continuous and discrete grid properties together.

Changed functionality#

Updated method .retrieve_stats()#

In Python Too Pro v2, retrieve_stats() returns more information and now includes the min, max and delta for geographic extend and the values of the object.