resqpy.derived_model.extract_box_for_well

resqpy.derived_model.extract_box_for_well(epc_file=None, source_grid=None, min_k0=None, max_k0=None, trajectory_epc=None, trajectory_uuid=None, blocked_well_uuid=None, column_ji0=None, column_xy=None, well_name=None, radius=None, outer_radius=None, active_cells_shape='tube', quad_triangles=True, inherit_properties=False, inherit_realization=None, inherit_all_realizations=False, inherit_well=False, set_parent_window=None, new_grid_title=None, new_epc_file=None)

Extends an existing model with a new grid extracted as an IJK box around a well trajectory in the source grid.

Parameters
  • epc_file (string) – file name to rewrite the model’s xml to; if source grid is None, model is loaded from this file

  • source_grid (grid.Grid object, optional) – if None, the epc_file is loaded and it should contain one ijk grid object (or one ‘ROOT’ grid) which is used as the source grid

  • min_k0 (integers, optional) – layer range to include; default is full vertical range of source grid

  • max_k0 (integers, optional) – layer range to include; default is full vertical range of source grid

  • trajectory_epc (string, optional) – the source file for the trajectory or blocked well, if different to that for the source grid

  • trajectory_uuid (uuid.UUID) – the uuid of the trajectory object for the well, if working from a trajectory

  • blocked_well_uuid (uuid.UUID) – the uuid of the blocked well object, an alternative to working from a trajectory; must include blocking against source_grid

  • column_ji0 (integer pair, optional) – an alternative to providing a trajectory: the column indices of a ‘vertical’ well

  • column_xy (float pair, optional) – an alternative to column_ji0: the x, y location used to determine the column

  • well_name (string, optional) – name to use for column well, ignored if trajectory_uuid is not None

  • radius (float, optional) – the radius around the wellbore to include in the box; units are those of grid xy values; radial distances are applied horizontally regardless of well inclination; if not present, only cells penetrated by the trajectory are included

  • outer_radius (float, optional) – an outer radius around the wellbore, beyond which an inactive cell mask for the source_grid will be set to True (inactive); units are those of grid xy values

  • active_cells_shape (string, default 'tube') – the logical shape of cells marked as active in the extracted box; ‘tube’ results in an active shape with circular cross section in IJ planes, that follows the trajectory; ‘prism’ activates all cells in IJ columns where any cell is within the tube; ‘box’ leaves the entire IJK cuboid active

  • quad_triangles (boolean, default True) – if True, cell K faces are treated as 4 triangles (with a common face centre point) when computing the intersection of the trajectory with layer interfaces (horizons); if False, the K faces are treated as 2 triangles

  • inherit_properties (boolean, default False) – if True, the new grid will have a copy of any properties associated with the source grid, with values taken from the extracted box

  • inherit_realization (int, optional) – realization number for which properties will be inherited; ignored if inherit_properties is False

  • inherit_all_realizations (boolean, default False) – if True (and inherit_realization is None), properties for all realizations will be inherited; if False, only properties with a realization of None are inherited; ignored if inherit_properties is False or inherit_realization is not None

  • inherit_well (boolean, default False) – if True, the new model will have a copy of the well trajectory, its crs (if different from that of the grid), and any related wellbore interpretation and feature

  • set_parent_window (boolean, optional) – if True, the extracted grid has its parent window attribute set; if False, the parent window is not set; if None, the default will be True if new_epc_file is None or False otherwise

  • new_grid_title (string) – used as the citation title text for the new grid object

  • new_epc_file (string, optional) – if None, the source epc_file is extended with the new grid object; if present, a new epc file (& associated h5 file) is created to contain the extracted grid (& crs)

Returns

(grid, box) where – grid is the new Grid object with extent as determined by source grid geometry, trajectory and radius arguments; and box is a numpy int array of shape (2, 3) with first axis covering min, max and second axis covering k,j,i; the box array holds the minimum and maximum indices (zero based) in the source grid that have been included in the extraction (nb. maximum indices are included, unlike the usual python protocol)

Notes

this function is designed to work fully for vertical and deviated wells; for horizontal wells use blocked well mode; the extracted box includes all layers between the specified min and max horizons, even if the trajectory terminates above the deeper horizon or does not intersect horizon(s) for other reasons; when specifying a column well by providing x,y the IJ column with the centre of the topmost k face closest to the given point is selected; if an outer_radius is given, a boolean property will be created for the source grid with values set True where the centres of the cells are beyond this distance from the well, measured horizontally; if outer_radius and new_epc_file are both given, the source grid will be copied to the new epc