resqpy.derived_model.coarsened_grid

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

Generates a coarsened version of an unsplit 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

  • fine_coarse (resqpy.olio.fine_coarse.FineCoarse object) – the mapping between cells in the fine (source) and coarse (output) 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 upscaled or sampled

  • 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 or str, optional) – if True or ‘parent’, the coarsened 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 coarsened grid; the epc and hdf5 files are written to as an intentional side effect

Note

this function coarsens an entire grid; to coarsen 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 coarsened grid back to the original