resqpy.derived_model.refined_grid

resqpy.derived_model.refined_grid(epc_file, source_grid, fine_coarse, inherit_properties=False, inherit_realization=None, inherit_all_realizations=False, source_grid_uuid=None, set_parent_window=None, infill_missing_geometry=True, new_grid_title=None, new_epc_file=None)

Generates a refined version of the source grid, optionally inheriting properties.

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 unless source_grid_uuid is specified to identify the grid

  • fine_coarse (resqpy.olio.fine_coarse.FineCoarse object) – the mapping between cells in the fine (output) and coarse (source) grids

  • inherit_properties (boolean, default False) – if True, the new grid will have a copy of any properties associated with the source grid, with values resampled in the simplest way onto the finer grid

  • 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

  • source_grid_uuid (uuid.UUID, optional) – the uuid of the source grid – an alternative to the source_grid argument as a way of identifying the grid

  • set_parent_window (boolean or str, optional) – if True or ‘parent’, the refined 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; if ‘grandparent’ then an intervening parent window with no refinement or coarsening will be skipped and its box used in the parent window for the new grid, relating directly to the original grid

  • infill_missing_geometry (boolean, default True) – if True, an attempt is made to generate grid geometry in the source grid wherever it is undefined; if False, any undefined geometry will result in an assertion failure

  • 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 refined grid (& crs)

Returns

new grid object being the refined grid; the epc and hdf5 files are written to as an intentional side effect

Notes

this function refines an entire grid; to refine a local area of a grid, first use the extract_box function and then use this function on the extracted grid; in such a case, using a value of ‘grandparent’ for the set_parent_window argument will relate the refined grid back to the original; if geometry infilling takes place, cached geometry and mask arrays within the source grid object will be modified as a side-effect of the function (but not written to hdf5 or changed in xml)