resqpy.well.BlockedWell

class resqpy.well.BlockedWell(parent_model, uuid=None, grid=None, trajectory=None, wellspec_file=None, cellio_file=None, column_ji0=None, well_name=None, check_grid_name=False, use_face_centres=False, represented_interp=None, originator=None, extra_metadata=None, add_wellspec_properties=False, usa_date_format=False, lazy=False)

Bases: BaseResqpy

Class for RESQML Blocked Wellbore Representation (Wells), ie cells visited by wellbore.

Notes

RESQML documentation: The information that allows you to locate, on one or several grids (existing or planned), the intersection of volume (cells) and surface (faces) elements with a wellbore trajectory (existing or planned)

Public Data Attributes:

resqml_type

well_name

Alias for title

Inherited from BaseResqpy

resqml_type

part

Standard part name corresponding to self.uuid.

root

XML node corresponding to self.uuid.

citation_title

Citation block title equivalent to self.title.

Commonly Used Methods:

__init__(parent_model[, uuid, grid, ...])

Creates a new blocked well object and optionally loads it from xml, or trajectory, or Nexus wellspec file.

grid_uuid_list()

Returns a list of the uuids of the grids referenced by the blocked well object.

cell_indices_kji0()

Returns a numpy int array of shape (N, 3) of cells visited by well, for a single grid situation.

cell_indices_and_grid_list()

Returns a numpy int array of shape (N, 3) of cells visited by well, and a list of grid objects of length N.

cell_indices_for_grid_uuid(grid_uuid)

Returns a numpy int array of shape (N, 3) of cells visited by well in specified grid.

dataframe([i_col, j_col, k_col, one_based, ...])

Returns a pandas data frame containing Nexus WELLSPEC style data.

create_xml([ext_uuid, ...])

Create a blocked wellbore representation node from this BlockedWell object, optionally add as part.

write_hdf5([file_name, mode, ...])

Create or append to an hdf5 file, writing datasets for the measured depths, grid, cell & face indices.

Methods:

extract_property_collection([refresh])

Returns a property collection for the blocked well.

map_cell_and_grid_indices()

Returns a list of index values linking the grid_indices to cell_indices.

compressed_grid_indices()

Returns a list of grid indices excluding the -1 elements (unblocked intervals).

number_of_grids()

Returns the number of grids referenced by the blocked well object.

single_grid()

Asserts that exactly one grid is being referenced and returns a grid object for that grid.

interval_for_cell(cell_index)

Returns the interval index for a given cell index (identical if there are no unblocked intervals).

entry_and_exit_mds(cell_index)

Returns entry and exit measured depths for a blocked cell.

box([grid_uuid])

Returns the KJI box containing the cells visited by the well, for single grid if grid_uuid is None.

face_pair_array()

Returns numpy int array of shape (N, 2, 2) being pairs of face (axis, polarity) pairs, to go with cell_kji0_array().

compute_from_trajectory(trajectory, grid[, ...])

Populate this blocked wellbore object based on intersection of trajectory with cells of grid.

set_for_column(well_name, grid, col_ji0[, ...])

Populates empty blocked well for a 'vertical' well in given column; creates simulation trajectory and md datum.

derive_from_wellspec(wellspec_file, ...[, ...])

Populates empty blocked well from Nexus WELLSPEC data; creates simulation trajectory and md datum.

derive_from_cell_list(cell_kji0_list, ...[, ...])

Populate empty blocked well from numpy int array of shape (N, 3) being list of cells.

derive_from_dataframe(df, well_name, grid[, ...])

Populate empty blocked well from WELLSPEC-like dataframe; first columns must be IW, JW, L (i, j, k).

import_from_rms_cellio(cellio_file, ...[, ...])

Populates empty blocked well from RMS cell I/O data; creates simulation trajectory and md datum.

wb_cell_for_md(md)

Return blocked well cell index and fractional distance into cell md interval, for given md.

frame_contributions_list(wbf)

Returns wellbore frame contributions to each cell in this blocked well.

add_properties_from_wellbore_frame([...])

Add properties to this blocked well by derivation from wellbore frame intervals properties.

add_df_properties(df, columns[, length_uom, ...])

Creates a property part for each column in the dataframe, based on the dataframe values.

