-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
brightway2 export working - incl. graph traversal!
- Loading branch information
1 parent
a6d0cac
commit 82b7555
Showing
77 changed files
with
20,662 additions
and
1,308 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,36 @@ | ||
from lcopt.io import exchange_factory | ||
from copy import deepcopy | ||
|
||
class Bw2Exporter(): | ||
|
||
def __init__(self, modelInstance): | ||
self.modelInstance = modelInstance | ||
|
||
def export_to_bw2(self): | ||
|
||
db = self.modelInstance.database['items'] | ||
name = self.modelInstance.database['name'] | ||
|
||
altbw2database = deepcopy(db) | ||
|
||
products = list(filter(lambda x: altbw2database[x]['type']=='product', altbw2database)) | ||
processes = list(filter(lambda x: altbw2database[x]['type']=='process', altbw2database)) | ||
|
||
|
||
for p in products: | ||
product = altbw2database[p] | ||
product['type'] = 'process' | ||
new_exchanges = [x for x in product['exchanges'] if x['type']!='production'] | ||
product['exchanges']=new_exchanges | ||
|
||
#add external links | ||
if 'ext_link' in product.keys(): | ||
product['exchanges'].append(exchange_factory(product['ext_link'], 'technosphere', 1, 1, 'external link to {}'.format(product['ext_link'][0]))) | ||
|
||
for p in processes: | ||
process = altbw2database[p] | ||
for e in process['exchanges']: | ||
if e['type'] == 'production': | ||
e['type'] = 'technosphere' | ||
|
||
return name, altbw2database |
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
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
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
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
.bs-example { | ||
font-family: sans-serif; | ||
position: relative; | ||
margin: 100px; | ||
} | ||
.typeahead, .tt-query, .tt-hint { | ||
border: 2px solid #CCCCCC; | ||
border-radius: 8px; | ||
font-size: 22px; /* Set input font size */ | ||
height: 30px; | ||
line-height: 30px; | ||
outline: medium none; | ||
padding: 8px 12px; | ||
width: 396px; | ||
} | ||
.typeahead { | ||
background-color: #FFFFFF; | ||
} | ||
.typeahead:focus { | ||
border: 2px solid #0097CF; | ||
} | ||
.tt-query { | ||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset; | ||
} | ||
.tt-hint { | ||
color: #999999; | ||
} | ||
.tt-menu { | ||
background-color: #FFFFFF; | ||
border: 1px solid rgba(0, 0, 0, 0.2); | ||
border-radius: 8px; | ||
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); | ||
margin-top: 12px; | ||
padding: 8px 0; | ||
width: 422px; | ||
} | ||
|
||
.tt-header { | ||
font-size: 22px; /* Set suggestion dropdown font size */ | ||
color: darkgrey; | ||
padding: 3px 20px; | ||
} | ||
.tt-header p { | ||
margin: 0; | ||
} | ||
.tt-footer { | ||
font-size: 22px; /* Set suggestion dropdown font size */ | ||
padding: 3px 20px; | ||
cursor: pointer; | ||
} | ||
.tt-footer p { | ||
margin: 0; | ||
} | ||
|
||
.tt-suggestion { | ||
font-size: 22px; /* Set suggestion dropdown font size */ | ||
padding: 3px 20px; | ||
} | ||
.tt-suggestion:hover { | ||
cursor: pointer; | ||
background-color: #0097CF; | ||
color: #FFFFFF; | ||
} | ||
.tt-suggestion p { | ||
margin: 0; | ||
} |
Oops, something went wrong.