REGISTER NOW: DdS Autumn School! 🇨🇭 Grosshöchstetten (Switzerland) 🗓️ 6.-11. October 2024

bw2io.strategies#

Submodules#

Package Contents#

Functions#

add_activity_hash_code(data)

Add 'code' field to characterization factors using 'activity_hash', if 'code' not already present.

add_cpc_classification_from_single_reference_product(db)

Add CPC classification to a dataset's classifications if it has only one

add_database_name(db, name)

Adds a database name to each dataset in a list of datasets.

assign_only_product_as_production(db)

Assign only product as reference product.

assign_single_product_as_activity(db)

Assign the activity of a dataset to the 'activity' field of the production

change_electricity_unit_mj_to_kwh(db)

Change datasets with the string "electricity" in their name from units of MJ to kilowatt hour.

clean_integer_codes(data)

Convert integer activity codes to strings and delete integer codes from exchanges.

convert_activity_parameters_to_list(data)

"

convert_uncertainty_types_to_integers(db)

Convert uncertainty types in a list of datasets to integers.

create_composite_code(db)

Generate a composite code for each dataset in the given database using the

csv_add_missing_exchanges_section(data)

Add an empty exchanges section to any dictionary in data that doesn't already have one.

csv_drop_unknown(data)

Remove any keys whose values are (Unknown).

csv_numerize(data)

Convert string values to float or int where possible

csv_restore_booleans(data)

Convert boolean-like strings to booleans where possible.

csv_restore_tuples(data)

Convert tuple-like strings to actual tuples.

delete_exchanges_missing_activity(db)

Remove exchanges that are missing the "activityLinkId" attribute and have

delete_ghost_exchanges(db)

Remove ghost exchanges from the given database. A ghost exchange is one

delete_integer_codes(data)

Delete integer codes from the input data dictionary.

delete_none_synonyms(db)

Remove None values from the 'synonyms' list of each dataset.

drop_falsey_uncertainty_fields_but_keep_zeros(db)

Drop uncertainty fields that are falsey (e.g. '', None, False) but keep zero and NaN.

drop_temporary_outdated_biosphere_flows(db)

Removes exchanges with specific temporary biosphere flow names from the

drop_unlinked(db)

Remove all exchanges in a given database that don't have inputs.

drop_unlinked_cfs(data)

Drop characterization factors (CFs) that don't have an 'input' attribute.

drop_unspecified_subcategories(db)

Drop subcategories if they are in the following:

ensure_categories_are_tuples(db)

Convert dataset categories to tuples in the given database, if they are not already tuples.

es1_allocate_multioutput(data)

This strategy allocates multioutput datasets to new datasets.

es2_assign_only_product_with_amount_as_reference_product(db)

If a multioutput process has one product with a non-zero amount, this

fix_ecoinvent_flows_pre35(db)

Apply the 'fix-ecoinvent-flows-pre-35' migration to the given database if

fix_localized_water_flows(db)

Change water flows with location information to generic water flows.

fix_unreasonably_high_lognormal_uncertainties(db[, ...])

Replace unreasonably high lognormal uncertainties in the given database

fix_zero_allocation_products(db)

Fix datasets with a single production exchange and zero allocation factors.

json_ld_add_activity_unit(db)

Add units to activities in the given database from their reference products.

json_ld_add_products_as_activities(db, products)

"

json_ld_allocate_datasets(db[, preferred_allocation])

Perform allocation on multifunctional datasets in a given database according to the specified allocation method.

json_ld_convert_unit_to_reference_unit(db)

Convert the units in the given database to their reference units and simplify the format.

json_ld_fix_process_type(db)

Fix process type information in the given database.

json_ld_get_activities_list_from_rawdata(data)

Return a list of processes from raw data.

json_ld_get_normalized_exchange_locations(data)

Normalize exchange location strings to match those given in the process or the master metadata.

json_ld_get_normalized_exchange_units(data)

Normalize the unit strings in the exchanges to match the Brightway units.

json_ld_label_exchange_type(db)

Add exchange type labels to each exchange in a given life cycle inventory represented as a list of activities and their exchanges.

