bw2io.extractors#

Submodules#

Package Contents#

Classes#

CSVExtractor

Ecospold1DataExtractor

Ecospold1LCIAExtractor

Extract impact assessment methods and weightings data from ecospold XML format.

Ecospold2DataExtractor

ExcelExtractor

ExiobaseDataExtractor

SimaProCSVExtractor

SimaProLCIACSVExtractor

class bw2io.extractors.CSVExtractor[source]#

Bases: object

classmethod extract(filepath, encoding='utf-8-sig')#
class bw2io.extractors.Ecospold1DataExtractor[source]#

Bases: object

classmethod extract(path, db_name, use_mp=True)#
classmethod is_valid_ecospold1(dataset)#
classmethod process_allocation(exc, dataset)#
classmethod process_dataset(dataset, filename, db_name)#
classmethod process_exchange(exc, dataset)#

Process exchange.

Input groups are:

  1. Materials/fuels

  2. Electricity/Heat

  3. Services

  4. FromNature

  5. FromTechnosphere

Output groups are:

  1. Reference product

  2. Include avoided product system

  3. Allocated byproduct

  4. Waste to treatment

  5. ToNature

A single-output process will have one output group 0; A MO process will have multiple output group 2s. Output groups 1 and 3 are not used in ecoinvent.

classmethod process_exchanges(dataset)#
classmethod process_file(filepath, db_name)#
classmethod process_uncertainty_fields(exc, data)#
class bw2io.extractors.Ecospold1LCIAExtractor[source]#

Bases: object

Extract impact assessment methods and weightings data from ecospold XML format.

classmethod extract(path)#
classmethod parse_cf(cf)#
classmethod parse_method(ds, filepath)#
class bw2io.extractors.Ecospold2DataExtractor[source]#

Bases: object

classmethod abort_exchange(exc, comment=None)#
classmethod condense_multiline_comment(element)#
classmethod extract(dirpath, db_name, use_mp=True)#
classmethod extract_activity(dirpath, filename, db_name)#
classmethod extract_exchange(exc)#

Process exchange.

Input groups are:

  1. Materials/fuels

  2. Electricity/Heat

  3. Services

  4. From environment (elementary exchange only)

  5. FromTechnosphere

Output groups are:

0. ReferenceProduct 2. By-product 3. MaterialForTreatment 4. To environment (elementary exchange only) 5. Stock addition

classmethod extract_parameter(exc)#
classmethod extract_properties(exc)#
classmethod extract_technosphere_metadata(dirpath)#
classmethod extract_uncertainty_dict(obj)#
class bw2io.extractors.ExcelExtractor[source]#

Bases: object

classmethod extract(filepath)#
classmethod extract_sheet(wb, name, strip=True)#
class bw2io.extractors.ExiobaseDataExtractor[source]#

Bases: object

classmethod _check_dir(path)#
classmethod _extract_csv(path, filename, materials=False)#
classmethod _extract_metadata(path)#
classmethod _generate_csv(path, filename)#
classmethod extract(path)#
class bw2io.extractors.SimaProCSVExtractor[source]#

Bases: object

classmethod create_distribution(amount, kind, field1, field2, field3)#
classmethod extract(filepath, delimiter=';', name=None, encoding='cp1252')#
classmethod get_global_parameters(data, pm)#
classmethod get_next_process_index(data, index)#
classmethod get_project_metadata(data)#
classmethod get_project_name(data)#
classmethod invalid_uncertainty_data(amount, kind, field1, field2, field3)#
classmethod parse_biosphere_flow(line, category, pm)#

Parse biosphere flow line.

  1. name

  2. subcategory

  3. unit

  4. value or formula

  5. uncertainty type

  6. uncert. param.

  7. uncert. param.

  8. uncert. param.

  9. comment

However, sometimes the value is in index 2, and the unit in index 3. Because why not! We assume default ordering unless we find a number in index 2.

classmethod parse_calculated_parameter(line, pm)#

Parse line in Calculated parameters section.

  1. name

  2. formula

  3. comment

Can include multiline comment in TSV.

classmethod parse_final_waste_flow(line, pm)#

Parse final wate flow line.

0: name 1: subcategory? 2: unit 3. value or formula 4. uncertainty type 5. uncert. param. 6. uncert. param. 7. uncert. param.

However, sometimes the value is in index 2, and the unit in index 3. Because why not! We assume default ordering unless we find a number in index 2.

classmethod parse_input_line(line, category, pm)#

Parse technosphere input line.

  1. name

  2. unit

  3. value or formula

  4. uncertainty type

  5. uncert. param.

  6. uncert. param.

  7. uncert. param.

  8. comment

However, sometimes the value is in index 1, and the unit in index 2. Because why not! We assume default ordering unless we find a number in index 1.

classmethod parse_input_parameter(line)#

Parse line in Input parameters section.

  1. name

  2. value (not formula)

  3. uncertainty type

  4. uncert. param.

  5. uncert. param.

  6. uncert. param.

  7. hidden (β€œYes” or β€œNo” - we ignore)

  8. comment

classmethod parse_reference_product(line, pm)#

Parse reference product line.

  1. name

  2. unit

  3. value or formula

  4. allocation

  5. waste type

  6. category (separated by )

  7. comment

However, sometimes the value is in index 1, and the unit in index 2. Because why not! We assume default ordering unless we find a number in index 1.

classmethod parse_waste_treatment(line, pm)#

Parse reference product line.

  1. name

  2. unit

  3. value or formula

  4. waste type

  5. category (separated by )

  6. comment

classmethod read_data_set(data, index, db_name, filepath, gp, pm)#
classmethod read_dataset_metadata(data, index)#
class bw2io.extractors.SimaProLCIACSVExtractor[source]#

Bases: object

classmethod extract(filepath, delimiter=';', encoding='cp1252')#
classmethod get_all_cfs(nw_data, category_data)#
classmethod get_category_data(data, index)#
classmethod get_damage_category_data(data, index)#
classmethod get_damage_exchanges(damage_data, category_data)#
classmethod get_next_method_index(data, index)#
classmethod get_normalization_weighting_data(data, index)#
classmethod parse_cf(line)#

Parse line in Substances section.

  1. category

  2. subcategory

  3. flow

  4. CAS number

  5. CF

  6. unit

classmethod read_metadata(data, index)#
classmethod read_method_data_set(data, index, filepath)#
classmethod skip_to_section_end(data, index)#