static_kh([ntg_uuid, perm_i_uuid, ...])

Returns the total static K.H (permeability x height).

write_wellspec(wellspec_file[, well_name, ...])

Writes Nexus WELLSPEC keyword to an ascii file.

kji0_marker([active_only])

Convenience method returning (k0, j0, i0), grid_uuid of first blocked interval.

xyz_marker([active_only])

Convenience method returning (x, y, z), crs_uuid of perforation in first blocked interval.

create_feature_and_interpretation([...])

Instantiate new empty WellboreFeature and WellboreInterpretation objects.

create_md_datum_and_trajectory(grid, ...[, ...])

Creates an Md Datum object and a (simulation) Trajectory object for this blocked well.

add_grid_property_to_blocked_well(uuid_list)

Add properties to blocked wells from a list of uuids for properties on the supporting grid.

Inherited from BaseResqpy

__init__(parent_model[, uuid, grid, ...])

Creates a new blocked well object and optionally loads it from xml, or trajectory, or Nexus wellspec file.

try_reuse()

Look for an equivalent existing RESQML object and modify the uuid of this object if found.

create_xml([ext_uuid, ...])

Create a blocked wellbore representation node from this BlockedWell object, optionally add as part.

append_extra_metadata(meta_dict)

Append a given dictionary of metadata to the existing metadata.

__eq__(other)

Implements equals operator; uses is_equivalent() otherwise compares class type and uuid.

__ne__(other)

Implements not equal operator.

__repr__()

String representation.


__init__(parent_model, uuid=None, grid=None, trajectory=None, wellspec_file=None, cellio_file=None, column_ji0=None, well_name=None, check_grid_name=False, use_face_centres=False, represented_interp=None, originator=None, extra_metadata=None, add_wellspec_properties=False, usa_date_format=False, lazy=False)[source]

Creates a new blocked well object and optionally loads it from xml, or trajectory, or Nexus wellspec file.

Parameters
  • parent_model (model.Model object) – the model which the new blocked well belongs to

  • uuid (optional) – if present, the uuid of an existing blocked wellbore, in which case remaining arguments are ignored

  • grid (optional, grid.Grid object) – required if intialising from a trajectory or wellspec file; not used if uuid is not None

  • trajectory (optional, Trajectory object) – the trajectory of the well, to be intersected with the grid; not used if uuid is not None

  • wellspec_file (optional, string) – filename of an ascii file holding the Nexus wellspec data; ignored if uuid is not None or trajectory is not None

  • cellio_file (optional, string) – filename of an ascii file holding the RMS exported blocked well data; ignored if uuid is not None or trajectory is not None or wellspec_file is not None

  • column_ji0 (optional, pair of ints) – column indices (j0, i0) for a ‘vertical’ well; ignored if uuid is not None or trajectory is not None or wellspec_file is not None or cellio_file is not None

  • well_name (string) – the well name as given in the wellspec or cellio file; required if loading from one of those files; or the name to be used as citation title for a column well

  • check_grid_name (boolean, default False) – if True, the GRID column of the wellspec data will be checked for a match with the citation title of the grid object; perforations for other grids will be skipped; if False, all wellspec data is assumed to relate to the grid; only relevant when loading from wellspec

  • use_face_centres (boolean, default False) – if True, cell face centre points are used for the entry and exit points when constructing the simulation trajectory; if False and ANGLA & ANGLV data are available then entry and exit points are constructed based on a straight line at those angles passing through the centre of the cell; only relevant when loading from wellspec

  • represented_interp (wellbore interpretation object, optional) – if present, is noted as the wellbore interpretation object which this frame relates to; ignored if uuid is not None

  • originator (str, optional) – the name of the person creating the blocked well, defaults to login id; ignored if uuid is not None

  • extra_metadata (dict, optional) – string key, value pairs to add as extra metadata for the blocked well; ignored if uuid is not None

  • add_wellspec_properties (boolean or list of str, default False) – if not False, and initialising from a wellspec file, the blocked well has its hdf5 data written and xml created and properties are fully created; if a list is provided the elements must be numerical wellspec column names; if True, all numerical columns other than the cell indices are added as properties

  • usa_date_format (boolean, optional) – specifies whether MM/DD/YYYY (True) or DD/MM/YYYY (False) is used in wellspec file

  • lazy (boolean, default False) – if True, when initialising from a trajectory, initial penetration must be through a top K face and blocking will cease as soon as the trajectory first leaves the gridded volume; if False, initial entry may be through any external face or a fault face and re-entry will be handled; ignored if not initialising from a trajectory

