petrelpy.wellconnection

Work with Eclipse well connection files.

These are a handy export from Petrel that can get you well-specific properties.

Functions

process_well_connection_file(→ pandas.DataFrame)

Get average properties along the laterals for a well connection file.

get_wellnames(→ list[str])

Get all the well names from a well connection file.

get_trajectory_geomodel_columns(→ list[str])

Get columns used for well trajectory.

process_well_lateral(→ pandas.Series)

Get average properties along the well lateral from the geomodel.

get_trajectory(→ pandas.DataFrame)

Get trajectory for a well from the well connection file.

get_well(file_obj)

Get section of well connection file for well.

get_wellname(→ str)

Get well's name from string.

Module Contents

petrelpy.wellconnection.process_well_connection_file(well_connection_file: str, wellname_to_heel: pandas.DataFrame, property_aggregates: dict[str, Any] | None = None, col_names: list[str] | None = None) pandas.DataFrame

Get average properties along the laterals for a well connection file.

Parameters:
  • well_connection_file (str) – Eclipse well connection file exported from Petrel

  • wellname_to_heel (pd.DataFrame) – DataFrame containing UWI,Name,Depth_Heel for each well in the connection file

  • property_aggregates (dict[str,Any]) – properties from the well connection file to extract and how to aggregate them

  • col_names (list) – dictionary of column names in the well connection file you can check this with get_trajectory_geomodel_columns(well_connection_file) the first few are usually [‘MD_ENTRY’, ‘GRID_I’, ‘GRID_J’, ‘GRID_K’,’WELL_ENTRY_X’, ‘WELL_ENTRY_Y’,’WELL_ENTRY_Z’,’ENTRY_FACE’,’MD_EXIT’,’WELL_EXIT_X’,’WELL_EXIT_Y’, ‘WELL_EXIT_Z’,’EXIT_FACE’,]

Output: pd.DataFrame

DataFrame indexed by UWI, with columns that are the keys of property_aggregates

Note: vertical wells get everything included, wells not in wellname_to_heel are treated

as vertical and have their wellname as their index

petrelpy.wellconnection.get_wellnames(wc_file: str | pathlib.Path) list[str]

Get all the well names from a well connection file.

petrelpy.wellconnection.get_trajectory_geomodel_columns(fname: str | pathlib.Path) list[str]

Get columns used for well trajectory.

petrelpy.wellconnection.process_well_lateral(well_string: str, wellname_to_heel: pandas.DataFrame, property_aggregates: dict[str, Any] | None = None, col_names: list[str] | None = None) pandas.Series

Get average properties along the well lateral from the geomodel.

Parameters:
  • well_string (str) – portion of well connection file containing one well

  • wellname_to_heel (pd.DataFrame) – DataFrame containing UWI,Name,Depth_heel for each well in the connection file

  • property_aggregates (dict) – mapping from properties to aggregation methods

  • col_names (list[str]) – columns for the well trajectory

Returns:

average properties along the well’s lateral

Return type:

pd.Series

petrelpy.wellconnection.get_trajectory(well_string: str, col_names: list[str] | None = None) pandas.DataFrame

Get trajectory for a well from the well connection file.

Parameters:
  • well_string (str) – well connection file portion

  • col_names (list[str]) – columns for the trajectory

Returns:

properties along the trajectory

Return type:

pd.DataFrame

petrelpy.wellconnection.get_well(file_obj: collections.abc.Iterator[str])

Get section of well connection file for well.

Parameters:

file_obj (Iterator[str]) – loaded well connection file, iterated over row-by-row

Yields:

Iterator[str] – string containing well properties

petrelpy.wellconnection.get_wellname(well_string: str) str

Get well’s name from string.

Parameters:

well_string (str) – portion of well connection file with the well

Returns:

well’s name

Return type:

str