bw2io.strategies.simapro
#
Module Contents#
Functions#
Change datasets with the string |
|
|
|
Change |
|
Drop all inputs from allocated products which had zero allocation factors. |
|
|
Flip sign on waste exchanges in imported database |
|
Link technosphere exchanges based on name, unit, and location. Can't use categories because we can't reliably extract categories from SimaPro exports, only exchanges. |
Normalize biosphere categories to ecoinvent standard. |
|
Normalize biosphere flow names to ecoinvent standard |
|
|
Convert SimaPro formulae to Python |
Make sure |
|
Create a dataset from each product in a raw SimaPro dataset |
|
Split a name like 'foo/CH U' into name and geo components. |
Attributes#
- bw2io.strategies.simapro.change_electricity_unit_mj_to_kwh(db)[source]#
Change datasets with the string
electricity
in their name from units of MJ to kilowatt hour.
- bw2io.strategies.simapro.fix_localized_water_flows(db)[source]#
Change
Water, BR
toWater
.Biosphere flows canāt have locations - locations are defined by the activity dataset.
- bw2io.strategies.simapro.fix_zero_allocation_products(db)[source]#
Drop all inputs from allocated products which had zero allocation factors.
The final production amount is the initial amount times the allocation factor. If this is zero, a singular technosphere matrix is created. We fix this by setting the production amount to one, and deleting all inputs.
Does not modify datasets with more than one production exchange.
- bw2io.strategies.simapro.flip_sign_on_waste(db, other)[source]#
Flip sign on waste exchanges in imported database
Rationale: The convention for waste exchanges in some databases, notably the ecoivent database, is the following: - waste exchanges produced by an activity are stored as negative inputs - waste exchanges flowing into a waste treatment activity have a negative In SimaPro, produced waste are stored as positive inputs, and waste treatment datasets have positive outputs. If left as are, the supply of waste treatment services from the linked-to database āotherā to imported activities would have the wrong sign. This function flips the sign on all inputs from database āotherā if the production amount for that exchange in the activity for which it is the reference flow is negative.
Note: the strategy needs to be run after matching with ecoinvent. Strategy should be run as follows: sp_imported.apply_strategy(functools.partial(flip_sign_on_waste, other=āname_of_otherā))
- bw2io.strategies.simapro.link_technosphere_based_on_name_unit_location(db, external_db_name=None)[source]#
Link technosphere exchanges based on name, unit, and location. Canāt use categories because we canāt reliably extract categories from SimaPro exports, only exchanges.
If
external_db_name
, link against a different database; otherwise link internally.
- bw2io.strategies.simapro.normalize_simapro_biosphere_categories(db)[source]#
Normalize biosphere categories to ecoinvent standard.
- bw2io.strategies.simapro.normalize_simapro_biosphere_names(db)[source]#
Normalize biosphere flow names to ecoinvent standard
- bw2io.strategies.simapro.normalize_simapro_formulae(formula, settings)[source]#
Convert SimaPro formulae to Python
- bw2io.strategies.simapro.set_lognormal_loc_value_uncertainty_safe(db)[source]#
Make sure
loc
value is correct for lognormal uncertainty distributions
- bw2io.strategies.simapro.sp_allocate_products(db)[source]#
Create a dataset from each product in a raw SimaPro dataset
- bw2io.strategies.simapro.split_simapro_name_geo(db)[source]#
Split a name like āfoo/CH Uā into name and geo components.
Sets original name to
simapro name
.