cubids.metadata_merge.merge_without_overwrite

merge_without_overwrite(source_meta, dest_meta_orig, raise_on_error=False)[source]

Perform a safe metadata copy.

Here, “safe” means that no non-NaN values in dest_meta are overwritten by the merge. If any overwrites occur an empty dictionary is returned.

Parameters:
  • source_meta (dict) – The metadata to merge from.

  • dest_meta_orig (dict) – The metadata to merge into.

  • raise_on_error (bool, optional) – Whether to raise an exception if there are errors.

Returns:

The merged metadata.

Return type:

dict

Raises:

Exception – If there are errors and raise_on_error is True.