Returns

the newly created blocked well object

Notes

if starting from a wellspec file or column indices, a ‘simulation’ trajectory and md datum objects are constructed to go with the blocked well; column wells might not be truly vertical - the trajectory will consist of linear segments joining the centres of the k faces in the column; optional RESQML attributes are not handled by this code (WITSML log reference, interval stratigraphic units, cell fluid phase units); multiple grids are currently only supported when loading an existing blocked well from xml; mysterious RESQML WellboreFrameIndexableElements is not used in any other RESQML classes and is therefore not used here; measured depth data must be in same crs as those for the related trajectory

add_df_properties(df, columns, length_uom=None, time_index=None, time_series_uuid=None, realization=None)[source]

Creates a property part for each column in the dataframe, based on the dataframe values.

Parameters
  • df (pd.DataFrame) – dataframe containing the columns that will be converted to properties

  • columns (List[str]) – list of the column names that will be converted to properties

  • length_uom (str, optional) – the length unit of measure

  • time_index (int, optional) – if adding a timestamp to the property, this is the timestamp index of the TimeSeries timestamps attribute

  • time_series_uuid (uuid.UUID, optional) – if adding a timestamp to the property, this is the uuid of the TimeSeries object

  • realization (int, optional) – if present, is used as the realization number for all the properties

Returns

None

Notes

the column name is used as the property citation title; the blocked well must already exist as a part in the model; this method currently only handles single grid situations; dataframe rows must be in the same order as the cells in the blocked well

add_grid_property_to_blocked_well(uuid_list)[source]

Add properties to blocked wells from a list of uuids for properties on the supporting grid.

add_properties_from_wellbore_frame(frame_uuid=None, property_kinds_list=None, realization=None, set_length=None, set_perforation_fraction=None, set_frame_interval=False)[source]

Add properties to this blocked well by derivation from wellbore frame intervals properties.

Parameters
  • frame_uuid (UUID, optional) – the uuid of the wellbore frame to source properties from; if None, a solitary wellbore frame relating to the same trajectory as this blocked well will be used

  • property_kinds_list (list of str, optional) – if present, a list of handled property kinds which are to be set from the wellbore frame properties; if None, any handled property kinds that are present for the wellbore frame will be used

  • realization (int, optional) – if present, wellbore frame properties will be filtered by this realization number and it will be assigned to the blocked well properties that are created

  • set_length (bool, optional) – if True, a length property will be generated based on active measured depth intervals; if None, will be set True if length is in list of property kinds being processed

  • set_perforation_fraction (bool, optional) – if True, a perforation fraction property will be created based on the fraction of the measured depth within a blocked well cell that is flagged as active, ie. perforated at some time; if None, it will be created only if length and permeability length are both absent

  • set_frame_interval (bool, default False) – if True, a static discrete property holding the index of the dominant active wellbore frame interval (per blocked well cell) is created

Returns

list of uuids of created property parts (does not include any copied time series object)

Notes

this method is designed to set up some blocked well properties based on similar properties already established on a special wellbore frame, mainly for perforations and open hole completions; frame_uuid should be specified if there are well logs in the dataset, or other wellbore frames; if a permeability thickness property is being set based on a wellbore frame property, the value is divided between blocked well cells based solely on measured depth interval lengths, without reference to grid properties such as net to gross ratio or permeability; titles will be the same as those used in the frame properties, and ‘PPERF’ for partial perforation; if set_frame_interval is True, the resulting property will be given a soft relationship with the wellbore frame (in addition to its supporting representation reference relationship with the blocked well); a null value of -1 is used where no active frame interval is present in a cell; units of measure will also be the same as those in the wellbore frame; this method only supports single grid blocked wells at present; wellbore frame must be in the same model as this blocked well

append_extra_metadata(meta_dict)

Append a given dictionary of metadata to the existing metadata.

