EXIOBASE 1 (developed in the fp6 project EXIOPOL), EXIOBASE 2 (outcome of the fp7 project CREEA) and EXIOBASE 3 (outcome of the fp7 project DESIRE) are available on the EXIOBASE webpage.
You need to register before you can download the full dataset.
Further information on the different EXIOBASE versions can be found in corresponding method papers.
To download EXIOBASE 1 for the use with pymrio, navigate to the EXIOBASE webpage - section(tab) "Data Download" - "EXIOBASE 1 - full dataset" and download either
pxp_ita_44_regions_coeff_txt for the product by product (pxp) MRIO system or
ixi_fpa_44_regions_coeff_txt for the industry by industry (ixi) MRIO system or
pxp_ita_44_regions_coeff_src_txt for the product by product (pxp) MRIO system with emission data per source or
ixi_fpa_44_regions_coeff_src_txt for the industry by industry (ixi) wMRIO system with emission data per source.
The links above directly lead to the required file(s), but remember that you need to be logged in to access them.
The Pymrio parser works with the compressed (zip) files as well as the unpacked files. If you want to unpack the files, make sure that you store them in different folders since they unpack in the current directory.
EXIOBASE 3 is available at the EXIOBASE webpage at the section (tab) tab "Data Download" - "EXIOBASE 2 - full dataset".
You can download either
MrIOT PxP ita coefficient version2 2 2 for the product by product (pxp) MRIO system or
MrIOT IxI fpa coefficient version2 2 2 for the industry by industry (ixi) MRIO system.
The links above directly lead to the required file(s), but remember that you need to be logged in to access them.
The pymrio parser works with the compressed (zip) files as well as the unpacked files. You can unpack the files together in one directory (unpacking creates a separate folder for each EXIOBASE 2 version). The unpacking of the PxP version also creates a folder "__MACOSX" - you can delete this folder.
EXIOBASE 3 is available at the EXIOBASE webpage at the section (tab) tab "Data Download" - "EXIOBASE 3 - monetary". The EXIOBASE 3 parser works with both, the compressed zip archives and the extracted database.
In [1]:
import pymrio
For each publically available version of EXIOBASE pymrio provides a specific parser. All exiobase parser work with the zip archive (as downloaded from the exiobase webpage) or the extracted data.
To parse EXIOBASE 1 use:
In [2]:
exio1 = pymrio.parse_exiobase1(path='/tmp/mrios/exio1/zip/121016_EXIOBASE_pxp_ita_44_regions_coeff_txt.zip')
The parameter 'path' needs to point to either the folder with the extracted EXIOBASE1 files for the downloaded zip archive.
Similarly, EXIOBASE 2 can be parsed by:
In [3]:
exio2 = pymrio.parse_exiobase2(path='/tmp/mrios/exio2/zip/mrIOT_PxP_ita_coefficient_version2.2.2.zip',
charact=True, popvector='exio2')
The additional parameter 'charact' specifies if the characterization matrix provided with EXIOBASE 2 should be used. This can be specified with True or False; in addition, a custom one can be provided. In the latter case, pass the full path to the custom characterisatio file to 'charact'.
The parameter 'popvector' allows to pass information about the population per EXIOBASE2 country. This can either be a custom vector of, if 'exio2' is passed, the one provided with pymrio.
EXIOBASE 3 can be parsed by:
In [4]:
exio3 = pymrio.parse_exiobase3(path='/tmp/mrios/exio3/zip/exiobase3.4_iot_2009_pxp.zip')
Currently, no characterization or population vectors are provided for EXIOBASE 3.
For the rest of the tutorial, we use exio2; deleting exio1 and exio3 to free some memory:
In [5]:
del exio1
del exio3
After parsing a EXIOBASE version, the handling of the database is the same as for any IO. Here we use the parsed EXIOBASE2 to explore some characteristics of the EXIBOASE system.
After reading the raw files, metadata about EXIOBASE can be accessed within the meta field:
In [6]:
exio2.meta
Out[6]:
Custom points can be added to the history in the meta record. For example:
In [7]:
exio2.meta.note("First test run of EXIOBASE 2")
exio2.meta
Out[7]:
To check for sectors, regions and extensions:
In [8]:
exio2.get_sectors()
Out[8]:
In [9]:
exio2.get_regions()
Out[9]:
In [10]:
list(exio2.get_extensions())
Out[10]:
The following command checks for missing parts in the system and calculates them. In case of the parsed EXIOBASE this includes A, L, multipliers M, footprint accounts, ..
In [11]:
exio2.calc_all()
Out[11]:
In [12]:
import matplotlib.pyplot as plt
plt.figure(figsize=(15,15))
plt.imshow(exio2.A, vmax=1E-3)
plt.xlabel('Countries - sectors')
plt.ylabel('Countries - sectors')
plt.show()
The available impact data can be checked with:
In [13]:
list(exio2.impact.get_rows())
Out[13]:
And to get for example the footprint of a specific impact do:
In [14]:
print(exio2.impact.unit.loc['global warming (GWP100)'])
exio2.impact.D_cba_reg.loc['global warming (GWP100)']
Out[14]:
In [15]:
with plt.style.context('ggplot'):
exio2.impact.plot_account(['global warming (GWP100)'], figsize=(15,10))
plt.show()
See the other notebooks for further information on aggregation and file io.