resqpy.derived_model.drape_to_surface(epc_file, source_grid=None, surface=None, scaling_factor=None, ref_k0=0, ref_k_faces='top', quad_triangles=True, border=None, store_displacement=False, inherit_properties=False, inherit_realization=None, inherit_all_realizations=False, new_grid_title=None, new_epc_file=None)

Return a new grid with geometry draped to a surface.

Extend a resqml model with a new grid where the reference layer boundary of the source grid has been re-draped to a surface.

  • 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

  • surface (surface.Surface object, optional) – the surface to drape the grid to; if None, a surface is generated from the reference layer boundary (which can then be scaled with the scaling_factor)

  • scaling_factor (float, optional) – if not None, prior to draping, the surface is stretched vertically by this factor, away from a horizontal plane located at the surface’s shallowest depth

  • ref_k0 (integer, default 0) – the reference layer (zero based) to drape to the surface

  • ref_k_faces (string, default 'top') – ‘top’ or ‘base’ identifying which bounding interface to use as the reference

  • quad_triangles (boolean, default True) – if True and surface is None, each cell face in the reference boundary layer is represented by 4 triangles (with a common vertex at the face centre) in the generated surface; if False, only 2 trianges are used for each cell face (which gives a non-unique solution)

  • cell_range (integer, default 0) – the number of cells away from faults which will have depths adjusted to spatially smooth the effect of the throw scaling (ie. reduce sudden changes in gradient due to the scaling)

  • offset_decay (float, default 0.5) – the factor to reduce depth shifts by with each cell step away from faults (used in conjunction with cell_range)

  • store_displacement (boolean, default False) – if True, 3 grid property parts are created, one each for x, y, & z displacement of cells’ centres brought about by the local depth shift

  • inherit_properties (boolean, default False) – if True, the new grid will have a copy of any properties associated with the source 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

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


new grid (grid.Grid object), with geometry draped to surface


at least one of a surface or a scaling factor must be given; if no surface is given, one is created from the fault-healed grid points for the reference layer interface; if a scaling factor other than 1.0 is given, the surface is flexed vertically, relative to its shallowest point; layer thicknesses measured along pillars are maintained; cell volumes may change; the coordinate reference systems for the surface and the grid are assumed to be the same; this function currently uses an exhaustive, computationally and memory intensive algorithm; setting quad_triangles argument to False should give a factor of 2 speed up and reduction in memory requirement; the epc file and associated hdf5 file are appended to (extended) with the new grid, as a side effect of this function