iris.mesh.utils#
Utility operations specific to unstructured data.
- iris.mesh.utils.recombine_submeshes(mesh_cube, submesh_cubes, index_coord_name='i_mesh_index')[source]#
Put data from sub-meshes back onto the original full mesh.
The result is a cube like
mesh_cube
, but with its data replaced by a combination of the data in thesubmesh_cubes
.- Parameters:
mesh_cube (Cube) – Describes the mesh and mesh-location onto which the all the
submesh-cubes
’ data are mapped, and acts as a template for the result. Must have aMeshXY
.submesh_cubes (iterable of Cube, or Cube) – Cubes, each with data on a _subset_ of the
mesh_cube
datapoints (within the mesh dimension). The submesh cubes do not need to have a mesh. There must be at least 1 of them, to determine the result phenomenon. Their metadata (names, units and attributes) must all be the same, _except_ that ‘var_name’ is ignored. Their dtypes must all be the same. Their shapes and dimension-coords must all match those ofmesh_cube
, except in the mesh dimension, which can have different sizes between the submeshes, and from themesh_cube
. The mesh dimension of each must have a 1-D coord named byindex_coord_name
. These “index coords” can vary in length, but they must all have matching metadata (units, attributes and names except ‘var_name’), and must also match the coord of that name inmesh_cube
, if there is one. The “.points” values of the index coords specify, for each datapoint, its location in the original mesh – i.e. they are indices into the relevant mesh-location dimension.index_coord_name (str) – Coord name of an index coord containing the mesh location indices, in every submesh cube.
- Returns:
A cube with the same mesh, location, and shape as
mesh_cube
, but with its data replaced by that from the``submesh_cubes``. The result phenomeon identity is also that of the``submesh_cubes``, i.e. units, attributes and names (except ‘var_name’, which is None).- Return type:
result_cube
Notes
Where regions overlap, the result data comes from the submesh cube containing that location which appears _last_ in
submesh_cubes
.Where no region contains a datapoint, it will be masked in the result. HINT: alternatively, values covered by no region can be set to the original ‘full_mesh_cube’ data value, if ‘full_mesh_cube’ is also passed as the first of the ‘region_cubes’.
The
result_cube
dtype is that of thesubmesh_cubes
.