box(grid_uuid=None)[source]

Returns the KJI box containing the cells visited by the well, for single grid if grid_uuid is None.

cell_indices_and_grid_list()[source]

Returns a numpy int array of shape (N, 3) of cells visited by well, and a list of grid objects of length N.

cell_indices_for_grid_uuid(grid_uuid)[source]

Returns a numpy int array of shape (N, 3) of cells visited by well in specified grid.

cell_indices_kji0()[source]

Returns a numpy int array of shape (N, 3) of cells visited by well, for a single grid situation.

property citation_title

Citation block title equivalent to self.title.

compressed_grid_indices()[source]

Returns a list of grid indices excluding the -1 elements (unblocked intervals).

Note

length will match that of cell_indices

compute_from_trajectory(trajectory, grid, active_only=False, quad_triangles=True, use_single_layer_tactics=True, lazy=False)[source]

Populate this blocked wellbore object based on intersection of trajectory with cells of grid.

Parameters
  • trajectory (Trajectory object) – the trajectory to intersect with the grid; control_points and crs_uuid attributes must be populated

  • grid (grid.Grid object) – the grid with which to intersect the trajectory

  • active_only (boolean, default False) – if True, only active cells are included as blocked intervals

  • quad_triangles (boolean, default True) – if True, 4 triangles per cell face are used for the intersection calculations; if False, only 2 triangles per face are used

  • use_single_layer_tactics (boolean, default True) – if True and the grid does not have k gaps, initial intersection calculations with fault planes or the outer IK & JK skin of the grid are calculated as if the grid is a single layer (and only after an intersection is thus found is the actual layer identified); this significantly speeds up computation but may cause failure in the presence of significantly non-straight pillars and could (rarely) cause problems where a fault plane is significantly skewed (non-planar) even if individual pillars are straight

  • lazy (boolean, default False) – if True, initial penetration must be through a top K face and blocking will cease as soon as the trajectory first leaves the gridded volume; if False, initial entry may be through any external face or a fault face and re-entry will be handled

Note

this method is computationally intensive and might take ~30 seconds for a tyipical grid and trajectory; large grids, grids with k gaps, or setting use_single_layer_tactics False will typically result in significantly longer processing time

create_feature_and_interpretation(shared_interpretation=True)[source]

Instantiate new empty WellboreFeature and WellboreInterpretation objects.

Note

uses the Blocked well citation title or other related object title as the well name

create_md_datum_and_trajectory(grid, trajectory_mds, trajectory_points, length_uom, well_name, set_depth_zero=False, set_tangent_vectors=False, create_feature_and_interp=True)[source]

Creates an Md Datum object and a (simulation) Trajectory object for this blocked well.

Note

not usually called directly; used by import methods

create_xml(ext_uuid=None, create_for_trajectory_if_needed=True, add_as_part=True, add_relationships=True, title=None, originator=None)[source]

Create a blocked wellbore representation node from this BlockedWell object, optionally add as part.

Note

trajectory xml node must be in place before calling this function; witsml log reference, interval stratigraphic units, and cell fluid phase units not yet supported

dataframe(i_col='IW', j_col='JW', k_col='L', one_based=True, extra_columns_list=[], ntg_uuid=None, perm_i_uuid=None, perm_j_uuid=None, perm_k_uuid=None, satw_uuid=None, sato_uuid=None, satg_uuid=None, region_uuid=None, radw=None, skin=None, stat=None, active_only=False, min_k0=None, max_k0=None, k0_list=None, min_length=None, min_kh=None, max_depth=None, max_satw=None, min_sato=None, max_satg=None, perforation_list=None, region_list=None, depth_inc_down=None, set_k_face_intervals_vertical=False, anglv_ref='normal ij down', angla_plane_ref=None, length_mode='MD', length_uom=None, use_face_centres=False, preferential_perforation=True, add_as_properties=False, use_properties=False, property_time_index=None, time_series_uuid=None)[source]

Returns a pandas data frame containing Nexus WELLSPEC style data.

