bw2io.extractors.simapro_csv#

Module Contents#

Classes#

SimaProCSVExtractor

Functions#

replace_with_lowercase(string, names)

Replace all occurrences of elements of names in string with their lowercase equivalents.

to_number(obj)

Attributes#

INTRODUCTION

SIMAPRO_END_OF_DATASETS

SIMAPRO_PRODUCTS

SIMAPRO_TECHNOSPHERE

lowercase_expression

strip_whitespace_and_delete

exception bw2io.extractors.simapro_csv.EndOfDatasets[source]#

Bases: Exception

Inheritance diagram of bw2io.extractors.simapro_csv.EndOfDatasets

Common base class for all non-exit exceptions.

Initialize self. See help(type(self)) for accurate signature.

class bw2io.extractors.simapro_csv.SimaProCSVExtractor[source]#

Bases: object

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

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)[source]#

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)[source]#

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)[source]#

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)[source]#

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)[source]#

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)[source]#

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)[source]#
classmethod read_dataset_metadata(data, index)[source]#
bw2io.extractors.simapro_csv.replace_with_lowercase(string, names)[source]#

Replace all occurrences of elements of names in string with their lowercase equivalents.

names is a list of variable name strings that should already all be lowercase.

Returns a modified string.

bw2io.extractors.simapro_csv.to_number(obj)[source]#
bw2io.extractors.simapro_csv.INTRODUCTION = Multiline-String[source]#
Show Value
"""Starting SimaPro import:
        Filepath: %s
        Delimiter: %s
        Name: %s
"""
bw2io.extractors.simapro_csv.SIMAPRO_END_OF_DATASETS[source]#
bw2io.extractors.simapro_csv.SIMAPRO_PRODUCTS[source]#
bw2io.extractors.simapro_csv.SIMAPRO_TECHNOSPHERE[source]#
bw2io.extractors.simapro_csv.lowercase_expression = '(?:^|[^a-zA-Z_])(?P<variable>{})(?:[^a-zA-Z_]|$)'[source]#
bw2io.extractors.simapro_csv.strip_whitespace_and_delete[source]#