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, meta_data, units='unitless', desc=None, default_value=0.0, option=False, types=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.

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

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

  • 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, meta_data, units='unitless', desc=None, default_value=0.0, option=False, types=None, 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

  • 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.