Parameters
  • i_col (string, default 'IW') – the column name to use for cell I index values

  • j_col (string, default 'JW') – the column name to use for cell J index values

  • k_col (string, default 'L') – the column name to use for cell K index values

  • one_based (boolean, default True) – if True, simulator protocol i, j & k values are placed in I, J & K columns; if False, resqml zero based values; this does not affect the interpretation of min_k0 & max_k0 arguments

  • extra_columns_list (list of string, optional) – list of WELLSPEC column names to include in the dataframe, from currently recognised values: ‘GRID’, ‘ANGLA’, ‘ANGLV’, ‘LENGTH’, ‘KH’, ‘DEPTH’, ‘MD’, ‘X’, ‘Y’, ‘RADW’, ‘SKIN’, ‘PPERF’, ‘RADB’, ‘WI’, ‘WBC’

  • ntg_uuid (uuid.UUID, optional) – the uuid of the net to gross ratio property; if present is used to downgrade the i & j permeabilities in the calculation of KH; ignored if ‘KH’ not in the extra column list and min_kh is not specified; the argument may also be a dictionary mapping from grid uuid to ntg uuid; if no net to gross data is provided, it is effectively assumed to be one (or, equivalently, the I & J permeability data is applicable to the gross rock); see also preferential_perforation argument which can cause adjustment of effective ntg in partially perforated cells

  • perm_i_uuid (uuid.UUID or dictionary, optional) – the uuid of the permeability property in the I direction; required if ‘KH’ is included in the extra columns list and min_kh is not specified; ignored otherwise; the argument may also be a dictionary mapping from grid uuid to perm I uuid

  • perm_j_uuid (uuid.UUID, optional) – the uuid (or dict) of the permeability property in the J direction; defaults to perm_i_uuid

  • perm_k_uuid (uuid.UUID, optional) – the uuid (or dict) of the permeability property in the K direction; defaults to perm_i_uuid

  • satw_uuid (uuid.UUID, optional) – the uuid of a water saturation property; required if max_satw is specified; may also be a dictionary mapping from grid uuid to satw uuid; ignored if max_satw is None

  • sato_uuid (uuid.UUID, optional) – the uuid of an oil saturation property; required if min_sato is specified; may also be a dictionary mapping from grid uuid to sato uuid; ignored if min_sato is None

  • satg_uuid (uuid.UUID, optional) – the uuid of a gas saturation property; required if max_satg is specified; may also be a dictionary mapping from grid uuid to satg uuid; ignored if max_satg is None

  • region_uuid (uuid.UUID, optional) – the uuid of a discrete or categorical property, required if region_list is not None; may also be a dictionary mapping from grid uuid to region uuid; ignored if region_list is None

  • radw (float, optional) – if present, the wellbore radius used for all perforations; must be in correct units for intended use of the WELLSPEC style dataframe; will default to 0.33 ft or 0.1 m if ‘RADW’ is included in the extra column list

  • skin (float, optional) – if present, a skin column is included with values set to this constant

  • stat (string, optional) – if present, should be ‘ON’ or ‘OFF’ and is used for all perforations; will default to ‘ON’ if ‘STAT’ is included in the extra column list

  • active_only (boolean, default False) – if True, only cells that are flagged in the grid object as active are included; if False, cells are included whether active or not

  • min_k0 (int, optional) – if present, perforations in layers above this are excluded (layer number will be applied naively to all grids – not recommended when working with more than one grid with different layering)

  • max_k0 (int, optional) – if present, perforations in layers below this are excluded (layer number will be applied naively to all grids – not recommended when working with more than one grid with different layering)

  • k0_list (list of int, optional) – if present, only perforations in cells in these layers are included (layer numbers will be applied naively to all grids – not recommended when working with more than one grid with different layering)

  • min_length (float, optional) – if present, a minimum length for an individual perforation interval to be included; units are the length units of the trajectory object unless length_uom argument is set

  • min_kh (float, optional) – if present, the minimum permeability x length value for which an individual interval is included; permeabilty uuid(s) must be supplied for the kh calculation; units of the length component are those of the trajectory object unless length_uom argument is set

  • max_depth (float, optional) – if present, rows are excluded for cells with a centre point depth greater than this value; max_depth should be positive downwards, with units of measure those of the grid z coordinates

  • max_satw (float, optional) – if present, perforations in cells where the water saturation exceeds this value will be excluded; satw_uuid must be supplied if this argument is present

  • min_sato (float, optional) – if present, perforations in cells where the oil saturation is less than this value will be excluded; sato_uuid must be supplied if this argument is present

  • max_satg (float, optional) – if present, perforations in cells where the gas saturation exceeds this value will be excluded; satg_uuid must be supplied if this argument is present

  • perforation_list (list of (float, float), optional) – if present, a list of perforated intervals; each entry is the start and end measured depths for a perforation; these do not need to align with cell boundaries

  • region_list (list of int, optional) – if present, a list of region numbers for which rows are to be included; the property holding the region data is identified by the region_uuid argument

  • depth_inc_down (boolean, optional) – if present and True, the depth values will increase with depth; if False or None, the direction of the depth values will be determined by the z increasing downwards indicator in the trajectory crs

  • set_k_face_intervals_vertical (boolean, default False) – if True, intervals with entry through K- and exit through K+ will have angla and anglv set to 0.0 (vertical); if False angles will be computed depending on geometry

  • anglv_ref (string, default 'normal ij down') – either ‘gravity’, ‘z down’ (same as gravity), ‘z+’, ‘k down’, ‘k+’, ‘normal ij’, or ‘normal ij down’; the ANGLV angles are relative to a local (per cell) reference vector selected by this keyword

  • angla_plane_ref (string, optional) – string indicating normal vector defining plane onto which trajectory and I axis are projected for the calculation of ANGLA; options as for anglv_ref, or ‘normal well i+’ which results in no projection; defaults to the same as anglv_ref

  • length_mode (string, default 'MD') – ‘MD’ or ‘straight’ indicating which length to use; ‘md’ takes measured depth difference between exit and entry; ‘straight’ uses a naive straight line length between entry and exit; this will affect values for LENGTH, KH, DEPTH, X & Y

  • length_uom (string, optional) – if present, either ‘m’ or ‘ft’: the length units to use for the LENGTH, KH, MD, DEPTH, RADW, X & Y columns if they are present in extra_columns_list; also used to interpret min_length and min_kh; if None, the length units of the trajectory attribute are used LENGTH, KH & MD and those of the grid are used for RADW, DEPTH, X & Y; also used implicitly to determine conversion constant used in calculation of wellbore constant (WBC); if radw is provided as an argument, it is assumed to be already in this length uom

  • use_face_centres (boolean, default False) – if True, the centre points of the entry and exit faces will determine the vector used as the basis of ANGLA and ANGLV calculations; if False, the trajectory locations for the entry and exit measured depths will be used

  • preferential_perforation (boolean, default True) – if perforation_list is given, and KH is requested or a min_kh given, the perforated intervals are assumed to penetrate pay rock preferentially: an effective ntg weighting is computed to account for any residual non-pay perforated interval; ignored if perforation_list is None or kh values are not being computed

  • add_as_properties (boolean or list of str, default False) – if True, each column in the extra_columns_list (excluding GRID) is added as a property with the blocked well as supporting representation and ‘cells’ as the indexable element; any cell that is excluded from the dataframe will have corresponding entries of NaN in all the properties; if a list is provided it must be a subset of extra_columns_list

  • use_properties (boolean or list of str, default False) – if True, each column in the extra_columns_list (excluding GRID) is populated from a property with citation title matching the column name, if it exists

  • property_time_index (int, optional) – if present and use_properties is True, the time index to select properties for; if add_as_properties is True, the time index to tag this set of properties with

  • time_series_uuid (UUID, optional) – the uuid of the time series for time dependent properties being added