json_ld_lcia_add_method_metadata(data)

Add metadata of the Life Cycle Impact Assessment (LCIA) method to the corresponding impact categories.

json_ld_lcia_convert_to_list(data)

Convert the Life Cycle Impact Assessment (LCIA) categories in the given data to a list.

json_ld_lcia_reformat_cfs_as_exchanges(data)

Reformat the impact factors of Life Cycle Impact Assessment (LCIA) methods as exchanges.

json_ld_lcia_set_method_metadata(data)

Update the metadata of Life Cycle Impact Assessment (LCIA) methods in the given data.

json_ld_location_name(db)

Update location information in the given database.

json_ld_prepare_exchange_fields_for_linking(db)

Update exchange information in the given database to prepare for linking.

json_ld_remove_fields(db)

Remove specified fields from the given database.

json_ld_rename_metadata_fields(db)

Change metadata field names in the given database to match the Brightway schema.

link_biosphere_by_flow_uuid(db[, biosphere])

Link the exchanges in the given list of datasets to the specified

link_internal_technosphere_by_composite_code(db)

Link internal technosphere inputs in the database by their composite code.

link_iterable_by_fields(unlinked[, other, fields, ...])

Link objects in unlinked to objects in other using fields fields.

link_technosphere_based_on_name_unit_location(db[, ...])

Link technosphere exchanges based on name, unit, and location.

link_technosphere_by_activity_hash(db[, ...])

Link technosphere exchanges using the activity_hash function.

match_subcategories(data, biosphere_db_name[, remove])

Add CFs for biosphere flows with the same top-level categories as a given characterization.

migrate_datasets(db, migration)

migrate_exchanges(db, migration)

normalize_biosphere_categories(db[, lcia])

Normalize biosphere categories to ecoinvent 3.1 standard in the given database.

normalize_biosphere_names(db[, lcia])

Normalize biosphere flow names to ecoinvent 3.1 standard in the given database.

normalize_simapro_biosphere_categories(db)

Normalize biosphere categories in a dataset to the ecoinvent standard.

normalize_simapro_biosphere_names(db)

Normalize biosphere flow names in a dataset to the ecoinvent standard.

normalize_units(db)

Normalize units in datasets and their exchanges.

remove_random_exchanges(data[, fraction])

Remove most inputs to make the US EEIO have a structure more like other LCA databases

remove_uncertainty_from_negative_loss_exchanges(db)

Address cases where basic uncertainty and pedigree matrix are applied blindly,

remove_unnamed_parameters(db)

Iterate through datasets in the given database and remove unnamed parameters

remove_useeio_products(data)

Remove products from US EEIO and collapse to only activities

remove_zero_amount_coproducts(db)

Iterate through datasets in the given database. Filter out coproducts with

remove_zero_amount_inputs_with_no_activity(db)

Filter out technosphere exchanges with zero amounts and no uncertainty from

reparametrize_lognormal_to_agree_with_static_amount(db)

For lognormal distributions, choose the mean of the underlying normal distribution

set_biosphere_type(data)

Set characterization factor (CF) types to 'biosphere' for compatibility with LCI strategies.

set_code_by_activity_hash(db[, overwrite])

Set the dataset code for each dataset in the given database using activity_hash.

set_lognormal_loc_value(db)

Ensure loc value is correct for lognormal uncertainty distributions.

sp_allocate_products(db)

Allocate products in a SimaPro dataset by creating a separate dataset for each product.

split_exchanges(data, filter_params, changed_attributes)

Split unlinked exchanges in data which satisfy filter_params into new exchanges with changed attributes.

split_simapro_name_geo(db)

Split a name like 'foo/CH U' into name and geo components in a dataset.

strip_biosphere_exc_locations(db)

Remove locations from biosphere exchanges in the given database, as biosphere exchanges are not geographically specific.

tupleize_categories(db)

Convert the "categories" fields in a given database and its exchanges to tuples.

update_ecoinvent_locations(db)

Update location names in ecoinvent database to fix inconsistencies and standardize naming.

update_social_flows_in_older_consequential(db, ...)

Update the UUIDs of specific biosphere flows with the category 'social' in older consequential datasets.