bw2io.strategies.ecospold2#

Module Contents#

Functions#

add_cpc_classification_from_single_reference_product(db)

assign_single_product_as_activity(db)

create_composite_code(db)

Create composite code from activity and flow names

delete_exchanges_missing_activity(db)

Delete exchanges that weren't linked correctly by ecoinvent.

delete_ghost_exchanges(db)

Delete technosphere which can't be linked due to ecoinvent errors.

delete_none_synonyms(db)

drop_temporary_outdated_biosphere_flows(db)

Drop biosphere exchanges which aren't used and are outdated

es2_assign_only_product_with_amount_as_reference_product(db)

If a multioutput process has one product with a non-zero amount, assign that product as reference product.

fix_ecoinvent_flows_pre35(db)

fix_unreasonably_high_lognormal_uncertainties(db[, ...])

Fix unreasonably high uncertainty values.

link_biosphere_by_flow_uuid(db[, biosphere])

link_internal_technosphere_by_composite_code(db)

Link internal technosphere inputs by code.

remove_uncertainty_from_negative_loss_exchanges(db)

Remove uncertainty from negative lognormal exchanges.

remove_unnamed_parameters(db)

Remove parameters which have no name. They can't be used in formulas or referenced.

remove_zero_amount_coproducts(db)

Remove coproducts with zero production amounts from exchanges

remove_zero_amount_inputs_with_no_activity(db)

Remove technosphere exchanges with amount of zero and no uncertainty.

set_lognormal_loc_value(db)

Make sure loc value is correct for lognormal uncertainty distributions

bw2io.strategies.ecospold2.add_cpc_classification_from_single_reference_product(db)[source]#
bw2io.strategies.ecospold2.assign_single_product_as_activity(db)[source]#
bw2io.strategies.ecospold2.create_composite_code(db)[source]#

Create composite code from activity and flow names

bw2io.strategies.ecospold2.delete_exchanges_missing_activity(db)[source]#

Delete exchanges that weren’t linked correctly by ecoinvent.

These exchanges are missing the “activityLinkId” attribute, and the flow they want to consume is not produced as the reference product of any activity. See the known data issues report.

bw2io.strategies.ecospold2.delete_ghost_exchanges(db)[source]#

Delete technosphere which can’t be linked due to ecoinvent errors.

A ghost exchange is one which links to a combination of activity and flow which aren’t provided in the database.

bw2io.strategies.ecospold2.delete_none_synonyms(db)[source]#
bw2io.strategies.ecospold2.drop_temporary_outdated_biosphere_flows(db)[source]#

Drop biosphere exchanges which aren’t used and are outdated

bw2io.strategies.ecospold2.es2_assign_only_product_with_amount_as_reference_product(db)[source]#

If a multioutput process has one product with a non-zero amount, assign that product as reference product.

This is by default called after remove_zero_amount_coproducts, which will delete the zero-amount coproducts in any case. However, we still keep the zero-amount logic in case people want to keep all coproducts.

bw2io.strategies.ecospold2.fix_ecoinvent_flows_pre35(db)[source]#
bw2io.strategies.ecospold2.fix_unreasonably_high_lognormal_uncertainties(db, cutoff=2.5, replacement=0.25)[source]#

Fix unreasonably high uncertainty values.

With the default cutoff value of 2.5 and a median of 1, the 95% confidence interval has a high to low ratio of 20.000.

Link internal technosphere inputs by code.

Only links to process datasets actually in the database document.

bw2io.strategies.ecospold2.remove_uncertainty_from_negative_loss_exchanges(db)[source]#

Remove uncertainty from negative lognormal exchanges.

There are 15699 of these in ecoinvent 3.3 cutoff.

The basic uncertainty and pedigree matrix are applied rather blindly, and the can produce strange net production values. It makes much more sense to assume that these loss factors are static.

Only applies to exchanges which decrease net production.

bw2io.strategies.ecospold2.remove_unnamed_parameters(db)[source]#

Remove parameters which have no name. They can’t be used in formulas or referenced.

bw2io.strategies.ecospold2.remove_zero_amount_coproducts(db)[source]#

Remove coproducts with zero production amounts from exchanges

bw2io.strategies.ecospold2.remove_zero_amount_inputs_with_no_activity(db)[source]#

Remove technosphere exchanges with amount of zero and no uncertainty.

Input exchanges with zero amounts are the result of the ecoinvent linking algorithm, and can be safely discarded.

bw2io.strategies.ecospold2.set_lognormal_loc_value(db)[source]#

Make sure loc value is correct for lognormal uncertainty distributions