Notes

units of length along wellbore will be those of the trajectory’s length_uom (also applies to K.H values) unless the length_uom argument is used; the constraints are applied independently for each row and a row is excluded if it fails any constraint; the min_k0 and max_k0 arguments do not stop later rows within the layer range from being included; the min_length and min_kh limits apply to individual cell intervals and thus depend on cell size; the water and oil saturation limits are for saturations at a single time and affect whether the interval is included in the dataframe – there is no functionality to support turning perforations off and on over time; the saturation limits do not stop deeper intervals with qualifying saturations from being included; the k0_list, perforation_list and region_list arguments should be set to None to disable the corresponding functionality, if set to an empty list, no rows will be included in the dataframe; if add_as_properties is True, the blocked well must already have been added as a part to the model; add_as_properties and use_properties cannot both be True; add_as_properties and use_properties are only currently functional for single grid blocked wells; at present, unit conversion is not handled when using properties

derive_from_cell_list(cell_kji0_list, well_name, grid, length_uom=None)[source]

Populate empty blocked well from numpy int array of shape (N, 3) being list of cells.

derive_from_dataframe(df, well_name, grid, grid_name_to_check=None, use_face_centres=True, add_as_properties=False, length_uom=None)[source]

Populate empty blocked well from WELLSPEC-like dataframe; first columns must be IW, JW, L (i, j, k).

