pymrio.build_agg_vec

pymrio.build_agg_vec(agg_vec, **source)

Builds an combined aggregation vector considering diff classifications

This function build an aggregation vector based on the order in agg_vec. The naming and actual mapping is given in source, either explicitly or by pointing to a folder with the mapping.

Parameters
  • agg_vec (list) – A list of sector or regions to which the IOSystem shall be aggregated. The order in agg_vec is important: If a string was assigned to one specific entry it will not be overwritten if it is given in the next vector, e.g. [‘EU’, ‘OECD’] would aggregate first into EU and the remaining one into OECD, whereas [‘OECD’, ‘EU’] would first aggregate all countries into OECD and than the remaining countries into EU.

  • source (list or string) –

    Definition of the vectors in agg_vec. The input vectors (either in the file or given as list for the entries in agg_vec) must be as long as the desired output with a string for every position which should be aggregated and None for position which should not be used.

    Special keywords:

    • pathPath to a folder with concordance matrices.

      The files in the folder can have any extension but must be in text format (tab separated) with one entry per row. The last column in the file will be taken as aggregation vectors (other columns can be used for documentation). Values must be given for every entry in the original classification (string None for all values not used) If the same entry is given in source and as text file in path than the one in source will be used.

      Two special path entries are available so far:

      • ’exio2’ Concordance matrices for EXIOBASE 2.0

      • ’test’ Concordance matrices for the test IO system

      If a entry is not found in source and no path is given the current directory will be searched for the definition.

    • miss : Entry to use for missing values, default: ‘REST’

Returns

The aggregation vector

Return type

list

Examples

>>> build_agg_vec(['EU', 'OECD'], path = 'test')
['EU', 'EU', 'EU', 'OECD', 'REST', 'REST']
>>> build_agg_vec(['OECD', 'EU'], path = 'test', miss='RoW')
['OECD', 'EU', 'OECD', 'OECD', 'RoW', 'RoW']
>>> build_agg_vec(['EU', 'orig_regions'], path = 'test')
['EU', 'EU', 'EU', 'reg4', 'reg5', 'reg6']
>>> build_agg_vec(['supreg1', 'other'], path = 'test',
>>>        other = [None, None, 'other1', 'other1', 'other2', 'other2'])
['supreg1', 'supreg1', 'other1', 'other1', 'other2', 'other2']