improver.utilities.copy_metadata module#
- class CopyMetadata(attributes=[], aux_coord=[])[source]#
Bases:
BasePluginCopy attribute or auxilary coordinate values from template_cube to cube, overwriting any existing values.
- __init__(attributes=[], aux_coord=[])[source]#
Initialise the plugin with a list of attributes to copy.
- Parameters:
attributes (
List) – List of names of attributes to copy. If any are not present on template_cube, a KeyError will be raised.aux_coord (
List) – List of names of auxilary coordinates to copy. If any are not present on template_cube, a KeyError will be raised. If the aux_coord is already present in the cube, it will be overwritten.
- _abc_impl = <_abc._abc_data object>#
- find_common_attributes(cubes, attributes)[source]#
Find the common attribute values between the cubes. If the attribute is history, the most recent value will be returned.
- Parameters:
- Return type:
- Returns:
A dictionary of common attributes.
- Raises:
ValueError – If the attribute is not found in any of the template cubes
ValueError – If the attribute has different values in the provided template cubes.
- static get_most_recent_history(datelist)[source]#
Gets the most recent history attribute from the list of provided dates.
- process(*cubes)[source]#
Copy attribute or auxilary coordinate values from template_cube to cube, overwriting any existing values. If the history attribute is present in the list of requested attributes, the most recent value will be used. If an auxilary coordinate needs to be copied then all template cubes must have the auxilary coordinate present.
Operation is performed in-place on provided inputs.