Building Metadata

Building Metadata#

When working with Aviary models, sometimes it is necessary to extend the Aviary-core variable hierarchy or update existing metadata. The syntax for add_meta_data and update_meta_data can be found below. For a more detailed explanation of metadata please visit this link.

aviary.utils.develop_metadata.add_meta_data(key: str, meta_data: dict, units='unitless', default_value=0.0, types=None, multivalue: bool = False, option: bool = False, desc: str = None, historical_name=None, _check_unique=True)[source]

Add new meta data associated with variables in the Aviary data hierarchy.

Parameters:
  • key (str) – Aviary variable name

  • meta_data (dict) – dictionary of meta data to add the variable to

  • units (str or None) – units of measure

  • desc (str) – brief description of the variable

  • default_value (any) –

    in context, the Aviary value assumed if the variable is missing from options and/or inputs

    Note, a default value of None indicates that the variable is optional, but that there is no default.

  • types (type, optional) – gives the allowable type(s) of the variable in the aviary API. if multivalue is True, this specifies which types individual elements in the list can be. If types is not provided, the type of default_value is used. Numerical data for default_value is assumed to be a float in this case.

  • option (bool) – indicates that this variable is an option, rather than a normal input

  • multivalue (bool) – when True, the variable can become an iterable (list, tuple, numpy array) of elements whose type is in types.

  • historical_name (dict or None) –

    dictionary of names that the variable held in prior codes

    Example: {“FLOPS”:”WTIN.WNGWT”, “LEAPS1”: “aircraft.inputs.wing_weight”, “GASP”: “INGASP.WWGHT”}

    NAMELIST nameing convention &<function_name>.<namelist_name>.<var_name>

    Example: &DEFINE.CONFIN.GW

    represents the GW variable of the CONFIN namelist as defined in the DEFINE subroutine

    COMMON block naming convention, including aliases: <block_name>.<var_name>

    Example: CONFIG.GW

    represents the GW variable of the CONFIG common block

    Local variable naming convention, including equivalence statements, parameters, and other local declarations: ~<function_name>.<var_name>

    Example: ~ANALYS.GWTOL

    represents the GWTOL variable of the ANALYS subroutine

  • _check_unique (bool) – private use only flag that tells whether to check the meta_data for the pre-existing presence of the provided key. This should only be set to false when update_meta_data is the calling function.

Returns:

No variables returned by this method.

Return type:

None

Raises:

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

aviary.utils.develop_metadata.update_meta_data(key: str, meta_data: dict, units='unitless', desc: str = None, default_value=0.0, option: bool = False, types=None, multivalue: bool = False, historical_name=None)[source]

Update existing meta data associated with variables in the Aviary data hierarchy.

Parameters:
  • key (str) – Aviary variable name

  • meta_data (dict) – dictionary of meta data to add the variable to

  • units (str or None) – units of measure

  • desc (str) – brief description of the variable

  • default_value (Any) –

    in context, the Aviary value assumed if the variable is missing from options and/or inputs

    Note, a default value of None indicates that the variable is optional, but that there is no default.

  • option (bool) – indicates that this variable is an option, rather than a normal input

  • types (type) – gives the allowable type(s) of the variable

  • multivalue (bool) – when True, the variable can become a list of elements whose type is in types. This is mainly used when there are multiple engine types.

  • historical_name (dict or None) –

    dictionary of names that the variable held in prior codes

    Example: {“FLOPS”:”WTIN.WNGWT”, “LEAPS1”: “aircraft.inputs.wing_weight”, “GASP”: “INGASP.WWGHT”}

    NAMELIST nameing convention &<function_name>.<namelist_name>.<var_name>

    Example: &DEFINE.CONFIN.GW

    represents the GW variable of the CONFIN namelist as defined in the DEFINE subroutine

    COMMON block naming convention, including aliases: <block_name>.<var_name>

    Example: CONFIG.GW

    represents the GW variable of the CONFIG common block

    Local variable naming convention, including equivalence statements, parameters, and other local declarations: ~<function_name>.<var_name>

    Example: ~ANALYS.GWTOL

    represents the GWTOL variable of the ANALYS subroutine

Returns:

No variables returned by this method.

Return type:

None

Raises:

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