merge_variable_metadata.py

merge_variable_metadata.py#

aviary.utils.merge_variable_metadata.almost_equal(a, b, rel_tol=1e-08, abs_tol=0.0)[source]
aviary.utils.merge_variable_metadata.merge_2_meta_data_dicts(dict1, dict2)[source]

Combines metadata from two dictionaries into a single dictionary containing metadata of both.

Performs a check to ensure that the two dictionaries don’t have the same variable with conflicting metadata. Assuming that check passes, the variables and their associated metadata from both dictionaries are combined into one dictionary.

Parameters:
  • dict1 (dict) – Dictionaries with keys of Aviary variables and values of their associated metadata.

  • dict2 (dict) – Dictionaries with keys of Aviary variables and values of their associated metadata.

Returns:

new_dict – Single dictionary with all the combined entries from the two input Aviary metadata dictionaries.

Return type:

dict

Raises:

ValueError – Raises error if dict1 and dict2 have differing metadata for the same variable.

aviary.utils.merge_variable_metadata.merge_meta_data(dicts_to_merge)[source]

Merges the metadata of multiple Aviary metadata dictionaries into a single metadata dictionary.

Checks the metadata of all the provided Aviary metadata dictionaries to see if there are identical variables with conflicting metadata. Assuming this check passes, the input dictionaries are merged together into a single dictionary containing all their information.

Parameters:

dicts_to_merge (list of dicts) – List of Aviary metadata dictionaries to be merged.

Returns:

merged_dict – Single Aviary metadata dictionary with all the information of the inputted metadata dictionaries.

Return type:

dict

Raises:

None – No exceptions raised by this method, although other methods called within may raise exceptions.