resqpy.derived_model.extract_box

resqpy.derived_model.extract_box(epc_file=None, source_grid=None, box=None, box_inactive=None, inherit_properties=False, inherit_realization=None, inherit_all_realizations=False, set_parent_window=None, new_grid_title=None, new_epc_file=None)

Extends an existing model with a new grid extracted as a logical IJK box from 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

  • box (numpy int array of shape (2, 3)) – the minimum and maximum kji0 indices in the source grid (zero based) to include in the extracted grid; note that cells with index equal to maximum value are included (unlike with python ranges)

  • box_inactive (numpy bool array, optional) – if present, shape must match box and values will be or’ed in with the inactive mask inherited from the source grid; if None, inactive mask will be as inherited from source grid

  • 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 specified 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

  • 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:

new grid object with extent as implied by the box argument

Note

the epc file and associated hdf5 file are appended to (extended) with the new grid, unless a new_epc_file is specified, in which case the grid and inherited properties are written there instead