Note

if add_as_properties is True or present as a list of wellspec column names, both the blocked well and the properties will have their hdf5 data written, xml created and be added as parts to the model

derive_from_wellspec(wellspec_file, well_name, grid, check_grid_name=False, use_face_centres=False, add_properties=True, usa_date_format=False, last_data_only=False, length_uom=None)[source]

Populates empty blocked well from Nexus WELLSPEC data; creates simulation trajectory and md datum.

Parameters
  • wellspec_file (string) – path of Nexus ascii file holding WELLSPEC keyword

  • well_name (string) – the name of the well as used in the wellspec data

  • grid (grid.Grid object) – the grid object which the cell indices in the wellspec data relate to

  • check_grid_name (boolean, default False) – if True, the GRID column of the wellspec data will be checked for a match with the citation title of the grid object; perforations for other grids will be skipped; if False, all wellspec data is assumed to relate to the grid

  • use_face_centres (boolean, default False) – if True, cell face centre points are used for the entry and exit points when constructing the simulation trajectory; if False and ANGLA & ANGLV data are available then entry and exit points are constructed based on a straight line at those angles passing through the centre of the cell

  • add_properties (bool or list of str, default True) – if True, WELLSPEC columns (other than IW, JW, L & GRID) are added as property parts for the blocked well; if a list is passed, it must contain a subset of the columns in the WELLSPEC data

  • usa_date_format (bool, default False) – if True, dates in the WELLSPEC file are interpreted as being in USA format (MM/DD/YYYY); otherwise European format (DD/MM/YYYY)

  • last_data_only (bool, default False) – If True, only the last entry of well data in the file is used and no time series or time index is used if properties are being added

  • length_uom (str, optional) – if present, the target length units for MD data in generated objects; if None, will default to z units of grid crs

Returns

self if successful; None otherwise

Note

if add_properties is True or present as a list, this method will write the hdf5, create the xml and add parts to the model for this blocked well and the properties

entry_and_exit_mds(cell_index)[source]

Returns entry and exit measured depths for a blocked cell.

Parameters

cell_index (int) – the index of the cell in the blocked cells list; 0 <= cell_index < cell_count

Returns

(float, float) being the entry and exit measured depths for the cell, along the trajectory; uom is held in trajectory object

extract_property_collection(refresh=False)[source]

Returns a property collection for the blocked well.

face_pair_array()[source]

Returns numpy int array of shape (N, 2, 2) being pairs of face (axis, polarity) pairs, to go with cell_kji0_array().

Notes

each of the N rows in the returned array is of the form:

((entry_face_axis, entry_face_polarity), (exit_face_axis, exit_face_polarity))

where the axis values are in the range 0 to 2 for k, j & i respectively, and the polarity values are zero for the ‘negative’ face and 1 for the ‘positive’ face; exit values may be -1 to indicate TD within the cell (ie. no exit point)

frame_contributions_list(wbf)[source]

Returns wellbore frame contributions to each cell in this blocked well.

Parameters

wbf (WellboreFrame) – the wellbore frame to map to this blocked well

Returns

list of list of (int, float, float) with one entry per blocked well cell, and each
entry being a list of (wellbore frame interval index,

fraction of wellbore frame interval in cell, fraction of cell’s wellbore interval in wellbore frame interval)

grid_uuid_list()[source]

Returns a list of the uuids of the grids referenced by the blocked well object.

import_from_rms_cellio(cellio_file, well_name, grid, include_overburden_unblocked_interval=False, set_tangent_vectors=False)[source]

