-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbioticDepletion.py
35 lines (26 loc) · 1.05 KB
/
AbioticDepletion.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 6 19:53:03 2020
@author: msmsa
"""
import pandas as pd
from ast import literal_eval
from brightway2 import *
def import_aibiotic_depletion():
Data = pd.read_excel('AbioticDepletion.xlsx')
project = "Compost_use"
projects.set_current(project)
db = Database("biosphere3")
Data['N'] = 0
Data['key'] = None
for i in Data.index:
subset=db.search(Data['Flow2'][i])
for act in subset:
if act.as_dict()['categories'][0] == 'natural resource' and act.as_dict()['name'] == Data['Flow2'][i]:
Data.loc[i,'N'] +=1
Data.loc[i,'key'] = str(act.key)
CF = []
for i in Data.index:
CF.append((literal_eval(Data['key'][i]), Data['Factor2'][i]))
Method(('CML (v4.4, 2015)', 'resources', 'depletion of abiotic resources - elements, ultimate reserves')).register()
Method(('CML (v4.4, 2015)', 'resources', 'depletion of abiotic resources - elements, ultimate reserves')).write(CF)