library(PlotSvalbard)
basemap("panarctic", limits = 60, bathymetry = TRUE, land.border.col = "red", land.col = "green1",
label.offset = 1.1, label.font = 10, base_size = 13, bathy.size = 0.5)Four levels of LCA Framework:
LCA can be expressed in a single formula: \[\mathrm{h = CBA^{-1}f}\]
where:
Therefore,
\[\mathrm{h_{process} = CB~diag(A^{-1}f)}\]
\[\mathrm{h_{stressor} = C~diag(BA^{-1}f)}\]
\[\mathrm{h_{category} = diag(C)~B~diag(A^{-1}f)}\]
Brightway2 is a open source framework for life cycle assessment (LCA) developed with Python. Brightway2 main package includes functionalities of :
The country converter (coco) is a Python package to convert and match country names between different classifications and between different naming versions. Internally it uses regular expressions to match country names. Coco can also be used to build aggregation concordance matrices between different classification schemes.
MRIOLab suite: Virtual laboratories and MRIO analysis – an introduction. Compilation and operation of large-scale multi-regional input–output (MRIO) databases within virtual laboratories (VLs)
Cardellini et al. (2018)
Steubing et al. (2020)
sourced from Brightway2
sourced from Brightway2
sourced from Brightway2
from brightway2 import *
import numpy as np
import random
projects.set_current("databases demo")
db = Database("example")
example_data = {
("example", "A"): {
"name": "A",
"exchanges": [{
"amount": 1.0,
"input": ("example", "B"),
"type": "technosphere"
}],
'unit': 'kilogram',
'location': 'here',
'categories': ("very", "interesting")
},
("example", "B"): {
"name": "B",
"exchanges": [],
'unit': 'microgram',
'location': 'there',
'categories': ('quite', 'boring')
}
}
db.write(example_data)
db.random()
num_exchanges = [(activity, len(activity.exchanges())) for activity in db]
num_exchanges
db.search("*")from brightway2 import *
if "Calculation setups" not in projects:
projects.set_current("BW2 introduction")
projects.copy_project("Calculation setups")
else:projects.set_current("Calculation setups")
import random
functional_units = [{Database('forwast').random(): 1} for _ in range(20)]
#
# all_forwast_flows = {exc.input for ds in Database("forwast") for exc in ds.biosphere()}
# suitable_methods = [method
# for method in methods
# if {cf[0] for cf in Method(method).load()}.intersection(all_forwast_flows)]
#
# print("Can use {} of {} LCIA methods".format(len(suitable_methods), len(methods)))
# chosen_methods = random.sample(suitable_methods, 8)
# import numpy as np
scenario_array = np.array(
[
1, # New value for exchange between ('bd1', 'a2') and ('bd1', 'b')
0 # New value for exchange between ('bd1', 'a1') and ('bd1', 'b')
]).reshape(-1, 1)
scenario_indices = [
(('bd1', 'a2'), ('bd1', 'b'), 'technosphere'),
(('bd1', 'a1'), ('bd1', 'b'), 'technosphere')
]
scenario_matrix_data = [(scenario_array, scenario_indices, 'technosphere')]
scenario_matrix_data
[(array([[1],
[0]]), [(('bd1', 'a2'), ('bd1', 'b'), 'technosphere'), (('bd1', 'a1'), ('bd1', 'b'), 'technosphere')], 'technosphere')]