-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ab0060
commit f3a560d
Showing
2 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,41 @@ | ||
# CCU-LCA | ||
Code used in the scientific article: Consequential life cycle assessment of carbon capture and utilization technologies within the chemical industry | ||
|
||
## Description | ||
|
||
This is the code used in the analysis presented in: | ||
|
||
_Thonemann N and Pizzol M, Consequential life cycle assessment of carbon capture and utilization technologies within the chemical industry, Energy & Environmental Science (under review),_ [doi to be added](). | ||
|
||
The supplementary materials to the article include the raw data: | ||
|
||
- inventory tables: `CU-UA_MCS_nt.csv` and `CCU-UA_MCS_lt.csv` | ||
- results of the Monte Carlo simulation `CU-UA_MCS_nt.csv`, `CU-UA_MCS_lt.csv` | ||
|
||
|
||
These are needed to run the scripts contained in this repository, for example if you want to reproduce the results of the paper. If you don't have access to the article or the files, you can get them from me directly, please send a request to [[email protected]](mailto:[email protected]) | ||
|
||
|
||
##The repository includes: | ||
|
||
`CCU_2018_final_version.ipynb` (and `CCU_2018_final_version.py`) Python script to reproduce results of the LCA using the brightway2 LCA software. Imports the inventory in, performs LCA calculations and exports LCIA results, runs comparative Monte Carlo for the global warming impact category and exports results. | ||
|
||
`CCU_plots.R` R script used in generating the plots of the paper. | ||
|
||
`CCU_Stat_analysis.R` R script with the statistical analysis of Monte Carlo results, mainly generating descriptive statistics and doing pairwise testing of different alternatives. | ||
|
||
`lci_to_bw2.py` A little python script to import inventory tables in .csv directly into brightway2. | ||
|
||
**Please get in touch** if you find any mistake or problem in running these scripts. | ||
|
||
##DOI and versions | ||
|
||
Version identifier: | ||
DOI [to be added]() | ||
|
||
You can cite all versions by using the DOI [to be added](). This DOI represents all versions, and will always resolve to the latest one. | ||
|
||
## Cite as | ||
|
||
Pleas cite the specific version, for example for version 1.0: | ||
|
||
_Massimo Pizzol. (2019, Month Day). massimopizzol/CCU-LCA: First release (Version 1.0). Zenodo. http://doi.org/xxxx_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Thu Aug 31 15:21:32 2017 | ||
@author: massimo | ||
""" | ||
|
||
|
||
import pandas as pd | ||
import numpy as np | ||
|
||
def lci_to_bw2(mydb): | ||
'''A function to convert a pd.Dataframe to a dict | ||
to be used as database in bw2''' | ||
|
||
act_keys_raw = list(mydb.columns[0:5]) | ||
act_keys_bw2 = [i.replace('Activity ','') for i in act_keys_raw] | ||
|
||
exc_keys_raw = list(mydb.columns[5:]) | ||
exc_keys_bw2 = [i.replace('Exchange ','') for i in exc_keys_raw] | ||
|
||
def exc_to_dict(df_data, some_list): | ||
exc_data = (pd.DataFrame(list(df_data.values), index = list(exc_keys_bw2))).T | ||
exc_data = exc_data.dropna(axis=1, how='any') # remove columns withouth the data | ||
e_values = (exc_data.values).tolist()[0] | ||
e_values = [(e_values[0],e_values[1])] + e_values[2:] | ||
some_list.append(dict(zip(list(exc_data.columns)[1:], e_values))) | ||
|
||
def act_to_dict(act_data): | ||
a_keys = act_keys_bw2[2:] + ['exchanges'] | ||
return dict(zip(a_keys, act_data)) | ||
|
||
def bio_to_dict(bio_data): | ||
b_keys = act_keys_bw2[2:] | ||
return dict(zip(b_keys, bio_data)) | ||
|
||
|
||
db_keys = [] | ||
db_values =[] | ||
|
||
for act in mydb['Activity name'].unique(): | ||
|
||
sel = mydb[mydb['Activity name'] == act] | ||
db_key = (list(sel['Activity database'])[0], list(sel['Activity code'])[0]) | ||
db_keys.append(db_key) | ||
|
||
if list(sel['Activity type'].unique())[0] == 'biosphere': | ||
|
||
my_bio_data = list(sel.iloc[0,2:5].values) | ||
db_value = bio_to_dict(my_bio_data) | ||
db_values.append(db_value) | ||
|
||
else: | ||
my_exc = [] | ||
for i in range(sel.shape[0]): | ||
exc_to_dict(sel.iloc[i,5:],my_exc) | ||
|
||
my_act_data = list(sel.iloc[0,2:5].values) + [my_exc] | ||
db_value = act_to_dict(my_act_data) | ||
db_values.append(db_value) | ||
|
||
|
||
bw2_db = dict(zip(db_keys, db_values)) | ||
|
||
return bw2_db # We have a dict to be used as database. Perfect. |