IndEcol / pymrio

Multi-Regional Input-Output Analysis in Python.
http://pymrio.readthedocs.io/en/latest/
Other
163 stars 73 forks source link

Pymrio is Exiobase 3 ready? #22

Closed cfrancois7 closed 6 years ago

cfrancois7 commented 6 years ago

I would like to know if Exiobase 3 is ready to use. And if no, when it'll be available? For the moment I use pandas manually, but it is less convenient than the pymrio object.

konstantinstadler commented 6 years ago

EXIOBASE 3 is available here: http://exiobase.eu/

If you are using (or interested) in #EXIOBASE consider joining our Google group which features announcements and detailed updates/bug fix descriptions: https://groups.google.com/forum/m/#!forum/exiobase-announcements

You can use pymrio for analysing EXIOBASE 3. There is no designated load_exiobase3 yet, but after extracting the EXIOBASE zip file use

import pymrio
exio = pymrio.load_all('path/to/extract')

I am currently on paternity leave - I will be back in September and than implement a proper load_exiobase3 function.

Brizga commented 6 years ago

Hi, i was trying your suggestion on Spyder, but got an error: AttributeError: module 'pymrio' has no attribute 'load_all' Best, Janis

konstantinstadler commented 6 years ago

Strange. I never work with spyder. But anyway, this should work. Load and load_all are quite basic functions in pymrio. which version are you using (pymrio.version)?

Brizga commented 6 years ago

I switched to Jupyter and it worked, but I understand that exio have different parameters. I have to substitute IMPACTS with SATELLITE. As the results of print(exio.satellite.unit.loc['CO2 - combustion - air']) exio.satellite.D_cba_reg.loc['CO2 - combustion - air'] I got zeros. I guess its becouse population data is not loaded.

Brizga commented 6 years ago

Thanks a lot for the exiobase3 parser and updates. But I am still getting 0s when calculating footprints, e.g.

The total footprints of a region

exio3.CO2_diag.D_cba.sum(axis=0) Do you what could be the problem?

konstantinstadler commented 6 years ago

Seems to be something wrong with the calculation of the accounts. I am checking it

konstantinstadler commented 6 years ago

There is a mixup of region names in some years of the EXIOBASE 3 files. I will fix that in the parser:

Index(['AUT', 'BEL', 'BGR', 'CYP', 'CZE', 'DEU', 'DNK', 'EST', 'ESP', 'FIN', 'FRA', 'GRC', 'HRV', 'HUN', 'IRL', 'ITA', 'LTU', 'LUX', 'LVA', 'MLT', 'NLD', 'POL', 'PRT', 'ROM', 'SWE', 'SVN', 'SVK', 'GBR', 'USA', 'JPN', 'CHN', 'CAN', 'KOR', 'BRA', 'IND', 'MEX', 'RUS', 'AUS', 'CHE', 'TUR', 'TWN', 'NOR', 'IDN', 'ZAF', 'WWA', 'WWL', 'WWE', 'WWF', 'WWM'], dtype='object', name='region') i

Brizga commented 6 years ago

OK, thanks. I have tried most of the years and none of them worked for me.

konstantinstadler commented 6 years ago

Its a specific ixi thing - pxp should work. But it will be fixed soon - stay tuned

konstantinstadler commented 6 years ago

Ok, the new version 0.3.8 should fix that. The EXIOBASE 3 parser automatically renames the names to be consistent. Please let me know if there are any other problems

Brizga commented 5 years ago

Hi, I have one more question about the Exiobase 3 calculations: to my knowledge PROD + IMP must equal CONS + EXP. But in my calculations, they don't fit together. The code i was using is very simple: import pymrio exio3 = pymrio.parse_exiobase3 (path=r'C:\tmp\mrios\exio3\1995') exio3.calc_all() writer = pd.ExcelWriter(r'C:/tmp/mrios/exio3/forest1995.xlsx', engine='xlsxwriter') exio3.satellite.D_cba.loc['Forest area - Forestry'].to_excel(writer, sheet_name='con') exio3.satellite.D_imp.loc['Forest area - Forestry'].to_excel(writer, sheet_name='imp') exio3.satellite.D_pba.loc['Forest area - Forestry'].to_excel(writer, sheet_name='pro') exio3.satellite.D_exp.loc['Forest area - Forestry'].to_excel(writer, sheet_name='exp')

maybe you have an explanation for this. Thanks, Janis