Populates empty blocked well from RMS cell I/O data; creates simulation trajectory and md datum.

Parameters
  • cellio_file (string) – path of RMS ascii export file holding blocked well cell I/O data; cell entry and exit points are expected

  • well_name (string) – the name of the well as used in the cell I/O file

  • grid (grid.Grid object) – the grid object which the cell indices in the cell I/O data relate to

  • set_tangent_vectors (boolean, default False) – if True, tangent vectors will be computed from the well trajectory’s control points

Returns

self if successful; None otherwise

interval_for_cell(cell_index)[source]

Returns the interval index for a given cell index (identical if there are no unblocked intervals).

kji0_marker(active_only=True)[source]

Convenience method returning (k0, j0, i0), grid_uuid of first blocked interval.

map_cell_and_grid_indices()[source]

Returns a list of index values linking the grid_indices to cell_indices.

Note

length will match grid_indices, and will show -1 where cell is unblocked

number_of_grids()[source]

Returns the number of grids referenced by the blocked well object.

property part

Standard part name corresponding to self.uuid.

property root

XML node corresponding to self.uuid.

set_for_column(well_name, grid, col_ji0, skip_inactive=True, length_uom=None)[source]

Populates empty blocked well for a ‘vertical’ well in given column; creates simulation trajectory and md datum.

single_grid()[source]

Asserts that exactly one grid is being referenced and returns a grid object for that grid.

static_kh(ntg_uuid=None, perm_i_uuid=None, perm_j_uuid=None, perm_k_uuid=None, satw_uuid=None, sato_uuid=None, satg_uuid=None, region_uuid=None, active_only=False, min_k0=None, max_k0=None, k0_list=None, min_length=None, min_kh=None, max_depth=None, max_satw=None, min_sato=None, max_satg=None, perforation_list=None, region_list=None, set_k_face_intervals_vertical=False, anglv_ref='gravity', angla_plane_ref=None, length_mode='MD', length_uom=None, use_face_centres=False, preferential_perforation=True)[source]

Returns the total static K.H (permeability x height).

Notes

length units are those of trajectory md_uom unless length_upm is set; see doc string for dataframe() method for argument descriptions; perm_i_uuid required

try_reuse()

Look for an equivalent existing RESQML object and modify the uuid of this object if found.

Returns

boolean – True if an equivalent object was found, False if not

Note

by design this method may change this object’s uuid as a side effect

wb_cell_for_md(md)[source]

Return blocked well cell index and fractional distance into cell md interval, for given md.

property well_name

Alias for title

write_hdf5(file_name=None, mode='a', create_for_trajectory_if_needed=True)[source]

Create or append to an hdf5 file, writing datasets for the measured depths, grid, cell & face indices.

write_wellspec(wellspec_file, well_name=None, mode='a', extra_columns_list=[], ntg_uuid=None, perm_i_uuid=None, perm_j_uuid=None, perm_k_uuid=None, satw_uuid=None, sato_uuid=None, satg_uuid=None, region_uuid=None, radw=None, skin=None, stat=None, active_only=False, min_k0=None, max_k0=None, k0_list=None, min_length=None, min_kh=None, max_depth=None, max_satw=None, min_sato=None, max_satg=None, perforation_list=None, region_list=None, set_k_face_intervals_vertical=False, depth_inc_down=True, anglv_ref='gravity', angla_plane_ref=None, length_mode='MD', length_uom=None, preferential_perforation=True, space_instead_of_tab_separator=True, align_columns=True, preceeding_blank_lines=0, trailing_blank_lines=0, length_uom_comment=False, write_nexus_units=True, float_format='5.3', use_properties=False, property_time_index=None)[source]

Writes Nexus WELLSPEC keyword to an ascii file.

Returns

pandas DataFrame containing data that has been written to the wellspec file

Note

see doc string for dataframe() method for most of the argument descriptions; align_columns and float_format arguments are deprecated and no longer used

xyz_marker(active_only=True)[source]

Convenience method returning (x, y, z), crs_uuid of perforation in first blocked interval.

Notes

active_only argument not yet in use; returns None, None if no blocked interval found

title

Citation title

originator

Creator of object. By default, user id.

uuid

Unique identifier