bw2io.extractors.simapro_lcia_csv#
Attributes#
Exceptions#
Common base class for all non-exit exceptions. |
Classes#
Extract data from SimaPro LCIACSV file format. |
Module Contents#
- exception bw2io.extractors.simapro_lcia_csv.EndOfDatasets[source]#
Bases:
Exception
Common base class for all non-exit exceptions.
Initialize self. See help(type(self)) for accurate signature.
- class bw2io.extractors.simapro_lcia_csv.SimaProLCIACSVExtractor[source]#
Bases:
object
Extract data from SimaPro LCIACSV file format.
- Parameters:
filepath (str) β Filepath of the SimaPro LCIACSV file.
delimiter (str, optional (default: ";")) β Delimiter used in the SimaPro LCIACSV file.
encoding (str, optional (default: "cp1252")) β Encoding of the SimaPro LCIACSV file.
- Raises:
AssertionError β If the filepath does not exist or the file is not a valid SimaPro export file.
- Returns:
List of datasets extracted from the SimaPro LCIACSV file.
- Return type:
list
- classmethod get_all_cfs(nw_data, category_data)[source]#
Get all CFs from nw_data and category_data.
- Parameters:
nw_data (list) β A list of tuples containing normalization-weighting (NW) set names and scales.
category_data (list) β A list of tuples containing impact category names, units, and CF data.
- Returns:
A list of all CFs.
- Return type:
list
- classmethod get_category_data(data, index)[source]#
Parse impact category data and return its name, unit, and data.
- Parameters:
data (list of lists) β A list of lists with the data for all categories
index (int) β The index of the current impact category in the list
- Returns:
A tuple with the name, unit, and data for the impact category
- Return type:
tuple
- classmethod get_damage_category_data(data, index)[source]#
Parse damage category data and return the name, unit, and data of the category.
- Parameters:
data (list of lists) β A list of lists with the data of the damage categories
index (int) β The index of the current damage category in the list
- Returns:
A tuple with the name, unit, and data for the damage category
- Return type:
tuple
- classmethod get_damage_exchanges(damage_data, category_data)[source]#
Calculate the damage exchanges based on damage data and category data.
- Parameters:
damage_data (list of tuples) β A list of tuples containing the name and scale of the damage
category_data (list of tuples) β A list of tuples containing the name, unit, and data of each impact category
- Returns:
A list of dictionaries with the calculated damage exchanges of each impact category
- Return type:
list of dictionaries
- classmethod get_next_method_index(data, index)[source]#
Find the index of the next βMethodβ in the given data starting from the specified index, skipping any sections specified in SKIPPABLE_SECTIONS.
- Parameters:
data (list of lists) β The nested list containing the data.
index (int) β The starting index to search for the next βMethodβ.
- Returns:
The index of the next βMethodβ in the data.
- Return type:
int
- Raises:
EndOfDatasets β If the file ends without extra metadata.
- classmethod parse_cf(line)[source]#
Parse line in Substances section.
category
subcategory
flow
CAS number
CF
unit
- classmethod read_metadata(data, index)[source]#
Read metadata from data starting at index.
- Parameters:
data (list) β A list of lists containing the data to be processed.
index (int) β The starting index to read metadata from.
- Returns:
A tuple containing a dictionary of metadata and the index where the metadata reading ended.
- Return type:
tuple
- classmethod read_method_data_set(data, index, filepath)[source]#
Read method data set from data starting at index.
- Parameters:
data (list) β A list of lists containing the data to be processed.
index (int) β The starting index to read method data set from.
filepath (str) β The file path of the method data set.
- Returns:
list β A list of completed method data sets.
int β The index where the method data set reading ended.
- Raises:
ValueError β
- classmethod skip_to_section_end(data, index)[source]#
Skip to the end of the current section in the data starting from the specified index.
- Parameters:
data (list of lists) β The nested list containing the data.
index (int) β The starting index to skip from.
- Returns:
The index of the end of the current section in the data.
- Return type:
int