merge_compatible_coords_attrs

function of dascore.utils.patch source

merge_compatible_coords_attrs(
    patch1: Patch ,
    patch2: Patch ,
    attrs_to_ignore = (‘history’, ‘dims’),
    dim_intersection: bool = False,
    validate_coords: bool = True,
)-> ‘tuple[dc.core.CoordManager, dc.PatchAttrs]’

Merge the coordinates and attributes of patches or raise if incompatible.

The rules for compatibility are:

  • All attrs must be equal other than those specified in attrs_to_ignore.
  • Patches must share the same dimensions unless dim_intersection == True.
  • All shared dimensional coordinates must be strictly equal
  • If patches share a non-dimensional coordinate they must be equal.

Any coordinates or attributes contained by a single patch will be included in the output.

Parameters

Parameter Description
patch1 The first patch
patch2 The second patch
attrs_to_ignore A sequence of attributes to not consider in equality. Only these
attributes from the first patch are kept in outputs.
dim_intersection If True, merge if any dimensions overlap, else raise if all do not
overlap.
validate_coords If True, ensure the coords are equal, else the responsibility for this
was handled upstream.