Merging Variable Info#
When working with multiple external subsystems for Aviary, sometimes it is helpful to merge together variable hierarchies and metadata. The syntax for those merging functions can be found below. For more detailed descriptions of how to merge metadata and hierarchies visit the included links.
- aviary.utils.merge_hierarchies.merge_hierarchies(hierarchies_to_merge)[source]
Combines all provided variable hierarchies into one unified variable hierarchy.
Performs checks on the user-provided list of variable hierarchies in order to ensure that they are compatible for merge. Ensures that they are not derived from different superclasses, and that they do not have conflicting values. Assuming all checks pass, the provided hierarchies are combined into a single hierarchy.
- Parameters:
hierarchies_to_merge (list of classes) – This is a list of all the variable hierarchies which should be merged into a single hierarchy. This list should not include hierarchies of multiple types (i.e. an av.Mission hierarchy extension should not be mixed with an av.Aircraft hierarchy extension)
- Returns:
merged_hierarchy – Aviary variable hierarchy that includes all the variables present in the inputted hierarchy list. Duplicates have been removed, and conflicting duplicates are not possible.
- Return type:
class
- Raises:
ValueError – Raises an exception if the list of inputted variable hierarchies includes hierarchies that have been subclassed from different superclasses.
- 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.